brackets-archive / bracketsIssues

Archive of issues in brackets.
0 stars 0 forks source link

Consider using l10ns for internationalization #12893

Open core-ai-bot opened 3 years ago

core-ai-bot commented 3 years ago

Issue by tinganho Monday Oct 20, 2014 at 11:46 GMT Originally opened as https://github.com/adobe/brackets/issues/9604


Hi I have looked at your solution for i18n. It seems like you only define a regular key-value store as an i18n solution with some interpolation option. So I guess you will run into problem when you want some pluralization, number formatting, context(genus) based formatting?

It seems like the current solution for dealing with pluralization is not optimal.

For instance you have defined these translation keys:

COLOR_EDITOR_USED_COLOR_TIP_SINGULAR
COLOR_EDITOR_USED_COLOR_TIP_PLURAL

Russian language have more than two plural forms, not just singular and plural.

But also what happens when you change one translation key? I guess you need to change the translation key on all localizations files?

I would be very glad if you can consider using l10ns in brackets? it deals with all the problems above. It uses ICU's message format syntax to define localization strings. It also traverse your code to get all the translation keys. Please check it out http://l10ns.org and read more in their documentation.

core-ai-bot commented 3 years ago

Comment by MarcelGerber Monday Oct 20, 2014 at 15:47 GMT


:+1: We actually got multiple such cases in the German translation...

core-ai-bot commented 3 years ago

Comment by tinganho Monday Oct 20, 2014 at 22:07 GMT


For those of you who haven't heard of ICU's messageformat. It's a compact(optionally nested) syntax for defining formatted strings for localization. It's used by many of the big companies such as Google, IBM and Apple. It is also makes use of localization data from CLDR, such as pluralization data. CLDR defines up to six different plural forms zero, one, two, few, many and other. Each definition of a plural form in one local might be different from an another locale. For example, English language have the plural forms one and other. Whereas arabic defines all 6 plural forms. And there is actually quite many languages that uses more than 2 plural forms.

So for translating a plural example in ICU's messageformat syntax.

You got {likes, plural, one{# like} other{# likes}}.

L10ns also deal with the workflow around translation. It helps you sync the translation keys between your source code and your localization storage. So if you happen to change one translation key -> it helps you to migrate the translation, if you happen to delete one translation key -> it deletes the key from storage, if you happen to add one translation key -> it helps you to add the key to your storage.