lundi 30 janvier 2017

How to set internationalization in ember JS with a URL parameter or a variable in route/template

I have a readymade ember app on which i am working. It already has a i18n.js file in the initializer folder and has few lines of code as below

import Ember from 'ember';
export function initialize(/* container, application */) {
Ember.I18n.translations = TRANSLATIONS.en;
}

 var TRANSLATIONS = {
  en: {
      hello: 'Hello'
  },
  fr: {
      hello : 'bonjour' 
  }
 };

 export default {
    name: 'i18n',
    initialize: initialize,
    before: '',
    after: ''
 };

My app has 3 landing pages(french/english/spanish), so when the url for english landing page is clicked i should pass the 'en' parameter to the i18n.js.

I am new to ember and UI development, i went through the guides but was not able to find a specific example for my case




Aucun commentaire:

Enregistrer un commentaire