v5.0.0
This release refactors the addon to Ember Octane.
Mostly, everything stays the same, but the way you configure the addon changes, which results in breaking changes and needs attention.
You can find details here: #83
Breaking changes
Changed configuration
Instead of extending the service and putting configuration there, you now configure this addon fully through the config/environment.js
file:
ENV['ember-l10n'] = {
// This is required
locales: ['en', 'de'],
// These are optional (defaults listed)
defaultLocale: 'en',
autoInitialize: false,
defaultPluralForm: 'nplurals=2; plural=(n != 1);',
jsonPath: '/assets/locales'
}
Other notable changes
- Use Glimmer component for
<GetText>
- this is an internal change, the usage did not change at all. - Avoid using observers for the helpers - this is an internal change, we now manually register callbacks with the service for when the locale changes. Functionally, nothing changes here.
- Make
autoInitialize
default to false. In most scenarios you want to manually set the locale in the application route'sbeforeModel
hook or similar, in order to ensure that the locale file is loaded before the application is shown. - The deprecated
ember-l10n/test-helpers.js
file is removed. It is not needed anymore for quite some time.
You might also need to adjust something in your tests, if you relied on overwriting some properties of the l10n-service there. You can do so now like this:
class ExtendedL10nService extends L10nService {
_loadConfig() {
let config = {
locales: ['de', 'en', 'ko'],
autoInitialize: false,
defaultLocale: 'de',
};
return super._loadConfig(config);
}
_getWindow() {
return {};
}
}