Skip to content
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

Localize whole application #12

Closed
raucao opened this issue Feb 25, 2014 · 4 comments
Closed

Localize whole application #12

raucao opened this issue Feb 25, 2014 · 4 comments
Labels

Comments

@raucao
Copy link
Owner

raucao commented Feb 25, 2014

Maybe these could be helpful:

@raucao raucao added the feature label Feb 25, 2014
@galfert
Copy link
Collaborator

galfert commented Jul 17, 2017

Ember addon for internationalization: https://github.com/jamesarosen/ember-i18n

@galfert
Copy link
Collaborator

galfert commented Jul 17, 2017

In a different project I determined the locale using the user's preferred Browser languages.

Using an instance initializer (app/instance-initializers/i18n):

export default {
  name: 'i18n',

  initialize: function(application) {
    let i18n = application.lookup('service:i18n');
    i18n.set('locale', determineLocale(i18n.get('locales')));
  }
};

function determineLocale(availableLocales) {
  let userLanguages = navigator.languages || [];
  userLanguages.push(navigator.language, navigator.userLanguage, 'en');

  return userLanguages.compact().find((language) => {
    return availableLocales.indexOf(language) > -1 ||
           availableLocales.indexOf(language.split('-')[0]) > -1;
  });
}

ebrahim-elgaml added a commit to ebrahim-elgaml/webmarks that referenced this issue Jul 17, 2017
refs raucao#12
install ember-i18n
add localization for en and de
set default languange to en
add translation for search input field place holder
@raucao
Copy link
Owner Author

raucao commented Oct 9, 2017

Works great now! I'm merging locally, with some changes on top.

@raucao raucao closed this as completed Oct 9, 2017
@raucao
Copy link
Owner Author

raucao commented Oct 9, 2017

@ebrahim-elgaml Thanks again for your contribution! Much appreciated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants