Skip to content

Commit

Permalink
Change output messages to localized in html_actuator. Add additional …
Browse files Browse the repository at this point in the history
…localized strings in i18n.
  • Loading branch information
a4vi2r committed Feb 28, 2017
1 parent aa7e344 commit e22c42e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
6 changes: 3 additions & 3 deletions js/html_actuator.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,15 +137,15 @@ HTMLActuator.prototype.updateBestScore = function (bestScore) {

HTMLActuator.prototype.message = function (won) {
var type = won ? "game-won" : "game-over";
var message = won ? "You win!" : "Game over!";
var message = won ? i18n.get('you_win') : i18n.get('game_over');

this.messageContainer.classList.add(type);
this.messageContainer.getElementsByTagName("p")[0].textContent = message;
};

HTMLActuator.prototype.promptRestart = function () {
this.clearMessage();
var message = "Start a new game?";
var message = i18n.get('start_a_new_game');
this.messageContainer.classList.add("restart-game");
this.messageContainer.getElementsByTagName("p")[0].textContent = message;
};
Expand All @@ -160,7 +160,7 @@ HTMLActuator.prototype.clearMessage = function () {

HTMLActuator.prototype.promptUndo = function () {
this.clearMessage();
var message = "Undo the current move?";
var message = i18n.get('undo_the_current_move');
this.messageContainer.classList.add("undo-move");
this.messageContainer.getElementsByTagName("p")[0].textContent = message;
};
6 changes: 6 additions & 0 deletions js/i18n.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ var Localizer = (function(lang) {
ok : 'OK',
cancel : 'Cancel',
start_a_new_game : 'Start a new game?',
undo_the_current_move : 'Undo the current move?',
you_win : 'You win!',
game_over : 'Game over!'
};

var localizedMsgs = {};
Expand All @@ -33,6 +36,9 @@ var Localizer = (function(lang) {
ok : 'ОК',
cancel : 'Отмена',
start_a_new_game : 'Начать новую игру?',
undo_the_current_move : 'Отменить текущий ход?',
you_win : 'Вы победили!',
game_over : 'Игра закончена!'
};
break;
}
Expand Down

0 comments on commit e22c42e

Please sign in to comment.