I'm building a multilingual app and I'm wondering if it's possible to set the angular-route paths dynamically, ie. so that I can switch the slug from English to Spanish (/#/login
becomes /#/iniciar
).
I am using angular-translate and require.js lazy-loading, so my translated strings are loaded after the app is bootstrap. So I would need to be able to change the routes after the app has been bootstrap.
Is this possible using angular-route
, or maybe even using angular-ui's ui-router
instead...?
Something like:
app.config(function ($routeProvider, SomeLanguageService) {
var pathSlugs = SomeLanguageService.getRouteSlugs('ES');
$routeProvider
.when('/' + pathSlugs.home , {
templateUrl: '/home/home.html',
controller: ''
});
});