question(urlMatcher): i18n the app paths
Hello everybody,
First of all, ui-router is really a huge improvement on any AngularJS app that pretends to bem flexible and well structured. Thank you for your effort!
In an application that I'm working on, we need to provide i18n of its paths.
Due to the nature of it, we need to deal with an endpoint that brings the available languages on the app.
So, the user enters on the app, and we have the following possibilities:
- Without a locale:
http://www.app.com(/); - With a valid locale:
http://www.app.com/:i18n(/); - With an invalid locale string:
http://www.app.com/articles(/)- The:i18npath param is interpreted asarticles; - With a valid locale but not available:
http://www.app.com/ru(/)- The:i18npath param is an unavailable locale;
I need to be able to:
- Load the API endpoint that gives the available languages;
- Parse the URL provided, change if necessary, and if so, replace it;
- During the app runtime, the possibility to change the i18n param through something like a button and:
- Inherit the current params, replacing the i18n one;
- Trigger the elements that need to know about the i18n change (can be resolves, on an abstract route, or even the current;
- With the ii, the possibility to deal with this without reloading the entire app (be able to only change the data used on the view; I'll use a feedback to inform the load of the new data);
One point is that, for example, if the user changes the locale to one that doesn't have content for the desired language, the app needs to redirect to a state that informs it to the user. I've thought, if its possible to trigger the elements on i18n change, and there's resolves on the state, on a rejection of one, it can dispatch a $stateChangeError, or something.
Ultimately, if I'm dealing with something that can be much simpler, please let me know... The use of a server configuration (the final server of this app will be an Apache), isn't that possible and, because the locales available comes from an API, I guess there's not much to deal with a .htaccess, isn't right?
Thanks!
This is a better question for stackoverflow. Try asking there.
http://stackoverflow.com/questions/24281652/localize-urls-with-ui-router-and-angular-translate
Ah, ok, I've placed one on there. The intention to ask here was about the core structure of ui-router, which there maybe not the view of the others.
Thanks for your time.