Add internationalization (#114)

🇬🇧 and 🇮🇹
This commit is contained in:
Riccardo Graziosi
2022-06-05 11:40:43 +02:00
committed by GitHub
parent ba86e81aa0
commit 78049a820c
71 changed files with 802 additions and 266 deletions

View File

@@ -1,15 +1,21 @@
<%= form_for(resource, as: resource_name, url: confirmation_path(resource_name), html: { method: :post }) do |f| %>
<h2>Resend confirmation instructions</h2>
<h2><%= t('common.forms.auth.resend_confirmation_instructions') %></h2>
<%= render "devise/shared/error_messages", resource: resource %>
<div class="form-group">
<%= f.label :email, class: "sr-only" %>
<%= f.email_field :email, autofocus: true, autocomplete: "email", placeholder: "Email address", required: true, value: (resource.pending_reconfirmation? ? resource.unconfirmed_email : resource.email), class: "form-control" %>
<%= f.email_field :email,
autofocus: true,
autocomplete: "email",
placeholder: t('common.forms.auth.email'),
required: true,
value: (resource.pending_reconfirmation? ? resource.unconfirmed_email : resource.email),
class: "form-control" %>
</div>
<div class="actions">
<%= f.submit "Resend confirmation instructions", class: "btn btn-dark btn-block" %>
<%= f.submit t('common.forms.auth.resend_confirmation_instructions'), class: "btn btn-dark btn-block" %>
</div>
<% end %>

View File

@@ -1,26 +1,35 @@
<h2>Change your password</h2>
<%= form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :put }) do |f| %>
<h2><%= t('common.forms.auth.change_password') %></h2>
<%= render "devise/shared/error_messages", resource: resource %>
<%= f.hidden_field :reset_password_token %>
<div class="form-group">
<%= f.label :password, "New password" %>
<%= f.password_field :password, autofocus: true, autocomplete: "new-password", class: "form-control" %>
<%= f.label :password, class: "sr-only" %>
<%= f.password_field :password,
autofocus: true,
autocomplete: "new-password",
placeholder: t('common.forms.auth.new_password'),
class: "form-control" %>
<% if @minimum_password_length %>
<small id="passwordHelp" class="form-text text-muted">
(<%= @minimum_password_length %> characters minimum)
(<%= t('common.forms.auth.password_help', { count: @minimum_password_length }) %>)
</small>
<% end %>
</div>
<div class="form-group">
<%= f.label :password_confirmation, "Confirm new password" %>
<%= f.password_field :password_confirmation, autocomplete: "new-password", class: "form-control" %>
<%= f.label :password_confirmation, class: "sr-only" %>
<%= f.password_field :password_confirmation,
autocomplete: "new-password",
placeholder: t('common.forms.auth.new_password_confirmation'),
class: "form-control" %>
</div>
<div class="actions">
<%= f.submit "Change my password", class: "btn btn-dark btn-primary" %>
<%= f.submit t('common.forms.auth.change_password'), class: "btn btn-dark btn-primary" %>
</div>
<% end %>

View File

@@ -1,15 +1,20 @@
<%= form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :post }) do |f| %>
<h2>Forgot your password?</h2>
<h2><%= t('common.forms.auth.forgot_password') %></h2>
<%= render "devise/shared/error_messages", resource: resource %>
<div class="form-group">
<%= f.label :email, class: "sr-only" %>
<%= f.email_field :email, autofocus: true, autocomplete: "email", placeholder: "Email address", required: true, class: "form-control" %>
<%= f.email_field :email,
autofocus: true,
autocomplete: "email",
placeholder: t('common.forms.auth.email'),
required: true,
class: "form-control" %>
</div>
<div class="actions">
<%= f.submit "Send me reset password instructions", class: "btn btn-dark btn-block" %>
<%= f.submit t('common.forms.auth.send_reset_password_instructions'), class: "btn btn-dark btn-block" %>
</div>
<% end %>

View File

