Seeking a solution to
- dynamically set the current language for display: I have followed the latest angular recipe for internationalization as outlined here, which states "the user's language is hardcoded as a global document.locale variable in the index.html"
How can this be achieved dynamically in angular2 + typescript?
My attempt from the official Angular2 plunkr version: https://plnkr.co/edit/lWV4VhzpWYnCXeDBpzsn?p=preview where I've commented out the
document.locale='en';
I tried accessing the window.document within a typescript service to change the locale there, but even though it is called and the locale is properly set (as shown in the console), the interface does not appear in the selected language at startup.
Furthermore, since the incorrect method is used and the display is not refreshed, the dropdown buttons do not work either; resolving this issue will be the next step.