jeudi 27 avril 2017

Is it possible to reload the router in a running ember.js app in order to update the path strings of routes?

I'm implementing multi-language support in my app, and I guess this is the last thing that I would need in order to be able to change between languages without reloading the whole app/page. (I already have a solution with full page reload.)

For a simple example let's say this is how my router looks:

Router.map(function() {
  this.route('search', { path: t('search') });
  this.route('item', { path: `${t('item')}/:id`);
});

The t function would be getting the correct translation for the given strings in the currently active language.

The structure of the route hierarchy won't change, the only things that need to be updated are the path strings. Application state should be kept, of course.

I'm wondering whether this is possible to do.




Aucun commentaire:

Enregistrer un commentaire