diff --git a/lib/chess/store/game.ex b/lib/chess/store/game.ex
index 5e3d8a1..b977e8f 100644
--- a/lib/chess/store/game.ex
+++ b/lib/chess/store/game.ex
@@ -6,6 +6,7 @@ defmodule Chess.Store.Game do
import Ecto.Changeset
import Ecto.Query
+ import ChessWeb.Gettext
alias Chess.Board
alias Chess.Store.Game
@@ -52,7 +53,7 @@ defmodule Chess.Store.Game do
changeset
|> add_error(
:board,
- "That move would leave your king in check"
+ gettext("That move would leave your king in check")
)
else
changeset
diff --git a/lib/chess_web/templates/game/form.html.eex b/lib/chess_web/templates/game/form.html.eex
index 631176a..149bc87 100644
--- a/lib/chess_web/templates/game/form.html.eex
+++ b/lib/chess_web/templates/game/form.html.eex
@@ -1,7 +1,9 @@
<%= form_for @changeset, @action, fn f -> %>
<%= if @changeset.action do %>
-
Oops, something went wrong! Please check the errors below.
+
+ <%= gettext "Oops, something went wrong! Please check the errors below." %>
+
<% end %>
diff --git a/lib/chess_web/templates/game/index.html.eex b/lib/chess_web/templates/game/index.html.eex
index ff3b940..a209df1 100644
--- a/lib/chess_web/templates/game/index.html.eex
+++ b/lib/chess_web/templates/game/index.html.eex
@@ -1,21 +1,30 @@
-Listing games
+<%= gettext "Listing games" %>
<%= for game <- @games do %>
-
- <%= link "Game with #{opponent(@conn, game).name}", to: game_path(@conn, :show, game), class: "btn btn-default btn-xs" %>
+
+
+
+ <%= link gettext("Game with %{name}",
+ name: opponent(@conn, game).name),
+ to: game_path(@conn, :show, game),
+ class: "btn btn-default btn-xs" %>
- <%= if your_turn?(@conn, game) do %>Your turn<% end %>
+ <%= if your_turn?(@conn, game), do: gettext("Your turn") %>
Started on <%= Timex.format!(game.inserted_at, "%b %e at %I:%M %P", :strftime) %>
- <%= link "Delete", to: game_path(@conn, :delete, game), method: :delete, data: [confirm: "Are you sure?"], class: "btn btn-danger btn-xs" %>
+ <%= link gettext("Delete"),
+ to: game_path(@conn, :delete, game),
+ method: :delete,
+ data: [confirm: gettext("Are you sure?")],
+ class: "btn btn-danger btn-xs" %>
<% end %>
@@ -23,5 +32,5 @@
- <%= link "New game", to: game_path(@conn, :new), class: "button" %>
+ <%= link gettext("New game"), to: game_path(@conn, :new), class: "button" %>
diff --git a/lib/chess_web/templates/game/new.html.eex b/lib/chess_web/templates/game/new.html.eex
index 2d5f7ff..2b26914 100644
--- a/lib/chess_web/templates/game/new.html.eex
+++ b/lib/chess_web/templates/game/new.html.eex
@@ -1,14 +1,17 @@
-New game
+<%= gettext "New game" %>
<%= form_for @changeset, game_path(@conn, :create), [class: "create-game"],
fn form -> %>
<%= label form, :opponent_id %>
- <%= select form, :opponent_id, @opponents, prompt: "Choose an opponent" %>
+ <%= select form,
+ :opponent_id,
+ @opponents,
+ prompt: gettext("Choose an opponent") %>
<%= error_tag form, :opponent_id %>
- <%= submit "Create game", class: "button" %>
+ <%= submit gettext("Create game"), class: "button" %>
<% end %>
diff --git a/lib/chess_web/templates/game/show.html.eex b/lib/chess_web/templates/game/show.html.eex
index 0402355..5af2bc8 100644
--- a/lib/chess_web/templates/game/show.html.eex
+++ b/lib/chess_web/templates/game/show.html.eex
@@ -1,4 +1,4 @@
-<%= link "Back to games", to: game_path(@conn, :index) %>
+<%= link gettext("Back to games"), to: game_path(@conn, :index) %>
Game with <%= opponent(@conn, @game).name %>
diff --git a/lib/chess_web/templates/layout/app.html.eex b/lib/chess_web/templates/layout/app.html.eex
index 6fd8065..a61d834 100644
--- a/lib/chess_web/templates/layout/app.html.eex
+++ b/lib/chess_web/templates/layout/app.html.eex
@@ -7,32 +7,38 @@
- Shall We Play a Game?
+ <%= gettext "Shall We Play a Game?" %>
">
-
Chess
+ <%= gettext "Chess" %>
<%= if current_user(@conn) do %>
<%= current_user(@conn).name %> (<%= current_user(@conn).email %>)
|
- <%= link("Log out", to: session_path(@conn, :delete), method: :delete) %>
+ <%= link gettext("Log out"),
+ to: session_path(@conn, :delete),
+ method: :delete %>
<% else %>
- <%= link("Register", to: registration_path(@conn, :new)) %>
+ <%= link gettext("Register"), to: registration_path(@conn, :new) %>
|
- <%= link("Log in", to: session_path(@conn, :new)) %>
+ <%= link gettext("Log in"), to: session_path(@conn, :new) %>
<% end %>
-
<%= get_flash(@conn, :info) %>
-
<%= get_flash(@conn, :error) %>
+
+ <%= get_flash(@conn, :info) %>
+
+
+ <%= get_flash(@conn, :error) %>
+
diff --git a/lib/chess_web/templates/registration/new.html.eex b/lib/chess_web/templates/registration/new.html.eex
index c9d2787..ebbd32c 100644
--- a/lib/chess_web/templates/registration/new.html.eex
+++ b/lib/chess_web/templates/registration/new.html.eex
@@ -1,9 +1,11 @@
-Register
+<%= gettext "Register" %>
<%= form_for @changeset, registration_path(@conn, :create), [class: "create-registration"], fn f -> %>
<%= if @changeset.action do %>
-
Oops, something went wrong! Please check the errors below.
+
+ <%= gettext "Oops, something went wrong! Please check the errors below." %>
+
<% end %>
@@ -19,6 +21,6 @@
- <%= submit "Register", class: "btn btn-primary" %>
+ <%= submit gettext("Register"), class: "btn btn-primary" %>
<% end %>
diff --git a/lib/chess_web/templates/session/new.html.eex b/lib/chess_web/templates/session/new.html.eex
index fbb5ea1..e02b6a2 100644
--- a/lib/chess_web/templates/session/new.html.eex
+++ b/lib/chess_web/templates/session/new.html.eex
@@ -1,9 +1,11 @@
-Log in
+<%= gettext "Log in" %>
<%= form_for @changeset, session_path(@conn, :create), [class: "create-session"], fn f -> %>
<%= if @changeset.action do %>
-
Oops, something went wrong! Please check the errors below.
+
+ <%= gettext "Oops, something went wrong! Please check the errors below." %>
+
<% end %>
@@ -16,6 +18,6 @@
- <%= submit "Log in", class: "btn btn-primary" %>
+ <%= submit gettext("Log in"), class: "btn btn-primary" %>
<% end %>
diff --git a/lib/chess_web/views/error_view.ex b/lib/chess_web/views/error_view.ex
index f6f6de4..99aa39f 100644
--- a/lib/chess_web/views/error_view.ex
+++ b/lib/chess_web/views/error_view.ex
@@ -2,11 +2,11 @@ defmodule ChessWeb.ErrorView do
use ChessWeb, :view
def render("404.html", _assigns) do
- "Page not found"
+ gettext "Page not found"
end
def render("500.html", _assigns) do
- "Internal server error"
+ gettext "Internal server error"
end
# In case no render clause matches or no