Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign up[gen_l10n] Document messages with translations for supported locales #67206
Comments
|
Also, current |
|
@shihaohong could you take a look? |
|
I like the idea in concept, but applications that support a larger number of translations would have a massive number of comments. For example, the gallery supports dozens of locales and the comments for each message would be extremely long if we wanted to document every single translation for each message. To clarify -- Is the issue here difficulty in figuring which translations are missing? There's an option called |
|
Good point. For me the most common case is two supported languages (english + developer's native language), so putting all translations there made sense. So instead we could put only template language + info for missing translations + maybe some docs about placeholders. This issue is not really about untranslated messages, I just mentioned it as it seemed nice to have. Actual issue is about having clear information about given localization string without looking up the .arb file or generated code. When writing widgets it's not always clear which text will be used. BTW, I'm aware of |
|
Actually, that's a bug and has been printing incorrectly. I just submitted #68553 which should fix that issue. I believe the issue you're facing here is that you're using |
|
Cool. Then this ticket is mostly about adding some comment docs, could be as simple as: /// en: Hello there {name}
String helloThere(Object arg0); |
|
I'll take a look into what we can do to make the docs helpful without cluttering it with too much noise. Maybe I'll start with the simple string getters first as a start and iterate to address the more complex ones, like methods with placeholders. |
|
@szotp I created a PR that adds a new comment line with the message value in the template arb locale. Take a look and provide any feedback if you have any! |
Consider this localization file:
{ "@@locale": "en", "@@last_modified": "2020-10-03T09:49:55.929624", "helloThere": "Hello there {name}", "@helloThere": { "placeholders": { "name": {} }, "description": "Lorem ipsum...", "type": "text" }, }It will generate this property:
But it would be much nicer if it also added documentation comment with translations:
This way, IDE will guide you as your are writing widgets, and you can now easily find missing translations with search functions.
@shihaohong Does this sound good? If yes, I could try to implement this and submit PR
Related ticket: #41437