diff --git a/lib/chess_web/templates/game/index.html.eex b/lib/chess_web/templates/game/index.html.eex
index 3de4738..e101c96 100644
--- a/lib/chess_web/templates/game/index.html.eex
+++ b/lib/chess_web/templates/game/index.html.eex
@@ -8,8 +8,10 @@
- <%= link gettext("Game with %{name}",
- name: opponent(@conn, game).name),
+ <%= link gettext(
+ "Game with %{name}",
+ name: opponent(@conn, game).name
+ ),
to: game_path(@conn, :show, game),
class: "btn btn-default btn-xs" %>
diff --git a/lib/chess_web/templates/game/show.html.eex b/lib/chess_web/templates/game/show.html.eex
index 5af2bc8..162a4a7 100644
--- a/lib/chess_web/templates/game/show.html.eex
+++ b/lib/chess_web/templates/game/show.html.eex
@@ -1,6 +1,6 @@
<%= link gettext("Back to games"), to: game_path(@conn, :index) %>
-Game with <%= opponent(@conn, @game).name %>
+<%= gettext "Game with %{name}", name: opponent(@conn, @game).name %>
diff --git a/lib/chess_web/views/game_view.ex b/lib/chess_web/views/game_view.ex
index ddc1cd3..779aa4b 100644
--- a/lib/chess_web/views/game_view.ex
+++ b/lib/chess_web/views/game_view.ex
@@ -1,14 +1,15 @@
defmodule ChessWeb.GameView do
use ChessWeb, :view
- alias Chess.Store.Game
alias Chess.GameState
import Chess.Auth, only: [current_user: 1]
def won_lost(conn, game) do
if game_over?(game) && game.state == "checkmate" do
- your_turn?(conn, game) && "You lost" || "You won"
+ your_turn?(conn, game) &&
+ gettext("You lost") ||
+ gettext("You won")
end
end
@@ -21,7 +22,7 @@ defmodule ChessWeb.GameView do
GameState.game_over?(game) ->
states[game.state]
your_turn?(conn, game) ->
- "Your turn"
+ gettext("Your turn")
true -> nil
end
end
@@ -50,9 +51,9 @@ defmodule ChessWeb.GameView do
defp states do
%{
- "checkmate" => "Checkmate!",
- "stalemate" => "Stalemate",
- "check" => "Check",
+ "checkmate" => gettext("Checkmate!"),
+ "stalemate" => gettext("Stalemate"),
+ "check" => gettext("Check"),
}
end
end