From 402e23c091b716ec43030b720c9b1a01de249044 Mon Sep 17 00:00:00 2001 From: Felipe Murakami <13895820+fhmurakami@users.noreply.github.com> Date: Mon, 30 Dec 2024 06:59:47 +0000 Subject: [PATCH] Add english translation --- app/controllers/application_controller.rb | 11 +- config/locales/devise.en.yml | 4 + config/locales/devise.pt-BR.yml | 1 - config/locales/en.yml | 134 ++++++++++++++++++++-- config/locales/pt-BR.yml | 17 +-- config/routes.rb | 2 +- 6 files changed, 139 insertions(+), 30 deletions(-) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 940b005..3ed81e6 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -1,6 +1,7 @@ class ApplicationController < ActionController::Base before_action :configure_permitted_parameters, if: :devise_controller? around_action :switch_locale + # before_action :switch_locale # Only allow modern browsers supporting webp images, web push, badges, import maps, CSS nesting, and CSS :has. allow_browser versions: :modern @@ -11,8 +12,14 @@ def configure_permitted_parameters end def switch_locale(&action) - locale = params[:locale] || I18n.default_locale - I18n.with_locale(locale, &action) + if params[:locale] == "en" && I18n.locale == :"pt-BR" + I18n.locale = :en + elsif params[:locale] == "pt-BR" && I18n.locale == :en + I18n.locale = :"pt-BR" + else + I18n.locale = params[:locale] || I18n.default_locale + end + I18n.with_locale(I18n.locale, &action) end def default_url_options diff --git a/config/locales/devise.en.yml b/config/locales/devise.en.yml index 228688f..1db5c5f 100644 --- a/config/locales/devise.en.yml +++ b/config/locales/devise.en.yml @@ -16,6 +16,8 @@ en: timeout: "Your session expired. Please sign in again to continue." unauthenticated: "You need to sign in or sign up before continuing." unconfirmed: "You have to confirm your email address before continuing." + confimation_instructions_not_received?: "Didn't receive confirmation instructions? Click here to request again." + unlock_instructions_not_received?: "Didn't receive unlock instructions? Click here to request again." mailer: confirmation_instructions: subject: "Confirmation instructions" @@ -55,6 +57,8 @@ en: signed_in: "Signed in successfully." signed_out: "Signed out successfully." already_signed_out: "Signed out successfully." + omniauth: + sign_in: "Sign in with %{provider}" unlocks: send_instructions: "You will receive an email with instructions for how to unlock your account in a few minutes." send_paranoid_instructions: "If your account exists, you will receive an email with instructions for how to unlock it in a few minutes." diff --git a/config/locales/devise.pt-BR.yml b/config/locales/devise.pt-BR.yml index f96b5c9..e9e055a 100644 --- a/config/locales/devise.pt-BR.yml +++ b/config/locales/devise.pt-BR.yml @@ -63,7 +63,6 @@ pt-BR: send_instructions: "Dentro de minutos, você receberá um email com instruções para o desbloqueio da sua conta." send_paranoid_instructions: "Se sua conta existir, você receberá um e-mail com instruções para desbloqueá-la em alguns minutos." unlocked: "Sua conta foi desbloqueada com sucesso. Efetue login para continuar." - errors: messages: already_confirmed: "já foi confirmado" diff --git a/config/locales/en.yml b/config/locales/en.yml index e3b40f8..bbbbcc2 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -30,29 +30,115 @@ --- en: home: - title: "S.A.M." - subtitle: "Math Evaluation Software" + homepage: "Home" + title: "S.A.M.Ba" + subtitle: "Basic Math Evaluation System" back: "Back to homepage" - sets: - new: "New set" - register: "Register new set" - show: "Use saved set" + collections: + back: "Back to stages" + delete: "Delete stage" + edit: "Edit stage" + editing: "Editing stage" + new: "New stage" + register: "Register new stage" + show: "Show stage" + show_all: "Show all stages" + created: "Stage created successfully!" + updated: "Stage updated successfully!" + destroyed: "Stage deleted successfully!" + errors: + equations_limit: + one: "can't have more than %{count} equation" + other: "can't have more than %{count} equations" + equations: + back: "Back to equations" + delete: "Delete equation" + edit: "Edit equation" + editing: "Editing equation" + remove: "Remove from stage" + remove?: "Are you sure you want to remove the equation from the stage?" + new: "New equation" + register: "Register equation" + show: "Show equation" + show_all: "Show all equations" + created: "Equation created successfully!" + updated: "Equation updated successfully!" + destroyed: "Equation deleted successfully!" + groupings: + back: "Back to groups" + delete: "Delete group" + edit: "Edit group" + editing: "Editing group" + new: "New group" + select: "Select group" + show: "Show group" + show_all: "Show all groups" + created: "Group created successfully!" + updated: "Group updated successfully!" + destroyed: "Group deleted successfully!" participants: back: "Back to participants" delete: "Delete participant" edit: "Edit participant" editing: "Editing participant" + remove_from_grouping: "Remove from group" + remove_from_grouping?: "Are you sure you want to remove the participant from the group?" new: "New participant" register: "Register participant" show: "Show participant" show_all: "Show all participants" + created: "Participant created successfully!" + updated: "Participant updated successfully!" + destroyed: "Participant deleted successfully!" + reports: + back: "Back to reports" + delete: "Delete report" + show: "Show report" + show_all: "Show all reports" + destroyed: "Report deleted successfully!" + errors: + not_found: "Report not found" + rounds: + new: "New round" + congrats: "Congrats!" + congrats_message: "You have answered all the equations!" activerecord: attributes: + answer: + answer_value: "Answer value" + correct_answer: "Correct answer" + time: "Time" + collection: + name: "Name" + equations_quantity: "Equations quantity" + equation: + position_a: "Position A" + position_b: "Position B" + position_c: "Position C" + operator: "Operator" + unknown_position: "Unknown position" + collection_id: "Stage" + grouping: + name: "Name" + user/admin: + first_name: "First name" + last_name: "Last name" + password: "Password" + password_confirmation: "Password confirmation" + remember_me: "Remember me" + forgot_password: "Forgot password?" user/participant: first_name: "First name" last_name: "Last name" birth_date: "Birth date" + grouping_id: "Group" models: + answer: "Answer" + collection: "Stage" + equation: "Equation" + grouping: "Group" + report: "Report" + round: "Round" user/admin: "Admin" user/participant: "Participant" errors: @@ -178,6 +264,8 @@ en: less_than: must be less than %{count} less_than_or_equal_to: must be less than or equal to %{count} model_invalid: "Validation failed: %{errors}" + no_current_equation: There is no current equation + no_unanswered_equations: There are no equations to solve not_a_number: is not a number not_an_integer: must be an integer odd: must be odd @@ -195,24 +283,46 @@ en: wrong_length: one: is the wrong length (should be %{count} character) other: is the wrong length (should be %{count} characters) + too_many_rounds: + one: "%{model} can't have more than %{count} round, because %{grouping} Group has only %{count} participant" + other: "%{model} can't have more than %{count} rounds, because %{grouping} Group has only %{count} participants" template: body: "There were problems with the following fields:" header: one: "%{count} error prohibited this %{model} from being saved" other: "%{count} errors prohibited this %{model} from being saved" helpers: + actions: "Actions" label: + collection: + name: "Name" + equations_quantity: "Equations quantity" + equation: + collection_id: "Stage" + collection_ids: "Stages" + operator: "Operator" + position_a: "Position A" + position_b: "Position B" + position_c: "Position C" + unknown_position: "Unknown position" + grouping: + name: "Name" user_admin: - first_name: "Nome" - last_name: "Sobrenome" - user_participant: - first_name: "Nome" - last_name: "Sobrenome" - birth_date: "Data de nascimento" + first_name: "First Name" + last_name: "Last name" + participant: + first_name: "Fist Name" + last_name: "Last name" + birth_date: "Birth date" + grouping_id: "Group" + grouping_ids: "Groups" select: prompt: Please select submit: + cancel: Cancel create: Create %{model} + ok: OK + start_round: Start round submit: Save %{model} update: Update %{model} reset_password_instructions: "Send me reset password instructions" diff --git a/config/locales/pt-BR.yml b/config/locales/pt-BR.yml index d2fb78c..707066e 100644 --- a/config/locales/pt-BR.yml +++ b/config/locales/pt-BR.yml @@ -5,18 +5,6 @@ pt-BR: title: "S.A.M.Ba" subtitle: "Sistema para Avaliação de Matemática Básica" back: "Voltar para página inicial" - answers: - back: "Voltar para respostas" - delete: "Excluir resposta" - edit: "Editar resposta" - editing: "Editando resposta" - new: "Nova resposta" - register: "Cadastrar nova resposta" - show: "Ver resposta" - show_all: "Ver todas as respostas" - created: "A resposta foi criada com sucesso!" - updated: "A resposta foi atualizada com sucesso!" - destroyed: "A resposta foi excluída com sucesso!" collections: back: "Voltar para etapas" delete: "Excluir etapa" @@ -38,8 +26,8 @@ pt-BR: delete: "Excluir equação" edit: "Editar equação" editing: "Editando equação" - remove: "Remover do etapa" - remove?: "Realmente deseja remover a equação do etapa?" + remove: "Remover da etapa" + remove?: "Realmente deseja remover a equação da etapa?" new: "Nova equação" register: "Cadastrar equação" show: "Ver equação" @@ -253,6 +241,7 @@ pt-BR: not_an_integer: não é um número inteiro odd: deve ser ímpar other_than: deve ser diferente de %{count} + password_too_long: é muito longa present: deve ficar em branco required: é obrigatório(a) taken: já está em uso diff --git a/config/routes.rb b/config/routes.rb index c6ed3b3..1eb7641 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,6 +1,6 @@ # Define your application routes per the DSL in https://guides.rubyonrails.org/routing.html Rails.application.routes.draw do - scope "(:locale)", locale: /pt-BR|en/, defaults: { locale: "pt-BR" } do + scope "(:locale)", locale: /pt-BR|en/ do # Defines the root path route ("/") root "home#index"