mardi 13 septembre 2016

Internationalisation of ember application

I'm using ember-i18n lib for Internationalisation and want to save current locale in route like:

domain.com - empty for default en

doman.com/es, doman.com/de- for another

For this I tried to use rootURL

Router.reopen({
  rootURL: '/' ('es' or 'de')
});

Problem: When rootURL is not empty, app can't redirect and fail with error: ember.debug.js:4903 Uncaught Error: Assertion Failed: Path / does not start with the provided rootURL /es/

Question: What is the best solution to make redirect, all logic will be hold in emebr so I can't move this logic into nginx and etc.

Another option is Make a wrapper route, looks like this:

this.route(
    'lang', { path: '/:lang' }, function (){..}
);

This solution looks like not good:

  1. link-to helper will require lang param
  2. lang can't be empty (for default language)



Aucun commentaire:

Enregistrer un commentaire