Skip to content

Commit

Permalink
feat: translation strings for all text
Browse files Browse the repository at this point in the history
  • Loading branch information
kjellberg committed Mar 29, 2024
1 parent 90f2b3b commit 43aaa92
Show file tree
Hide file tree
Showing 7 changed files with 64 additions and 24 deletions.
2 changes: 1 addition & 1 deletion app/components/fullscreen/form/component.html.erb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<section class="flex flex-col gap-8 px-8 items-center justify-center w-full">
<header class="flex flex-col items-center gap-y-2 text-center max-w-lg">
<header class="flex flex-col items-center gap-y-2 text-center max-w-xl">
<h1 class="font-bold font-headings text-2xl"><%= title %></h1>
<p class="text-light"><%= description %></p>
</header>
Expand Down
4 changes: 2 additions & 2 deletions app/views/accounts/_form.html.erb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<%= simple_form_for(account, url: account_path, method: :patch) do |f| %>
<%= f.input :name, placeholder: account.personal? ? "Your full name" : "Team / organization name", required: true, autofocus: true %>
<%= f.input :name, placeholder: (account.personal? ? t(".name.personal") : t(".name.team")), required: true, autofocus: true %>
<div class="mt-4 flex justify-between items-center">
<%= f.button :submit, "Save changes" %>
<%= f.button :submit, t(".submit_button") %>
</div>
<% end %>
2 changes: 1 addition & 1 deletion app/views/accounts/edit.html.erb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<% title "Edit your account profile" %>
<% title t(".title") %>
<%= render(PageLayouts::Settings::Component.new) do %>
<%= render "form", account: @account %>
<% end %>
14 changes: 7 additions & 7 deletions app/views/devise/registrations/new.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,21 @@

<%= fullscreen do |screen| %>
<%= screen.with_form(
title: "Create your #{Kiqr::Config.app_name} account",
description: "Enter your email address and a secure password."
title: t(".heading.title", app_name: Kiqr::Config.app_name),
description: t(".heading.description")
) do %>
<main class="flex flex-col gap-4 w-full max-w-2xl">
<%= simple_form_for(resource, as: resource_name, url: registration_path(resource_name)) do |f| %>
<%= f.input :email, placeholder: "Enter a valid email address", required: true, autofocus: true, input_html: { autocomplete: "email" } %>
<%= f.input :email, placeholder: t(".form.email.placeholder"), required: true, autofocus: true, input_html: { autocomplete: "email" } %>

<div class="flex flex-col lg:flex-row justify-between items-start gap-4">
<%= f.input :password, placeholder: "Create a secure password", required: true, hint: ("#{@minimum_password_length} characters minimum" if @minimum_password_length), input_html: { autocomplete: "new-password" } %>
<%= f.input :password_confirmation, placeholder: "Confirm your password", required: true, input_html: { autocomplete: "new-password" } %>
<%= f.input :password, placeholder: t(".form.password.placeholder"), required: true, hint: ("#{@minimum_password_length} characters minimum" if @minimum_password_length), input_html: { autocomplete: "new-password" } %>
<%= f.input :password_confirmation, placeholder: t(".form.password_confirmation.placeholder"), required: true, input_html: { autocomplete: "new-password" } %>
</div>

<div class="mt-4 flex justify-between items-center">
<%= f.button :submit, "Create your account" %>
<p>Already have an account? <%= link_to "Sign in!", new_user_session_path, class: "font-bold transition text-primary" %>
<%= f.button :submit, t(".form.submit_button") %>
<p><%= t(".already_have_account") %> <%= link_to t(".sign_in"), new_user_session_path, class: "font-bold transition text-primary" %>
</div>
<% end %>
</main>
Expand Down
16 changes: 9 additions & 7 deletions app/views/devise/sessions/new.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,20 @@

<%= fullscreen do |screen| %>
<%= screen.with_form(
title: "Sign in to your #{Kiqr::Config.app_name} account",
description: "Enter with your email address and password or select any of the other available options below."
title: t(".heading.title", app_name: Kiqr::Config.app_name),
description: t(".heading.description")
) do %>
<main class="flex flex-col gap-4 w-full max-w-xl">
<%= simple_form_for(resource, as: resource_name, url: session_path(resource_name)) do |f| %>
<%= f.input :email, placeholder: "Enter your email", required: true, autofocus: true, input_html: { autocomplete: "email" } %>
<%= f.input :password, placeholder: "Enter your password", required: true, input_html: { autocomplete: "current-password" } %>
<%= f.input :remember_me, as: :boolean, wrapper: :inline_checkbox if devise_mapping.rememberable? %>
<%= f.input :email, placeholder: t(".form.email.placeholder"), required: true, autofocus: true, input_html: { autocomplete: "email" } %>
<%= f.input :password, placeholder: t(".form.password.placeholder"), required: true, input_html: { autocomplete: "current-password" } %>
<%= f.input :remember_me, label: t(".form.remember_me.label"), as: :boolean, wrapper: :inline_checkbox if devise_mapping.rememberable? %>

<div class="flex justify-between items-center">
<%= f.button :submit, "Sign in" %>
<p class="dark:text-neutral-200">Don't have an account? <%= link_to "Sign up!", new_user_registration_path, class: "font-bold text-primary transition" %></p>
<%= f.button :submit, t(".form.submit_button") %>
<p class="dark:text-neutral-200">
<%= t(".no_account") %>
<%= link_to t(".sign_up"), new_user_registration_path, class: "font-bold text-primary transition" %></p>
</div>
<% end %>
</main>
Expand Down
9 changes: 3 additions & 6 deletions app/views/partials/navigations/_protected.html.erb
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
<%= link_to "Dashboard", dashboard_path, class: "font-bold text-primary" %>
<%= link_to "Domains", dashboard_path %>
<%= link_to "Reports", dashboard_path %>
<%= link_to t(".dashboard"), dashboard_path, class: "font-bold text-primary" %>

<% navbar.with_right_section do %>
<%= navbar.account_selector if onboarded? %>

<%= render(Navbar::Dropdown::Component.new(icon: "fa fa-gear", chevron: false)) do |dropdown| %>
<%= dropdown.item(label: "Edit profile", icon: "fa fa-user", path: edit_account_path) %>
<%= dropdown.item(label: "Change password", icon: "fa fa-key", path: edit_user_registration_path) %>
<%= link_to edit_account_path do %>
<i class="fa fa-gear"></i>
<% end %>

<%= navbar.dark_mode_switch %>
Expand Down
41 changes: 41 additions & 0 deletions config/locales/kiqr.en.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,47 @@
en:
devise:
sessions:
new:
heading:
title: "Sign in to your %{app_name} account"
description: "Enter with your email address and password or select any of the other available options below."
form:
email:
placeholder: "Enter your email"
password:
placeholder: "Enter your password"
remember_me:
label: "Remember me"
submit_button: "Sign in"
no_account: "Don't have an account?"
sign_up: "Sign up!"
registrations:
new:
heading:
title: "Create a new %{app_name} account"
description: "Enter your email address and password to create a new account."
form:
email:
placeholder: "Enter a valid email address"
password:
placeholder: "Create a secure password"
password_confirmation:
placeholder: "Confirm your password"
submit_button: "Create your account"
already_have_account: Already have an account?
sign_in: Sign in!
accounts:
edit:
title: "Edit your account profile"
form:
name:
personal: "Your full name"
team: "Team / organization name"
submit_button: "Save changes"
partials:
navigations:
protected:
dashboard: "Dashboard"
settings:
account_settings: "Account settings"
user_settings: "Login & security"
Expand Down

0 comments on commit 43aaa92

Please sign in to comment.