Skip to content

Commit 470f077

Browse files
committed
Refactoring for i18n.
1 parent 089f6a7 commit 470f077

File tree

17 files changed

+76
-85
lines changed

17 files changed

+76
-85
lines changed

MarvelWorld-Cli/Brocfile.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ app.import('bower_components/bootstrap/dist/css/bootstrap.css');
2121
app.import('bower_components/bootstrap/dist/css/bootstrap.css.map');
2222
app.import('bower_components/bootstrap/dist/js/bootstrap.min.js');
2323
app.import('bower_components/moment/moment.js');
24-
app.import('bower_components/ember-i18n/lib/i18n.js');
2524

2625

2726
module.exports = app.toTree();

MarvelWorld-Cli/app/controllers/movies/index.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ export default Ember.ArrayController.extend({
77
maxWatches: Ember.computed.max('watches'),
88
minWatches: Ember.computed.min('watches'),
99
hasMovieAward: Ember.computed.any('model', 'award'),
10+
name: function() {
11+
var a="";
12+
}.property(),
1013
actions:{
1114
seeAllActors:function(){
1215
this.get('controllers.actors').send('showAllActors');
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import Ember from 'ember';
22

3+
34
export default Ember.Handlebars.makeBoundHelper(function(key){
4-
return Ember.I18n.t(key).toUpperCase();
5+
56
});

MarvelWorld-Cli/app/initializers/i18n.js

Lines changed: 0 additions & 38 deletions
This file was deleted.

MarvelWorld-Cli/app/locales/en.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
export default {
2+
movie:{
3+
yes: "YES",
4+
noExclamation: "NO!",
5+
maxWatches: "(*) The movie with MAX watches has: ",
6+
minWatches: "(*) The movie with MIN watches has: ",
7+
viewers: "viewers.",
8+
award: "(*) Is there movie with awards?",
9+
},
10+
english: "English",
11+
spain: "Spain"
12+
};

MarvelWorld-Cli/app/locales/es.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
export default {
2+
movie:{
3+
name: "Movie",
4+
yes: "SI",
5+
noExclamation: "NO!",
6+
maxWatches: "(*) La película con mayor cantidad de espectadores: ",
7+
minWatches: "(*) La película con menos cantidad de espectadores: ",
8+
viewers: "espectadores.",
9+
award: "(*) Hay peliculas con premiados?",
10+
}
11+
};

MarvelWorld-Cli/app/routes/application.js

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,17 @@ export default Ember.Route.extend({
1414
outlet: 'modal',
1515
parentView: 'application'
1616
});
17-
}
17+
},
18+
setSpainLanguage: function(){
19+
console.log("0001");
20+
},
21+
setEnglishLanguage: function(){
22+
23+
/*var set = Ember.set;
24+
var application = container.lookup('application:main');
25+
set(application, 'locale', 'en');*/
26+
27+
28+
}
1829
}
1930
});

MarvelWorld-Cli/app/styles/app.css

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -461,4 +461,27 @@ background: url('/assets/images/delete.png') no-repeat;
461461
.info-modal-button-container{
462462
bottom: 8px;
463463
position: absolute;
464+
}
465+
466+
.languages-container{
467+
float: left;
468+
margin-left: 6px;
469+
margin-top: 2px;
470+
}
471+
472+
.spain-language{
473+
background: url("/assets/images/spain-flag.png") no-repeat scroll 0 0 / cover rgba(0, 0, 0, 0);
474+
float: left;
475+
width: 16px;
476+
height: 16px;
477+
cursor: pointer;
478+
}
479+
480+
.english-language{
481+
background: url("/assets/images/us-flag.png") no-repeat scroll 0 0 / cover rgba(0, 0, 0, 0);
482+
float: left;
483+
height: 16px;
484+
margin-left: 4px;
485+
width: 16px;
486+
cursor: pointer;
464487
}

MarvelWorld-Cli/app/templates/layouts/main.hbs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,11 @@
66
{{#link-to "tv" class="btn btn-primary btn-lg"}}TV{{/link-to}}
77
{{#link-to "events" class="btn btn-primary btn-lg"}}Events{{/link-to}}
88
<div class="current-date">
9-
{{current-date}}
9+
{{current-date}}
10+
</div>
11+
<div class="languages-container">
12+
<div class="spain-language" {{action "setSpainLanguage"}}></div>
13+
<div class="english-language" {{action "setEnglishLanguage"}}></div>
1014
</div>
1115
</div>
1216

MarvelWorld-Cli/app/templates/movies/index.hbs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{{partial "layouts/main"}}
22
<div class="movie-container">
3-
<h3>{{upper-case-i18n "movies"}}</h3>
3+
<h3>{{upper-case-i18n name}}</h3>
44
<ul class="list-undstyled">
55
{{#each}}
66
<li>
@@ -13,13 +13,13 @@
1313
</ul>
1414
<div class="movie-summary">
1515
<h5>{{upper-case-i18n "movie.summary"}}</h5>
16-
<div class="movie-watches">{{t "movie.max.watches"}} <span>{{maxWatches}} {{t "viewers"}}</span></div>
17-
<div class="movie-watches">{{t "movie.min.watches"}}<span>{{minWatches}} {{t "viewers"}}</span></div>
16+
<div class="movie-watches">{{t "movie.maxWatches"}} <span>{{maxWatches}} {{t "movie.viewers"}}</span></div>
17+
<div class="movie-watches">{{t "movie.minWatches"}}<span>{{minWatches}} {{t "movie.viewers"}}</span></div>
1818
<div class="movie-watches">{{t "movie.award"}}
1919
{{#if hasMovieAward}}
20-
<span>{{t "yes"}}</span>
20+
<span>{{t "movie.yes"}}</span>
2121
{{else}}
22-
<span>{{t "no.exclamation"}}</span>
22+
<span>{{t "movie.noExclamation"}}</span>
2323
{{/if}}
2424
</div>
2525
<div class="movie-watches">

0 commit comments

Comments
 (0)