0

I am trying to introduce ember-i18n into my current project to manage translations across different varieties of english. Specifically, aiming to handle en-US & general en words. The issue I am having is that even if I specify the i18n.locale to be en-US it still uses the translations form the en/translations.js file. This is happening even if the defaultLocale is set to en-US in the config/environment.js

I have specified two translation files:

locales/
├── en
│   └── translations.js
└── en-US
    └── translations.js

with the following contents:

app/locales/en/translations.js

export default {                                                                                                                                                                                                                                                                                                                
  cheque: 'Cheque',                                                                                                                                                                                                                                                                                                           
  province: 'Province',                                                                                                                                                                                                                                                                                                       
  postalCode: 'Postal Code',                                                                                                                                                                                                                                                    
};

app/locales/en-US/translations.js

export default {                                                                                                                                                                                                                                                                                                              
  cheque: 'Check',                                                                                                                                                                                                                                                                                                            
  province: 'State',                                                                                                                                                                                                                                                                                                          
  postalCode: 'Zip Code',                                                                                                                                                                                                                                                                                                     
};    

Any ideas why the I can't get the location fallback to work as intended?

references:

Ember-i18n Wiki - Location Fallback

4

1 回答 1

0

James A. Rosen 在这条推文中回答了我的问题。问题是文件夹需要小写(en-us而不是en-US)。

默认的 Ember-CLI 解析器将所有模块名称小写。

因为它没有识别出我有一个en-us文件夹,所以它默认为en翻译。

于 2016-04-26T01:33:49.083 回答