Angular 2: strategies for doing multi-language apps/component -


i struggling how develop , structure multi-language app/components in angular 2.

in angular 1.x did in route config:

appdesktop.config([   "$stateprovider", "$urlrouterprovider", "$locationprovider", function($stateprovider: iappstateprovider, $urlrouterprovider: angular.ui.iurlrouterprovider, $locationprovider: ng.ilocationprovider) {     $urlrouterprovider.otherwise("/");     $stateprovider.state("home_en", {       url: "/",       views: {         'header': {           templateurl: "/angularjs/controllers/main/d.mainheader_en.html",           controller: "maincontroller",           controlleras: "main"         },         'content': {           templateurl: "/angularjs/controllers/main/d.maincontent_en.html"         }       },       language: languagechoiceenum.english,       changelangstate: "home_es",       title: "welcome"     });     $stateprovider.state("home_es", {       url: "/",       views: {         'header': {           templateurl: "/angularjs/corollers/main/d.mainheader_es.html",           controller: "maincontroller",           controlleras: "main"         },         'content': {           templateurl: "/angularjs/controllers/main/d.maincontent_es.html"         }       },       language: languagechoiceenum.spanish,       changelangstate: "home_en",       title: "bienvenido"     });     $locationprovider.html5mode(true);   } ]); 

so, in snippet, if on "home" page (english version) , chose go spanish version, redirect "home_es" state. worked well.

with angular 2, gathering can't dynamically assign views components (or can you?). hence trying figure out how accomplish similar , still keep code dry. ideas appreciated.


Comments

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -