-
Notifications
You must be signed in to change notification settings - Fork 183
en shown instead of en-US #340
Comments
Thanks for submitting this. There are several tests that cover changing locales within a tree, so I'm surprised there's a bug. I have a few hypotheses, though (mostly around modifying translation dictionaries as we compile them for a locale instead of copying before modifying). First we'll need to understand what your translations look like a bit. Can you provide just a small segment of each of the three translations files that represent the same keys? For example, // app/locales/en/translations.js:
"welcome": "Welcome to Great Britain",
"hello": "Hello"
// app/locales/en-US/translations.js:
"welcome": "Welcome to America",
// no "hello"
// app/locales/de/translations.js:
"welcome": "willkommen in Deutschland"
"hello": "hallo" So I'm looking for at least one key where they all differ and one key where only en and de differ; en-US has no override. Given that, I'd like to know what the following code outputs: i18n.set('locale', 'en');
i18n.t('welcome');
i18n.t('hello');
i18n.set('locale', 'en-US');
i18n.t('welcome');
i18n.t('hello');
i18n.set('locale', 'en'); // back to en
i18n.t('welcome');
i18n.t('hello');
i18n.set('locale', 'de');
i18n.t('welcome');
i18n.t('hello');
i18n.set('locale', 'en-US'); // back to en-US
i18n.t('welcome');
i18n.t('hello'); |
Thank you for your efforts. Code outputs you wished SafeString {string: "Welcome to Great Britain"} SafeString {string: "Welcome to Great Britain"} SafeString {string: "Welcome to Great Britain"} SafeString {string: "willkommen in Deutschland"} SafeString {string: "Welcome to Great Britain"} Other observations
Switching to en-US
Switching to de-DE
|
Thanks. I think this confirms my hypothesis. I know where to fix this. One thing that might help us know what happens if you change the order of languages -- default to en-GB, then switch to en. This will tell me if its a hierarchy problem or an order problem. I think it's the latter. |
I'm going to take a guess that your translations are actually in Ember-I18n asks the Ember.String.dasherize('en-us'); // 'en-us'
Ember.String.dasherize('en-US'); // 'en-us' So you would need to move your translations to I'm going to add some tests around switching locales to ensure other problems don't surface here. |
James, that solved it. How could I missed that? Manuel |
Not at all! It revealed expectations I didn't know I was making. And I added some tests :) |
Hi,
thanks for this great addon.
However, we are struggling in setting up 3 different locales: 'en' (means en-GB), 'en-US' and 'de'.
We read #256 .
While 'de' is working properly, switching to 'en' or 'en-US' always leads to the locales defined in 'en'. No indications for missing translations.
What are we doing wrong?
Thank you.
Our setup:
Versions:
The text was updated successfully, but these errors were encountered: