I have another question regarding a reload of the current visible content after the user makes a language switch. I currently use the same i18n handling like described by Robin Ward in this article Internationalization Support in Ember.js | Evil Trout’s Blog - I have a bunch of {{i18n bla}} all around my templates.
When I manually set the I18n.locale to another language and click on another view, it will show me the content with the new selected language.
My first try was to fire an action for the ApplicationRoute and there do a this.render() but it would only re-render the application template and no nested routes.
What would be a good solution to re-render the current view with all nested routes, components and views?
Not nice. I think about moving everything away from the application view to next level template which I can reload with the transitionTo(loading) and back to the view once the language is loaded.
I’ve recently stumbled upon this as well and @alcedo’s solution sort of worked for me, however why iterate over all my views, isn’t it more efficient to just target the toplevel view?
I was searching for a way to do something equivalent to an onPageLoad in a non-SPA and found the following solution on StackOverflow. I thought I should share what I found in case it might help anyone else.
DISCLAIMER: I’m still new to Ember, so I’m not sure if this is the right way to go about doing a “onPageLoad” equivalent, but this is working for me. I’d love for any feedback on a better way if there is one! Thanks!
ember-i18n has been re-rendering translations that were created via the t helper for a while now (since Oct 2015), from version 4.1.4, which is really neat.