Permalink
Browse files

Start on translationing the game

Login page text strings to start with
  • Loading branch information...
oestrich committed Aug 31, 2018
1 parent 35b310b commit 2253db566f3bb16546efce32e92f58d67879d19a
View
@@ -54,4 +54,6 @@ config :prometheus, Metrics.PipelineInstrumenter,
config :gossip, :callback_module, Game.Gossip
config :ex_venture, Game.Gettext, default_locale: "en"
import_config "#{Mix.env()}.exs"
View
@@ -0,0 +1,4 @@
defmodule Game.Gettext do
@moduledoc false
use Gettext, otp_app: :ex_venture
end
View
@@ -9,6 +9,8 @@ defmodule Game.Session.Login do
use Networking.Socket
use Game.Environment
import Game.Gettext, only: [dgettext: 2]
require Logger
alias Data.Repo
@@ -32,10 +34,8 @@ defmodule Game.Session.Login do
def start(socket) do
socket |> @socket.echo("#{ExVenture.version()}\n#{MOTD.random_motd()}")
socket
|> @socket.prompt(
"What is your player name (Enter {command}create{/command} for a new account)? "
)
prompt = dgettext("login", "What is your player name? (Enter {command}create{/command} for a new account) ")
socket |> @socket.prompt(prompt)
end
@doc """
@@ -73,10 +73,10 @@ defmodule Game.Session.Login do
:ok
_ ->
socket |> @socket.echo("You have mail.")
socket |> @socket.echo(dgettext("login", "You have mail."))
end
socket |> @socket.echo("[Press enter to continue]")
socket |> @socket.echo(dgettext("login", "[Press enter to continue]"))
state
end
@@ -86,8 +86,8 @@ defmodule Game.Session.Login do
finish_login(state, session)
else
{:error, :room, :missing} ->
state.socket |> @socket.echo("The room you were in has been deleted.")
state.socket |> @socket.echo("Sending you back to the starting room!")
state.socket |> @socket.echo(dgettext("login", "The room you were in has been deleted."))
state.socket |> @socket.echo(dgettext("login", "Sending you back to the starting room!"))
starting_save = Game.Config.starting_save()
@@ -156,14 +156,10 @@ defmodule Game.Session.Login do
end
def process(message, state) do
echo = """
Please sign in via the website to authorize this connection.
{link}#{Routes.public_connection_url(Web.Endpoint, :authorize, id: state.id)}{/link}
"""
link = Routes.public_connection_url(Web.Endpoint, :authorize, id: state.id)
echo = dgettext("login", "Please sign in via the website to authorize this connection.")
echo = "#{echo}\n\n{link}#{link}{/link}"
state.socket |> @socket.echo(echo)
Map.merge(state, %{login: %{name: message}})
end
@@ -173,14 +169,13 @@ defmodule Game.Session.Login do
player |> login(state.socket, state |> Map.delete(:login))
else
{:error, :signed_in} ->
state.socket |> @socket.echo("Sorry, this player is already logged in.")
state.socket |> @socket.echo(dgettext("login", "Sorry, this player is already logged in."))
state.socket |> @socket.disconnect()
state
{:error, :disabled} ->
state.socket
|> @socket.echo("Sorry, your account has been disabled. Please contact the admins.")
message = dgettext("login", "Sorry, your account has been disabled. Please contact the admins.")
state.socket |> @socket.echo(message)
state.socket |> @socket.disconnect()
state
end
@@ -206,7 +201,7 @@ defmodule Game.Session.Login do
player |> _recover_session(state)
else
{:error, :signed_in} ->
socket |> @socket.echo("Sorry, this player is already logged in.")
socket |> @socket.echo(dgettext("login", "Sorry, this player is already logged in."))
socket |> @socket.disconnect()
state
end
@@ -222,7 +217,7 @@ defmodule Game.Session.Login do
state = after_sign_in(state, self())
state.socket |> @socket.echo("Session recovering...")
state.socket |> @socket.echo(dgettext("login", "Session recovering..."))
state |> Process.prompt()
state |> Regen.maybe_trigger_regen()
View
@@ -9,7 +9,7 @@ defmodule ExVenture.Mixfile do
elixirc_paths: elixirc_paths(Mix.env()),
build_embedded: Mix.env() == :prod,
start_permanent: Mix.env() == :prod,
compilers: [:phoenix] ++ Mix.compilers(),
compilers: [:phoenix, :gettext] ++ Mix.compilers(),
deps: deps(),
aliases: aliases(),
source_url: "https://github.com/oestrich/ex_venture",
@@ -59,6 +59,7 @@ defmodule ExVenture.Mixfile do
{:ecto, "~> 2.1"},
{:elixir_uuid, "~> 1.2"},
{:ex_doc, "~> 0.14", only: :dev, runtime: false},
{:gettext, "~> 0.16.0"},
{:gossip, git: "https://github.com/oestrich/gossip-elixir.git"},
{:libcluster, "~> 3.0", only: [:dev, :prod]},
{:logger_file_backend, "~> 0.0.10"},
View
@@ -25,7 +25,7 @@
"ex_doc": {:hex, :ex_doc, "0.19.1", "519bb9c19526ca51d326c060cb1778d4a9056b190086a8c6c115828eaccea6cf", [:mix], [{:earmark, "~> 1.1", [hex: :earmark, repo: "hexpm", optional: false]}, {:makeup_elixir, "~> 0.7", [hex: :makeup_elixir, repo: "hexpm", optional: false]}], "hexpm"},
"gen_smtp": {:hex, :gen_smtp, "0.12.0", "97d44903f5ca18ca85cb39aee7d9c77e98d79804bbdef56078adcf905cb2ef00", [:rebar3], [], "hexpm"},
"gen_state_machine": {:hex, :gen_state_machine, "2.0.1", "85efd5a0376929c3a4246dd943e17564a2908c7ddd7acd242d84594e785d83f8", [:mix], [], "hexpm"},
"gettext": {:hex, :gettext, "0.15.0", "40a2b8ce33a80ced7727e36768499fc9286881c43ebafccae6bab731e2b2b8ce", [:mix], [], "hexpm"},
"gettext": {:hex, :gettext, "0.16.0", "4a7e90408cef5f1bf57c5a39e2db8c372a906031cc9b1466e963101cb927dafc", [:mix], [], "hexpm"},
"gossip": {:git, "https://github.com/oestrich/gossip-elixir.git", "cac3c32514703039a504432a84d4275983cb5572", []},
"hackney": {:hex, :hackney, "1.12.1", "8bf2d0e11e722e533903fe126e14d6e7e94d9b7983ced595b75f532e04b7fdc7", [:rebar3], [{:certifi, "2.3.1", [hex: :certifi, repo: "hexpm", optional: false]}, {:idna, "5.1.1", [hex: :idna, repo: "hexpm", optional: false]}, {:metrics, "1.0.1", [hex: :metrics, repo: "hexpm", optional: false]}, {:mimerl, "1.0.2", [hex: :mimerl, repo: "hexpm", optional: false]}, {:ssl_verify_fun, "1.1.1", [hex: :ssl_verify_fun, repo: "hexpm", optional: false]}], "hexpm"},
"idna": {:hex, :idna, "5.1.1", "cbc3b2fa1645113267cc59c760bafa64b2ea0334635ef06dbac8801e42f7279c", [:rebar3], [{:unicode_util_compat, "0.3.1", [hex: :unicode_util_compat, repo: "hexpm", optional: false]}], "hexpm"},
@@ -0,0 +1,87 @@
## `msgid`s in this file come from POT (.pot) files.
##
## Do not add, change, or remove `msgid`s manually here as
## they're tied to the ones in the corresponding POT file
## (with the same domain).
##
## Use `mix gettext.extract --merge` or `mix gettext.merge`
## to merge POT files into PO files.
msgid ""
msgstr ""
"Language: de\n"
"Plural-Forms: nplurals=2\n"
msgid "can't be blank"
msgstr ""
msgid "has already been taken"
msgstr ""
msgid "is invalid"
msgstr ""
msgid "must be accepted"
msgstr ""
msgid "has invalid format"
msgstr ""
msgid "has an invalid entry"
msgstr ""
msgid "is reserved"
msgstr ""
msgid "does not match confirmation"
msgstr ""
msgid "is still associated with this entry"
msgstr ""
msgid "are still associated with this entry"
msgstr ""
msgid "should be %{count} character(s)"
msgid_plural "should be %{count} character(s)"
msgstr[0] ""
msgstr[1] ""
msgid "should have %{count} item(s)"
msgid_plural "should have %{count} item(s)"
msgstr[0] ""
msgstr[1] ""
msgid "should be at least %{count} character(s)"
msgid_plural "should be at least %{count} character(s)"
msgstr[0] ""
msgstr[1] ""
msgid "should have at least %{count} item(s)"
msgid_plural "should have at least %{count} item(s)"
msgstr[0] ""
msgstr[1] ""
msgid "should be at most %{count} character(s)"
msgid_plural "should be at most %{count} character(s)"
msgstr[0] ""
msgstr[1] ""
msgid "should have at most %{count} item(s)"
msgid_plural "should have at most %{count} item(s)"
msgstr[0] ""
msgstr[1] ""
msgid "must be less than %{number}"
msgstr ""
msgid "must be greater than %{number}"
msgstr ""
msgid "must be less than or equal to %{number}"
msgstr ""
msgid "must be greater than or equal to %{number}"
msgstr ""
msgid "must be equal to %{number}"
msgstr ""
@@ -0,0 +1,53 @@
## This file is a PO Template file.
##
## `msgid`s here are often extracted from source code.
## Add new translations manually only if they're dynamic
## translations that can't be statically extracted.
##
## Run `mix gettext.extract` to bring this file up to
## date. Leave `msgstr`s empty as changing them here as no
## effect: edit them in PO (`.po`) files instead.
#, elixir-format
#: lib/game/session/login.ex:37
msgid "What is your player name? (Enter {command}create{/command} for a new account) "
msgstr "Wie lautet dein Spielername? (Geben Sie {command}create{/command} für ein neues Konto ein)"
#, elixir-format
#: lib/game/session/login.ex:90
msgid "Sending you back to the starting room!"
msgstr "Sie zurück zum Startraum schicken!"
#, elixir-format
#: lib/game/session/login.ex:220
msgid "Session recovering..."
msgstr "Sitzung wird wiederhergestellt ..."
#, elixir-format
#: lib/game/session/login.ex:172 lib/game/session/login.ex:204
msgid "Sorry, this player is already logged in."
msgstr "Entschuldigung, dieser Spieler ist bereits eingeloggt."
#, elixir-format
#: lib/game/session/login.ex:177
msgid "Sorry, your account has been disabled. Please contact the admins."
msgstr "Entschuldigung, dein Konto wurde deaktiviert. Bitte kontaktiere die Admins."
#, elixir-format
#: lib/game/session/login.ex:89
msgid "The room you were in has been deleted."
msgstr "Der Raum, in dem Sie waren, wurde gelöscht."
#, elixir-format
#: lib/game/session/login.ex:76
msgid "You have mail."
msgstr "Du hast Post."
#, elixir-format
#: lib/game/session/login.ex:79
msgid "[Press enter to continue]"
msgstr "[Enter drücken, um fortzufahren]"
#, elixir-format
#: lib/game/session/login.ex:160
msgid "Please sign in via the website to authorize this connection."
msgstr "Bitte melden Sie sich über die Website an, um diese Verbindung zu autorisieren."
@@ -0,0 +1,57 @@
## `msgid`s in this file come from POT (.pot) files.
##
## Do not add, change, or remove `msgid`s manually here as
## they're tied to the ones in the corresponding POT file
## (with the same domain).
##
## Use `mix gettext.extract --merge` or `mix gettext.merge`
## to merge POT files into PO files.
msgid ""
msgstr ""
"Language: en\n"
"Plural-Forms: nplurals=2\n"
#, elixir-format
#: lib/game/session/login.ex:37
msgid "What is your player name? (Enter {command}create{/command} for a new account) "
msgstr ""
#, elixir-format
#: lib/game/session/login.ex:90
msgid "Sending you back to the starting room!"
msgstr ""
#, elixir-format
#: lib/game/session/login.ex:220
msgid "Session recovering..."
msgstr ""
#, elixir-format
#: lib/game/session/login.ex:172 lib/game/session/login.ex:204
msgid "Sorry, this player is already logged in."
msgstr ""
#, elixir-format
#: lib/game/session/login.ex:177
msgid "Sorry, your account has been disabled. Please contact the admins."
msgstr ""
#, elixir-format
#: lib/game/session/login.ex:89
msgid "The room you were in has been deleted."
msgstr ""
#, elixir-format
#: lib/game/session/login.ex:76
msgid "You have mail."
msgstr ""
#, elixir-format
#: lib/game/session/login.ex:79
msgid "[Press enter to continue]"
msgstr ""
#, elixir-format
#: lib/game/session/login.ex:160
msgid "Please sign in via the website to authorize this connection."
msgstr ""
View
@@ -0,0 +1,56 @@
## This file is a PO Template file.
##
## `msgid`s here are often extracted from source code.
## Add new translations manually only if they're dynamic
## translations that can't be statically extracted.
##
## Run `mix gettext.extract` to bring this file up to
## date. Leave `msgstr`s empty as changing them here as no
## effect: edit them in PO (`.po`) files instead.
msgid ""
msgstr ""
#, elixir-format
#: lib/game/session/login.ex:37
msgid "What is your player name? (Enter {command}create{/command} for a new account) "
msgstr ""
#, elixir-format
#: lib/game/session/login.ex:90
msgid "Sending you back to the starting room!"
msgstr ""
#, elixir-format
#: lib/game/session/login.ex:220
msgid "Session recovering..."
msgstr ""
#, elixir-format
#: lib/game/session/login.ex:172 lib/game/session/login.ex:204
msgid "Sorry, this player is already logged in."
msgstr ""
#, elixir-format
#: lib/game/session/login.ex:177
msgid "Sorry, your account has been disabled. Please contact the admins."
msgstr ""
#, elixir-format
#: lib/game/session/login.ex:89
msgid "The room you were in has been deleted."
msgstr ""
#, elixir-format
#: lib/game/session/login.ex:76
msgid "You have mail."
msgstr ""
#, elixir-format
#: lib/game/session/login.ex:79
msgid "[Press enter to continue]"
msgstr ""
#, elixir-format
#: lib/game/session/login.ex:160
msgid "Please sign in via the website to authorize this connection."
msgstr ""

0 comments on commit 2253db5

Please sign in to comment.