-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve docs #2
Comments
Did you take a look here? export default {
name: "locale",
//after: "store",
initialize: function(container, application) {
application.register('locale:main', application.locale, { instantiate: false, singleton: true });
container.typeInjection('controller', 'locale', 'locale:main');
container.typeInjection('route', 'locale', 'locale:main');
container.typeInjection('component', 'locale', 'locale:main');
container.typeInjection('model', 'locale', 'locale:main');
Ember.Component.reopen(Ember.I18n.TranslateableAttributes);
Ember.View.reopen(Ember.I18n.TranslateableAttributes);
}
}; My application.locale is as follows: import Locale from './utils/locale';
Locale.set();
.
.
.
var App = Ember.Application.extend({
locale: Locale
}); Then lastly my utils/locale is as follows: import Translations from 'boxture/translations';
import moment from 'boxture/utils/shims/moment';
//import numeral from 'boxture/utils/shims/numeral';
export default {
default: 'en',
current: null,
set: function(app,locale) {
// TODO or userLocale from localStorage
locale = window.navigator.userLanguage || window.navigator.language;
if (locale) {
locale = locale.split('-')[0];
}
locale = locale || this.default;
this.current = locale;
moment.lang(locale);
// numeral.language(locale);
// CLDR.defaultLanguage = locale;
this.setTranslations(locale);
},
setTranslations: function(locale) {
Em.I18n.translations = Translations[locale];
}
}; Now what is left out is how to load the JSON files into a hash you can actually use in the |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Given that I know the locale, e.g. "en", "fr ", how do instruct my ember cli app which compiled handlebars templates to use?
The text was updated successfully, but these errors were encountered: