Permalink
Browse files

Add buttons for switching the locales of the application

  • Loading branch information...
corrspt committed Nov 19, 2016
1 parent f4a1559 commit 690a6743015f5bea1768cc3fb9f53b43796879fc
Showing with 10 additions and 1 deletion.
  1. +7 −1 app/controllers/application.js
  2. +3 −0 app/templates/application.hbs
@@ -2,10 +2,12 @@ import Ember from 'ember';
const {
Controller,
get
get,
inject: { service }
} = Ember;
export default Controller.extend({
i18n: service(),
actions: {
setName(name) {
@@ -16,6 +18,10 @@ export default Controller.extend({
setAge(age) {
let model = get(this, 'model');
model.set('age', age);
},
setLocale(value) {
this.set('i18n.locale', value);
}
}
});
@@ -1,6 +1,9 @@
<div class="container">
<h2 id="title">Conventions, Conventions</h2>
<button class='btn btn-default' disabled={{eq i18n.locale 'en'}} onClick={{action 'setLocale' 'en'}}>English</button>
<button class='btn btn-default' disabled={{eq i18n.locale 'pt'}} onClick={{action 'setLocale' 'pt'}}>Português</button>
<div class="row">
<div class="col-sm-6">
{{

0 comments on commit 690a674

Please sign in to comment.