Quantcast
Channel: Ember.JS - Latest topics
Viewing all articles
Browse latest Browse all 4828

Managing multi language

$
0
0

@Maelstrom wrote:

Good day people!

I am kinda new to Ember, I have read the doc quite a few times but without yet the opportunity to experiment it. I just started a new personal project and I am looking forward for advices to design my app correctly.

I am going to use multi language for my site, after some research, I found i18n module.

I have set up the basics, the first trads and a few routes.

I want URLs following this pattern: mysite.com/lang = index/home page mysite.com/lang/page = other pages Hence, my router is looking something like that:

this.route('lang', { path: '/:lang' } , function() {
    this.route('index', { path: '/' });
    this.route('404', { path: '/*wildcard' });
    this.route('somepage', { path: '/somepage' });
});

Now I want to manage the default language, I created the script that will prioritize: URL > Navigator > default (in config). I now have to define where to include it.

Say, locales are en & es. zh is not a supported locale. en is the default language.

It needs to be executed everytime I am accessing a route:

  • mysite.com --> mysite.com/en
  • mysite.com/page --> mysite.com/en
  • mysite.com/zh/somepage --> mysite.com/en/somepage

(I also installed this for injection).

Here is my question: where do I put my redirection script? Should I reopen the Controler class? The Route class?

Thank you.

Posts: 3

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 4828

Trending Articles