Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I solved the exact same problem by adding an observer method to the application view, which listens to changes in the language setting, and if it detects a change, rerenders the view using the rerender() method.</p> <p>I have a language controller:</p> <pre><code>FLOW.languageControl = Ember.Object.create({ dashboardLanguage:null, content:[ Ember.Object.create({label: "English", value: "en"}), Ember.Object.create({label: "Dutch", value: "nl"}), Ember.Object.create({label: "Spanish", value: "sp"}), Ember.Object.create({label: "French", value: "fr"})], changeLanguage:function(){ locale=this.get("dashboardLanguage.value"); console.log('changing language to ',locale); if (locale == "nl") {Ember.STRINGS=Ember.STRINGS_NL;} else if (locale == "fr") {Ember.STRINGS=Ember.STRINGS_FR;} else if (locale == "sp") {Ember.STRINGS=Ember.STRINGS_SP;} else {Ember.STRINGS=Ember.STRINGS_EN;} }.observes('dashboardLanguage') }); </code></pre> <p>with a dropdown in a handlebars file:</p> <pre><code>&lt;label&gt;Dashboard language: {{view Ember.Select contentBinding="FLOW.languageControl.content" optionLabelPath="content.label" optionValuePath="content.value" selectionBinding="FLOW.languageControl.dashboardLanguage" }} &lt;/label&gt; </code></pre> <p>And a (simplified) Navigation view, which renders the top navigation:</p> <pre><code>FLOW.NavigationView = Em.View.extend({ templateName: 'navigation', selectedBinding: 'controller.selected', onLanguageChange:function(){ this.rerender(); }.observes('FLOW.languageControl.dashboardLanguage'), }); </code></pre> <p>When the navigationView detects a language change (which was caused by the user selecting a language from the dropbox), the navigationView is rerendered.</p> <p>You could do the same thing on the Application view, it is just that I only need the navigation view to be rerendered.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload