mirror of
https://github.com/danbee/chess
synced 2025-03-04 08:39:06 +00:00
Gettextify!
This commit is contained in:
parent
f03692c9b9
commit
f19b30dfaf
@ -8,8 +8,10 @@
|
||||
<span class="player-indicator">
|
||||
<img src="images/pawn_<%= player_colour(@conn, game) %>.svg">
|
||||
</span>
|
||||
<%= 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" %>
|
||||
</td>
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<p><%= link gettext("Back to games"), to: game_path(@conn, :index) %></p>
|
||||
|
||||
<h2>Game with <%= opponent(@conn, @game).name %></h2>
|
||||
<h2><%= gettext "Game with %{name}", name: opponent(@conn, @game).name %></h2>
|
||||
|
||||
<div id="app" data-game-id="<%= @game.id %>">
|
||||
</div>
|
||||
|
||||
@ -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
|
||||
|
||||
Loading…
Reference in New Issue
Block a user