-
Notifications
You must be signed in to change notification settings - Fork 27
Fix missing language translations bug #79
base: master
Are you sure you want to change the base?
Conversation
The bug was that if Firefox's locale (browser.useragent.locale in about:config) was such that there weren't translations for that locale in data/languages.json file, gtranslate's menucontext didn't show up at all. To fix this, a support for a locale is tested and in case a locale isn't supported, a fallback locale is used. See PR bpierre#77 for additional conversation.
There are two things up for a discussion.
I want to emphasis; when a locale or translations are mentioned, they are about |
if (languages.auto[locale]) { | ||
return locale | ||
} | ||
const i = locale.indexOf('-') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As some improvement, you could try to remove the dialect first. Then remove the region code.
Here is the format of the locale codes.
Try the locale support with the whole locale string, (possibly) without a dialect and without a region.
I added trying the locale without a dialect also. There was a bug in the previous commit, I didn't try whether the locale without a region was actually supported, I just returned it. |
About the What do you think about it? |
Yeah, that's probably a better way than the current one. I'll look into it. Or, I don't know if it can be done with properties files, but maybe the file could be split into a different locales. Then we would just need to load the locale's languages file and remove the rest of the localization related code. |
It should work with properties file format. Notice: |
It looks good to me, but yes I agree that we should probably move these translations in the @fluks @PerfectSlayer I plan to publish a new version once this and the french translation are merged, if that’s ok for you? |
I'm starting to convert languages.json file to several locale properties. After the #80 is merged, you could merge #77 and then publish a new version. |
Do we still need |
The bug was that if Firefox's locale (browser.useragent.locale in
about:config) was such that there weren't translations for that locale
in data/languages.json file, gtranslate's menucontext didn't show up at
all.
To fix this, a support for a locale is tested and in case a locale isn't
supported, a fallback locale is used.
See PR #77 for additional conversation.