chore(users): translate forms, fix colors

This commit is contained in:
Ivan R. 2024-07-22 21:12:29 +05:00
parent eadc784bc3
commit 66bb26380a
Signed by: lumin
GPG key ID: E0937DC7CD6D3817
15 changed files with 82 additions and 77 deletions

View file

@ -128,7 +128,6 @@
.simple-form { .simple-form {
margin-top: 2rem; margin-top: 2rem;
background-color: #ffffff;
} }
.simple-form-action { .simple-form-action {
@ -148,7 +147,6 @@
font-size: 0.875rem; font-size: 0.875rem;
font-weight: 600; font-weight: 600;
line-height: 1.5rem; line-height: 1.5rem;
color: #ffffff;
} }
.input { .input {

View file

@ -7,22 +7,22 @@ defmodule ComfycampWeb.UserConfirmationInstructionsLive do
~H""" ~H"""
<div class="mx-auto max-w-sm"> <div class="mx-auto max-w-sm">
<.header class="text-center"> <.header class="text-center">
No confirmation instructions received? Не получили инструкцию для подтверждения?
<:subtitle>We'll send a new confirmation link to your inbox</:subtitle> <:subtitle>Мы отправим новую ссылку на вашу почту.</:subtitle>
</.header> </.header>
<.simple_form for={@form} id="resend_confirmation_form" phx-submit="send_instructions"> <.simple_form for={@form} id="resend_confirmation_form" phx-submit="send_instructions">
<.input field={@form[:email]} type="email" placeholder="Email" required /> <.input field={@form[:email]} type="email" placeholder="Email" required />
<:actions> <:actions>
<.button phx-disable-with="Sending..." class="w-full"> <.button phx-disable-with="Отправляю..." class="w-full">
Resend confirmation instructions Отправить инструкции повторно
</.button> </.button>
</:actions> </:actions>
</.simple_form> </.simple_form>
<p class="text-center mt-4"> <p class="text-center mt-4">
<.link href={~p"/users/register"}>Register</.link> <.link href={~p"/users/register"}>Зарегистрироваться</.link>
| <.link href={~p"/users/log_in"}>Log in</.link> | <.link href={~p"/users/log_in"}>Войти</.link>
</p> </p>
</div> </div>
""" """

View file

@ -6,18 +6,18 @@ defmodule ComfycampWeb.UserConfirmationLive do
def render(%{live_action: :edit} = assigns) do def render(%{live_action: :edit} = assigns) do
~H""" ~H"""
<div class="mx-auto max-w-sm"> <div class="mx-auto max-w-sm">
<.header class="text-center">Confirm Account</.header> <.header class="text-center">Подтвердить аккаунт</.header>
<.simple_form for={@form} id="confirmation_form" phx-submit="confirm_account"> <.simple_form for={@form} id="confirmation_form" phx-submit="confirm_account">
<input type="hidden" name={@form[:token].name} value={@form[:token].value} /> <input type="hidden" name={@form[:token].name} value={@form[:token].value} />
<:actions> <:actions>
<.button phx-disable-with="Confirming..." class="w-full">Confirm my account</.button> <.button phx-disable-with="Confirming..." class="w-full">Подтвердить мой аккаунт</.button>
</:actions> </:actions>
</.simple_form> </.simple_form>
<p class="text-center mt-4"> <p class="text-center mt-4">
<.link href={~p"/users/register"}>Register</.link> <.link href={~p"/users/register"}>Зарегистрироваться</.link>
| <.link href={~p"/users/log_in"}>Log in</.link> | <.link href={~p"/users/log_in"}>Войти</.link>
</p> </p>
</div> </div>
""" """

View file

@ -7,21 +7,21 @@ defmodule ComfycampWeb.UserForgotPasswordLive do
~H""" ~H"""
<div class="mx-auto max-w-sm"> <div class="mx-auto max-w-sm">
<.header class="text-center"> <.header class="text-center">
Forgot your password? Забыли пароль?
<:subtitle>We'll send a password reset link to your inbox</:subtitle> <:subtitle>Мы отправим ссылку для сброса пароля.</:subtitle>
</.header> </.header>
<.simple_form for={@form} id="reset_password_form" phx-submit="send_email"> <.simple_form for={@form} id="reset_password_form" phx-submit="send_email">
<.input field={@form[:email]} type="email" placeholder="Email" required /> <.input field={@form[:email]} type="email" placeholder="Email" required />
<:actions> <:actions>
<.button phx-disable-with="Sending..." class="w-full"> <.button phx-disable-with="Отправляю..." class="w-full">
Send password reset instructions Отправить инструкции
</.button> </.button>
</:actions> </:actions>
</.simple_form> </.simple_form>
<p class="text-center text-sm mt-4"> <p class="text-center text-sm mt-4">
<.link href={~p"/users/register"}>Register</.link> <.link href={~p"/users/register"}>Зарегистрироваться</.link>
| <.link href={~p"/users/log_in"}>Log in</.link> | <.link href={~p"/users/log_in"}>Войти</.link>
</p> </p>
</div> </div>
""" """

View file

@ -5,29 +5,29 @@ defmodule ComfycampWeb.UserLoginLive do
~H""" ~H"""
<div class="mx-auto max-w-sm"> <div class="mx-auto max-w-sm">
<.header class="text-center"> <.header class="text-center">
Log in to account Войти в аккаунт
<:subtitle> <:subtitle>
Don't have an account? Нет аккаунта?
<.link navigate={~p"/users/register"} class="font-semibold text-brand hover:underline"> <.link navigate={~p"/users/register"} class="font-semibold text-brand hover:underline">
Sign up Создайте
</.link> </.link>
for an account now. новый.
</:subtitle> </:subtitle>
</.header> </.header>
<.simple_form for={@form} id="login_form" action={~p"/users/log_in"} phx-update="ignore"> <.simple_form for={@form} id="login_form" action={~p"/users/log_in"} phx-update="ignore">
<.input field={@form[:email]} type="email" label="Email" required /> <.input field={@form[:email]} type="email" label="Email" required />
<.input field={@form[:password]} type="password" label="Password" required /> <.input field={@form[:password]} type="password" label="Пароль" required />
<:actions> <:actions>
<.input field={@form[:remember_me]} type="checkbox" label="Keep me logged in" /> <.input field={@form[:remember_me]} type="checkbox" label="Запомнить" />
<.link href={~p"/users/reset_password"} class="text-sm font-semibold"> <.link href={~p"/users/reset_password"} class="text-sm font-semibold">
Forgot your password? Забыли пароль?
</.link> </.link>
</:actions> </:actions>
<:actions> <:actions>
<.button phx-disable-with="Logging in..." class="w-full"> <.button phx-disable-with="Вхожу..." class="w-full">
Log in <span aria-hidden="true"></span> Войти <span aria-hidden="true"></span>
</.button> </.button>
</:actions> </:actions>
</.simple_form> </.simple_form>

View file

@ -6,15 +6,15 @@ defmodule ComfycampWeb.UserRegistrationLive do
def render(assigns) do def render(assigns) do
~H""" ~H"""
<div class="mx-auto max-w-sm"> <div class="">
<.header class="text-center"> <.header class="text-center">
Register for an account Создайте аккаунт
<:subtitle> <:subtitle>
Already registered? Уже зарегистрированы?
<.link navigate={~p"/users/log_in"} class="font-semibold text-brand hover:underline"> <.link navigate={~p"/users/log_in"} class="font-semibold text-brand hover:underline">
Log in Войти
</.link> </.link>
to your account now. в аккаунт.
</:subtitle> </:subtitle>
</.header> </.header>
@ -28,14 +28,16 @@ defmodule ComfycampWeb.UserRegistrationLive do
method="post" method="post"
> >
<.error :if={@check_errors}> <.error :if={@check_errors}>
Oops, something went wrong! Please check the errors below. Что-то пошло не так. Проверьте ошибки ниже.
</.error> </.error>
<.input field={@form[:email]} type="email" label="Email" required /> <.input field={@form[:email]} type="email" label="Email" required />
<.input field={@form[:password]} type="password" label="Password" required /> <.input field={@form[:password]} type="password" label="Пароль" required />
<:actions> <:actions>
<.button phx-disable-with="Creating account..." class="w-full">Create an account</.button> <.button phx-disable-with="Создаю аккаунт..." class="w-full">
Создать аккаунт
</.button>
</:actions> </:actions>
</.simple_form> </.simple_form>
</div> </div>

View file

@ -6,7 +6,7 @@ defmodule ComfycampWeb.UserResetPasswordLive do
def render(assigns) do def render(assigns) do
~H""" ~H"""
<div class="mx-auto max-w-sm"> <div class="mx-auto max-w-sm">
<.header class="text-center">Reset Password</.header> <.header class="text-center">Сброс пароля</.header>
<.simple_form <.simple_form
for={@form} for={@form}
@ -15,24 +15,24 @@ defmodule ComfycampWeb.UserResetPasswordLive do
phx-change="validate" phx-change="validate"
> >
<.error :if={@form.errors != []}> <.error :if={@form.errors != []}>
Oops, something went wrong! Please check the errors below. Упс, что-то пошло не так. Проверьте ошибки ниже.
</.error> </.error>
<.input field={@form[:password]} type="password" label="New password" required /> <.input field={@form[:password]} type="password" label="Новый пароль" required />
<.input <.input
field={@form[:password_confirmation]} field={@form[:password_confirmation]}
type="password" type="password"
label="Confirm new password" label="Подтвердите новый пароль"
required required
/> />
<:actions> <:actions>
<.button phx-disable-with="Resetting..." class="w-full">Reset Password</.button> <.button phx-disable-with="Сбрасываю..." class="w-full">Сбросить пароль</.button>
</:actions> </:actions>
</.simple_form> </.simple_form>
<p class="text-center text-sm mt-4"> <p class="text-center text-sm mt-4">
<.link href={~p"/users/register"}>Register</.link> <.link href={~p"/users/register"}>Зарегистрироваться</.link>
| <.link href={~p"/users/log_in"}>Log in</.link> | <.link href={~p"/users/log_in"}>Войти</.link>
</p> </p>
</div> </div>
""" """

View file

@ -6,8 +6,8 @@ defmodule ComfycampWeb.UserSettingsLive do
def render(assigns) do def render(assigns) do
~H""" ~H"""
<.header class="text-center"> <.header class="text-center">
Account Settings Настройки аккаунта
<:subtitle>Manage your account email address and password settings</:subtitle> <:subtitle>Настройки email адреса и пароля</:subtitle>
</.header> </.header>
<div class="space-y-12 divide-y"> <div class="space-y-12 divide-y">
@ -24,12 +24,12 @@ defmodule ComfycampWeb.UserSettingsLive do
name="current_password" name="current_password"
id="current_password_for_email" id="current_password_for_email"
type="password" type="password"
label="Current password" label="Текущий пароль"
value={@email_form_current_password} value={@email_form_current_password}
required required
/> />
<:actions> <:actions>
<.button phx-disable-with="Changing...">Change Email</.button> <.button phx-disable-with="Изменяю...">Изменить email</.button>
</:actions> </:actions>
</.simple_form> </.simple_form>
</div> </div>
@ -49,23 +49,28 @@ defmodule ComfycampWeb.UserSettingsLive do
id="hidden_user_email" id="hidden_user_email"
value={@current_email} value={@current_email}
/> />
<.input field={@password_form[:password]} type="password" label="New password" required /> <.input
field={@password_form[:password]}
type="password"
label="Новый пароль"
required
/>
<.input <.input
field={@password_form[:password_confirmation]} field={@password_form[:password_confirmation]}
type="password" type="password"
label="Confirm new password" label="Подтвердите новый пароль"
/> />
<.input <.input
field={@password_form[:current_password]} field={@password_form[:current_password]}
name="current_password" name="current_password"
type="password" type="password"
label="Current password" label="Текущий пароль"
id="current_password_for_password" id="current_password_for_password"
value={@current_password} value={@current_password}
required required
/> />
<:actions> <:actions>
<.button phx-disable-with="Changing...">Change Password</.button> <.button phx-disable-with="Изменяю...">Изменить пароль</.button>
</:actions> </:actions>
</.simple_form> </.simple_form>
</div> </div>

View file

@ -14,7 +14,7 @@ defmodule ComfycampWeb.UserConfirmationInstructionsLiveTest do
describe "Resend confirmation" do describe "Resend confirmation" do
test "renders the resend confirmation page", %{conn: conn} do test "renders the resend confirmation page", %{conn: conn} do
{:ok, _lv, html} = live(conn, ~p"/users/confirm") {:ok, _lv, html} = live(conn, ~p"/users/confirm")
assert html =~ "Resend confirmation instructions" assert html =~ "Отправить инструкции повторно"
end end
test "sends a new confirmation token", %{conn: conn, user: user} do test "sends a new confirmation token", %{conn: conn, user: user} do

View file

@ -14,7 +14,7 @@ defmodule ComfycampWeb.UserConfirmationLiveTest do
describe "Confirm user" do describe "Confirm user" do
test "renders confirmation page", %{conn: conn} do test "renders confirmation page", %{conn: conn} do
{:ok, _lv, html} = live(conn, ~p"/users/confirm/some-token") {:ok, _lv, html} = live(conn, ~p"/users/confirm/some-token")
assert html =~ "Confirm Account" assert html =~ "Подтвердить аккаунт"
end end
test "confirms the given token once", %{conn: conn, user: user} do test "confirms the given token once", %{conn: conn, user: user} do

View file

@ -11,9 +11,9 @@ defmodule ComfycampWeb.UserForgotPasswordLiveTest do
test "renders email page", %{conn: conn} do test "renders email page", %{conn: conn} do
{:ok, lv, html} = live(conn, ~p"/users/reset_password") {:ok, lv, html} = live(conn, ~p"/users/reset_password")
assert html =~ "Forgot your password?" assert html =~ "Забыли пароль?"
assert has_element?(lv, ~s|a[href="#{~p"/users/register"}"]|, "Register") assert has_element?(lv, ~s|a[href="#{~p"/users/register"}"]|, "Зарегистрироваться")
assert has_element?(lv, ~s|a[href="#{~p"/users/log_in"}"]|, "Log in") assert has_element?(lv, ~s|a[href="#{~p"/users/log_in"}"]|, "Войти")
end end
test "redirects if already logged in", %{conn: conn} do test "redirects if already logged in", %{conn: conn} do

View file

@ -10,7 +10,7 @@ defmodule ComfycampWeb.UserLoginLiveTest do
assert html =~ "Войти" assert html =~ "Войти"
assert html =~ "Зарегистрироваться" assert html =~ "Зарегистрироваться"
assert html =~ "Forgot your password?" assert html =~ "Забыли пароль?"
end end
test "redirects if already logged in", %{conn: conn} do test "redirects if already logged in", %{conn: conn} do
@ -63,11 +63,11 @@ defmodule ComfycampWeb.UserLoginLiveTest do
{:ok, _login_live, login_html} = {:ok, _login_live, login_html} =
lv lv
|> element(~s|main a:fl-contains("Sign up")|) |> element(~s|main a:fl-contains("Создайте")|)
|> render_click() |> render_click()
|> follow_redirect(conn, ~p"/users/register") |> follow_redirect(conn, ~p"/users/register")
assert login_html =~ "Register" assert login_html =~ "Зарегистрироваться"
end end
test "redirects to forgot password page when the Forgot Password button is clicked", %{ test "redirects to forgot password page when the Forgot Password button is clicked", %{
@ -77,11 +77,11 @@ defmodule ComfycampWeb.UserLoginLiveTest do
{:ok, conn} = {:ok, conn} =
lv lv
|> element(~s|main a:fl-contains("Forgot your password?")|) |> element(~s|main a:fl-contains("Забыли пароль?")|)
|> render_click() |> render_click()
|> follow_redirect(conn, ~p"/users/reset_password") |> follow_redirect(conn, ~p"/users/reset_password")
assert conn.resp_body =~ "Forgot your password?" assert conn.resp_body =~ "Забыли пароль?"
end end
end end
end end

View file

@ -8,8 +8,8 @@ defmodule ComfycampWeb.UserRegistrationLiveTest do
test "renders registration page", %{conn: conn} do test "renders registration page", %{conn: conn} do
{:ok, _lv, html} = live(conn, ~p"/users/register") {:ok, _lv, html} = live(conn, ~p"/users/register")
assert html =~ "Register" assert html =~ "Зарегистрироваться"
assert html =~ "Log in" assert html =~ "Войти"
end end
test "redirects if already logged in", %{conn: conn} do test "redirects if already logged in", %{conn: conn} do
@ -30,7 +30,7 @@ defmodule ComfycampWeb.UserRegistrationLiveTest do
|> element("#registration_form") |> element("#registration_form")
|> render_change(user: %{"email" => "with spaces", "password" => "too short"}) |> render_change(user: %{"email" => "with spaces", "password" => "too short"})
assert result =~ "Register" assert result =~ "Зарегистрироваться"
assert result =~ "must have the @ sign and no spaces" assert result =~ "must have the @ sign and no spaces"
assert result =~ "should be at least 12 character" assert result =~ "should be at least 12 character"
end end
@ -76,11 +76,11 @@ defmodule ComfycampWeb.UserRegistrationLiveTest do
{:ok, _login_live, login_html} = {:ok, _login_live, login_html} =
lv lv
|> element(~s|main a:fl-contains("Log in")|) |> element(~s|main a:fl-contains("Войти")|)
|> render_click() |> render_click()
|> follow_redirect(conn, ~p"/users/log_in") |> follow_redirect(conn, ~p"/users/log_in")
assert login_html =~ "Log in" assert login_html =~ "Войти"
end end
end end
end end

View file

@ -21,7 +21,7 @@ defmodule ComfycampWeb.UserResetPasswordLiveTest do
test "renders reset password with valid token", %{conn: conn, token: token} do test "renders reset password with valid token", %{conn: conn, token: token} do
{:ok, _lv, html} = live(conn, ~p"/users/reset_password/#{token}") {:ok, _lv, html} = live(conn, ~p"/users/reset_password/#{token}")
assert html =~ "Reset Password" assert html =~ "Сбросить пароль"
end end
test "does not render reset password with invalid token", %{conn: conn} do test "does not render reset password with invalid token", %{conn: conn} do
@ -81,7 +81,7 @@ defmodule ComfycampWeb.UserResetPasswordLiveTest do
) )
|> render_submit() |> render_submit()
assert result =~ "Reset Password" assert result =~ "Сбросить пароль"
assert result =~ "should be at least 12 character(s)" assert result =~ "should be at least 12 character(s)"
assert result =~ "does not match password" assert result =~ "does not match password"
end end
@ -93,11 +93,11 @@ defmodule ComfycampWeb.UserResetPasswordLiveTest do
{:ok, conn} = {:ok, conn} =
lv lv
|> element(~s|main a:fl-contains("Log in")|) |> element(~s|main a:fl-contains("Войти")|)
|> render_click() |> render_click()
|> follow_redirect(conn, ~p"/users/log_in") |> follow_redirect(conn, ~p"/users/log_in")
assert conn.resp_body =~ "Log in" assert conn.resp_body =~ "Войти"
end end
test "redirects to registration page when the Register button is clicked", %{ test "redirects to registration page when the Register button is clicked", %{
@ -108,11 +108,11 @@ defmodule ComfycampWeb.UserResetPasswordLiveTest do
{:ok, conn} = {:ok, conn} =
lv lv
|> element(~s|main a:fl-contains("Register")|) |> element(~s|main a:fl-contains("Зарегистрироваться")|)
|> render_click() |> render_click()
|> follow_redirect(conn, ~p"/users/register") |> follow_redirect(conn, ~p"/users/register")
assert conn.resp_body =~ "Register" assert conn.resp_body =~ "Зарегистрироваться"
end end
end end
end end

View file

@ -12,8 +12,8 @@ defmodule ComfycampWeb.UserSettingsLiveTest do
|> log_in_user(user_fixture()) |> log_in_user(user_fixture())
|> live(~p"/users/settings") |> live(~p"/users/settings")
assert html =~ "Change Email" assert html =~ "Изменить email"
assert html =~ "Change Password" assert html =~ "Изменить пароль"
end end
test "redirects if user is not logged in", %{conn: conn} do test "redirects if user is not logged in", %{conn: conn} do
@ -61,7 +61,7 @@ defmodule ComfycampWeb.UserSettingsLiveTest do
"user" => %{"email" => "with spaces"} "user" => %{"email" => "with spaces"}
}) })
assert result =~ "Change Email" assert result =~ "Изменить email"
assert result =~ "must have the @ sign and no spaces" assert result =~ "must have the @ sign and no spaces"
end end
@ -76,7 +76,7 @@ defmodule ComfycampWeb.UserSettingsLiveTest do
}) })
|> render_submit() |> render_submit()
assert result =~ "Change Email" assert result =~ "Изменить email"
assert result =~ "did not change" assert result =~ "did not change"
assert result =~ "is not valid" assert result =~ "is not valid"
end end
@ -132,7 +132,7 @@ defmodule ComfycampWeb.UserSettingsLiveTest do
} }
}) })
assert result =~ "Change Password" assert result =~ "Изменить пароль"
assert result =~ "should be at least 12 character(s)" assert result =~ "should be at least 12 character(s)"
assert result =~ "does not match password" assert result =~ "does not match password"
end end
@ -151,7 +151,7 @@ defmodule ComfycampWeb.UserSettingsLiveTest do
}) })
|> render_submit() |> render_submit()
assert result =~ "Change Password" assert result =~ "Изменить пароль"
assert result =~ "should be at least 12 character(s)" assert result =~ "should be at least 12 character(s)"
assert result =~ "does not match password" assert result =~ "does not match password"
assert result =~ "is not valid" assert result =~ "is not valid"