@@ -1,26 +1,23 @@
<%= form_for(resource, as: resource_name, url: registration_path(resource_name), html: { method: :put }) do |f| %>
<h2>Profile settings</h2>
<h2><%= t('common.forms.auth.profile_settings') %></h2>
<%= render "devise/shared/error_messages", resource: resource %>
<div class="form-group">
<%= f.label :full_name %>
<%= f.label t('common.forms.auth.full_name') %>
<%= f.text_field :full_name, autocomplete: "full-name", class: "form-control" %>
</div>
<div class="form-group">
<%= f.label :email %>
<%= f.label t('common.forms.auth.email') %>
<%= f.email_field :email, autocomplete: "email", class: "form-control" %>
<small id="emailGravatarHelp" class="form-text text-muted">
the email is <a href="https://gravatar.com" target="_blank">gravatar</a>ized
</small>
</div>
<div class="form-group">
<%= f.label :notifications_enabled %>&nbsp;
<%= f.label t('common.forms.auth.notifications_enabled') %>&nbsp;
<%= f.check_box :notifications_enabled, style: "transform: scale(1.5)" %>
<small id="notificationsHelp" class="form-text text-muted">
if disabled, you won't receive any notification
<%= t('common.forms.auth.notifications_enabled_help') %>
</small>
</div>
@@ -29,25 +26,20 @@
<% end %>
<div class="form-group">
<%= f.label :password %>
<%= f.label t('common.forms.auth.password') %>
<%= f.password_field :password, autocomplete: "new-password", class: "form-control" %>
<% if @minimum_password_length %>
<small id="passwordEditHelp" class="form-text text-muted">
leave blank if you don't want to change it
</small>
<small id="passwordHelp" class="form-text text-muted">
<%= @minimum_password_length %> characters minimum
</small>
<% end %>
<small id="passwordEditHelp" class="form-text text-muted">
leave blank if you don't want to change your password
</small>
</div>
<div class="form-group">
<%= f.label :password_confirmation %>
<%= f.label t('common.forms.auth.password_confirmation') %>
<%= f.password_field :password_confirmation, autocomplete: "new-password", class: "form-control" %>
</div>
<div class="form-group">
<%= f.label :current_password %>
<%= f.label t('common.forms.auth.current_password') %>
<%= f.password_field :current_password, autocomplete: "current-password", class: "form-control" %>
<small id="currentPasswordHelp" class="form-text text-muted">
we need your current password to confirm your changes
@@ -55,15 +47,18 @@
</div>
<div class="actions">
<%= f.submit "Update profile", class: "btn btn-dark btn-block" %>
<%= f.submit t('common.forms.auth.update_profile'), class: "btn btn-dark btn-block" %>
</div>
<% end %>
<br />
<div class="edit_user">
<h3>Cancel my account</h3>
<p>Unhappy?
<%= button_to "Cancel my account", registration_path(resource_name), data: { confirm: "Are you sure?" }, method: :delete, class: "btn btn-danger btn-block" %>
</p>
<h3><%= t('common.forms.auth.cancel_account') %></h3>
<%= button_to t('common.forms.auth.cancel_account'),
registration_path(resource_name),
data: { confirm: "Are you sure?" },
method: :delete,
class: "btn btn-danger btn-block" %>
</div>

View File

@@ -1,30 +1,44 @@
<%= form_for(resource, as: resource_name, url: registration_path(resource_name)) do |f| %>
<h2>Sign up</h2>
<h2><%= t('common.forms.auth.sign_up') %></h2>
<%= render "devise/shared/error_messages", resource: resource %>
<div class="form-group">
<%= f.label :full_name, class: "sr-only" %>
<%= f.text_field :full_name, autofocus: true, placeholder: "Full name", required: true, class: "form-control" %>
<%= f.text_field :full_name,
autofocus: true,
placeholder: t('common.forms.auth.full_name'),
required: true,
class: "form-control" %>
</div>
<div class="form-group">
<%= f.label :email, class: "sr-only" %>
<%= f.email_field :email, autocomplete: "email", placeholder: "Email address", required: true, class: "form-control" %>
<%= f.email_field :email,
autocomplete: "email",
placeholder: t('common.forms.auth.email'),
required: true,
class: "form-control" %>
</div>
<div class="form-group">
<%= f.label :password, class: "sr-only" %>
<%= f.password_field :password, placeholder: "Password", required: true, class: "form-control" %>
<%= f.password_field :password,
placeholder: t('common.forms.auth.password'),
required: true,
class: "form-control" %>
</div>
<div class="form-group">
<%= f.label :password_confirmation, class: "sr-only" %>
<%= f.password_field :password_confirmation, placeholder: "Password confirmation", required: true, class: "form-control" %>
<%= f.password_field :password_confirmation,
placeholder: t('common.forms.auth.password_confirmation'),
required: true,
class: "form-control" %>
</div>
<div class="actions">
<%= f.submit "Sign up", class: "btn btn-dark btn-block" %>
<%= f.submit t('common.forms.auth.sign_up'), class: "btn btn-dark btn-block" %>
</div>
<% end %>

View File

@@ -1,25 +1,33 @@
<%= form_for(resource, as: resource_name, url: session_path(resource_name)) do |f| %>
<h2>Log in</h2>
<h2><%= t('common.forms.auth.log_in') %></h2>
<div class="form-group">
<%= f.label :email, class: "sr-only" %>
<%= f.email_field :email, autocomplete: "email", placeholder: "Email address", required: true, class: "form-control" %>
<%= f.email_field :email,
autocomplete: "email",
placeholder: t('common.forms.auth.email'),
required: true,
class: "form-control" %>
</div>
<div class="form-group">
<%= f.label :password, class: "sr-only" %>
<%= f.password_field :password, autocomplete: "current-password", placeholder: "Password", required: true, class: "form-control" %>
<%= f.password_field :password,
autocomplete: "current-password",
placeholder: t('common.forms.auth.password'),
required: true,
class: "form-control" %>
</div>
<% if devise_mapping.rememberable? %>
<div class="form-group form-check">
<%= f.check_box :remember_me, class: "form-check-input" %>
<%= f.label :remember_me, class: "form-check-label" %>
<%= f.label t('common.forms.auth.remember_me'), class: "form-check-label" %>
</div>
<% end %>
<div class="actions">
<%= f.submit "Log in", class: "btn btn-dark btn-block" %>
<%= f.submit t('common.forms.auth.log_in'), class: "btn btn-dark btn-block" %>
</div>
<% end %>

View File

@@ -1,22 +1,22 @@
<div class="deviseLinks">
<%- if controller_name != 'sessions' %>
<%= link_to "Log in", new_session_path(resource_name) %>
<%= link_to t('common.forms.auth.log_in'), new_session_path(resource_name) %>
<% end %>
<%- if devise_mapping.registerable? && controller_name != 'registrations' %>
<%= link_to "Sign up", new_registration_path(resource_name) %>
<%= link_to t('common.forms.auth.sign_up'), new_registration_path(resource_name) %>
<% end %>
<%- if devise_mapping.recoverable? && controller_name != 'passwords' && controller_name != 'registrations' %>
<%= link_to "Forgot your password?", new_password_path(resource_name) %>
<%= link_to t('common.forms.auth.forgot_password'), new_password_path(resource_name) %>
<% end %>
<%- if devise_mapping.confirmable? && controller_name != 'confirmations' %>
<%= link_to "Didn't receive confirmation instructions?", new_confirmation_path(resource_name) %>
<%= link_to t('common.forms.auth.confirmation_instructions_not_received'), new_confirmation_path(resource_name) %>
<% end %>
<%- if devise_mapping.lockable? && resource_class.unlock_strategy_enabled?(:email) && controller_name != 'unlocks' %>
<%= link_to "Didn't receive unlock instructions?", new_unlock_path(resource_name) %>
<%= link_to t('common.forms.auth.unlock_instructions_not_received'), new_unlock_path(resource_name) %>
<% end %>
<%- if devise_mapping.omniauthable? %>

View File

@@ -1,15 +1,18 @@
<h2>Resend unlock instructions</h2>
<%= form_for(resource, as: resource_name, url: unlock_path(resource_name), html: { method: :post }) do |f| %>
<h2><%= t('common.forms.auth.resend_unlock_instructions') %></h2>
<%= render "devise/shared/error_messages", resource: resource %>
<div class="field">
<%= f.label :email %><br />
<%= f.email_field :email, autofocus: true, autocomplete: "email" %>
<%= f.label :email, class: "sr-only" %><br />
<%= f.email_field :email,
autofocus: true,
autocomplete: "email"
placeholder: t('common.forms.auth.email') %>
</div>
<div class="actions">
<%= f.submit "Resend unlock instructions", class: "btn btn-dark btn-block" %>
<%= f.submit t('common.forms.auth.resend_unlock_instructions'), class: "btn btn-dark btn-block" %>
</div>
<% end %>

View File

@@ -26,18 +26,18 @@
</a>
<div class="dropdown-menu" aria-labelledby="navbarDropdown">
<% if current_user.power_user? %>
<%= link_to 'Site settings', site_settings_boards_path, class: 'dropdown-item' %>
<%= link_to 'Admin Panel', admin_root_path, class: 'dropdown-item', 'data-turbolinks': 'false' %>
<%= link_to t('header.menu.site_settings'), site_settings_boards_path, class: 'dropdown-item' %>
<%= link_to t('header.menu.admin_panel'), admin_root_path, class: 'dropdown-item', 'data-turbolinks': 'false' %>
<div class="dropdown-divider"></div>
<% end %>
<%= link_to 'Profile settings', edit_user_registration_path, class: 'dropdown-item' %>
<%= link_to t('header.menu.profile_settings'), edit_user_registration_path, class: 'dropdown-item' %>
<div class="dropdown-divider"></div>
<%= link_to 'Sign out', destroy_user_session_path, method: :delete, class: 'dropdown-item' %>
<%= link_to t('header.menu.sign_out'), destroy_user_session_path, method: :delete, class: 'dropdown-item' %>
</div>
</li>
<% else %>
<li class="nav-item">
<%= link_to 'Log in / Sign up', new_user_session_path, class: 'nav-link' %>
<%= link_to t('header.log_in'), new_user_session_path, class: 'nav-link' %>
</li>
<% end %>
</ul>

View File

@@ -0,0 +1,6 @@
<script type="text/javascript">
// Used to set I18n-js locale to Rails locale
// Variable used in javascript/translations/index.js.erb
var LOCALE = "<%= I18n.locale %>";
</script>

View File

@@ -8,6 +8,8 @@
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="turbolinks-cache-control" content="no-cache">
<%= render 'layouts/set_js_locale' %>
<%= stylesheet_pack_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %>
<%= javascript_pack_tag 'application', 'data-turbolinks-track': 'reload' %>

View File

@@ -2,12 +2,8 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style>
/* Email styles need to be inline */
</style>
</head>
<body>
<%= yield %>
<div><%= yield %></div>
</body>
</html>

View File

@@ -0,0 +1,17 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<body>
<p><%= t('user_mailer.opening_greeting') %></p>
<div><%= yield %></div>
<p><%= t('user_mailer.closing_greeting') %></p>
<footer>
<%= link_to(t('user_mailer.unsubscribe'), edit_user_registration_url) %>.
</footer>
</body>
</html>

View File

@@ -0,0 +1 @@
<%= yield %>

View File

@@ -1,9 +1,9 @@
<div class="sidebar">
<div class="sidebarCard">
<span class="boxTitleText">Site Settings</span>
<span class="boxTitleText"><%= t('site_settings.menu.title') %></span>
<div class="verticalNavigation" role="tablist" aria-orientation="vertical">
<%= render 'menu_link', label: 'Boards', path: site_settings_boards_path %>
<%= render 'menu_link', label: 'Post statuses', path: site_settings_post_statuses_path %>
<%= render 'menu_link', label: t('site_settings.menu.boards'), path: site_settings_boards_path %>
<%= render 'menu_link', label: t('site_settings.menu.post_statuses'), path: site_settings_post_statuses_path %>
</div>
</div>
</div>

View File

@@ -1,4 +1,4 @@
<h2>Roadmap</h2>
<h2><%= t('roadmap.title') %></h2>
<%=
react_component(

View File

@@ -1,24 +1,11 @@
<!DOCTYPE html>
<html>
<head>
<meta content='text/html; charset=utf-8' http-equiv='content-type' />
</head>
<body>
<h1>Hello, <%= @user.full_name %></h1>
<p>
There is a new reply by <b><%= @comment.user.full_name %></b> on your comment from post <b><%= @comment.post.title %></b>:
</p>
<p>
<i><%= @comment.body %></i>
</p>
<p>
<%= link_to "Click here", post_url(@comment.post) %> to have your say!
</p>
<p>
Have a great day!
</p>
</body>
<footer>
Annoyed? You can <%= link_to("turn off notifications here", edit_user_registration_url) %>.
</footer>
</html>
<p>
<%= t('user_mailer.notify_comment_owner.body', { user: @comment.user.full_name, post: @comment.post.title }) %>
</p>
<p>
<i><%= @comment.body %></i>
</p>
<p>
<%= link_to t('user_mailer.learn_more'), post_url(@comment.post) %>
</p>

View File

@@ -1,24 +1,10 @@
<!DOCTYPE html>
<html>
<head>
<meta content='text/html; charset=utf-8' http-equiv='content-type' />
</head>
<body>
<h1>Hello!</h1>
<p>
The post you're following <b><%= @post.title %></b> has a new status:
<span style='background-color: <%= @post.post_status.color %>; color: white;'%>>
<%= @post.post_status.name %>
</span>
</p>
<p>
<%= link_to "Click here", post_url(@post) %> to learn more!
</p>
<p>
Have a great day!
</p>
</body>
<footer>
Annoyed? You can <%= link_to("turn off notifications here", edit_user_registration_url) %>.
</footer>
</html>
<p>
<%= I18n.t('user_mailer.notify_followers_of_post_status_change.body', { post: @post }) %>
<span style='background-color: <%= @post.post_status.color %>; color: white;'%>>
<%= @post.post_status.name %>
</span>
</p>
<p>
<%= link_to I18n.t('user_mailer.learn_more'), post_url(@post) %>
</p>

View File

@@ -1,24 +1,11 @@
<!DOCTYPE html>
<html>
<head>
<meta content='text/html; charset=utf-8' http-equiv='content-type' />
</head>
<body>
<h1>Hello!</h1>
<p>
There is a new update on the post you're following <b><%= @comment.post.title %></b>:
</p>
<p>
<i><%= @comment.body %></i>
</p>
<p>
<%= link_to "Click here", post_url(@comment.post) %> to have your say!
</p>
<p>
Have a great day!
</p>
</body>
<footer>
Annoyed? You can <%= link_to("turn off notifications here", edit_user_registration_url) %>.
</footer>
</html>
<p>
<%= I18n.t('user_mailer.notify_followers_of_post_update.body', { user: @comment.user.full_name, post: @comment.post.title }) %>
</p>
<p>
<i><%= @comment.body %></i>
</p>
<p>
<%= link_to I18n.t('user_mailer.learn_more'), post_url(@comment.post) %>
</p>

View File

@@ -1,24 +1,11 @@
<!DOCTYPE html>
<html>
<head>
<meta content='text/html; charset=utf-8' http-equiv='content-type' />
</head>
<body>
<h1>Hello, <%= @user.full_name %></h1>
<p>
There is a new comment by <b><%= @comment.user.full_name %></b> on your post <b><%= @comment.post.title %></b>:
</p>
<p>
<i><%= @comment.body %></i>
</p>
<p>
<%= link_to "Click here", post_url(@comment.post) %> to have your say!
</p>
<p>
Have a great day!
</p>
</body>
<footer>
Annoyed? You can <%= link_to("turn off notifications here", edit_user_registration_url) %>.
</footer>
</html>
<p>
<%= t('user_mailer.notify_post_owner.body', { user: @comment.user.full_name, post: @comment.post.title }) %>
</p>
<p>
<i><%= @comment.body %></i>
</p>
<p>
<%= link_to t('user_mailer.learn_more'), post_url(@comment.post) %>
</p>