Skip to content

Commit

Permalink
Missing i18n strings (#63)
Browse files Browse the repository at this point in the history
Resolves #60 

---------

Co-authored-by: José Benavente <jose@bgm.cl>
  • Loading branch information
nickskyline and BGMP committed Mar 12, 2024
1 parent 1a79ffb commit c32a12d
Show file tree
Hide file tree
Showing 28 changed files with 2,074 additions and 769 deletions.
1 change: 1 addition & 0 deletions Gemfile
Expand Up @@ -7,6 +7,7 @@ gem 'countries', '~> 5.7' # Collecti
gem 'country_select', '~> 8.0', '>= 8.0.3' # Provides a simple helper to get an HTML select list of countries
gem 'cssbundling-rails', '~> 1.1' # Use SCSS for stylesheets
gem 'devise', '~> 4.9.2' # Flexible authentication solution for Rails with Warden
gem 'devise-i18n'
gem 'faraday-http-cache', '~> 2.4' # Faraday middleware that respects HTTP cache
gem 'foreman', '~> 0.87.2' # Process manager for applications with multiple components
gem 'github_api', '~> 0.19.0' # GitHub API
Expand Down
3 changes: 3 additions & 0 deletions Gemfile.lock
Expand Up @@ -128,6 +128,8 @@ GEM
railties (>= 4.1.0)
responders
warden (~> 1.2.3)
devise-i18n (1.12.0)
devise (>= 4.9.0)
diff-lcs (1.5.0)
down (5.4.1)
addressable (~> 2.8)
Expand Down Expand Up @@ -456,6 +458,7 @@ DEPENDENCIES
country_select (~> 8.0, >= 8.0.3)
cssbundling-rails (~> 1.1)
devise (~> 4.9.2)
devise-i18n
ed25519 (~> 1.3)
error_highlight (>= 0.4.0)
factory_bot_rails (~> 6.2)
Expand Down
6 changes: 3 additions & 3 deletions app/views/devise/confirmations/new.haml
@@ -1,12 +1,12 @@
%h2.mb-3 Resend Instructions
%h2.mb-3= t('.resend_confirmation_instructions')
= form_for(resource, as: resource_name, url: confirmation_path(resource_name), html: { method: :post }) do |f|
.row
.col-md-5
.field.form-group
= f.label :email
= f.label :email, t("activerecord.attributes.user.email")
= f.email_field :email, autofocus: true, autocomplete: "email", value: (resource.pending_reconfirmation? ? resource.unconfirmed_email : resource.email), :class => "form-control"
.actions
= f.button "Resend confirmation instructions", :type => "submit", :class => "btn mb-2"
= f.button t('.resend_confirmation_instructions'), :type => "submit", :class => "btn mb-2"
= render "devise/shared/links"
.col-md-7
= render "devise/shared/error_messages", resource: resource
8 changes: 3 additions & 5 deletions app/views/devise/mailer/confirmation_instructions.haml
@@ -1,5 +1,3 @@
%p
= t("confirmation.welcome", email:@email) #{@email}!
%p
= t("confirmation.description")
%p= link_to 'Confirm my account', confirmation_url(@resource, confirmation_token: @token)
%p= t('.greeting', recipient: @email)
%p= t('.instruction')
%p= link_to t('.action'), confirmation_url(@resource, confirmation_token: @token)
10 changes: 3 additions & 7 deletions app/views/devise/mailer/email_changed.haml
@@ -1,9 +1,5 @@
%p
= t("email.changed.greeting", email:@email) #{@email}!
%p= t('.greeting', recipient: @email)
- if @resource.try(:unconfirmed_email?)
%p
= t("email.changed.changing", email:@resource.unconfirmed_email) #{@resource.unconfirmed_email}.
%p= t('.message_unconfirmed', email: @resource.unconfirmed_email)
- else
%p
= t("email.changed.changed", email:@resource.email) #{@resource.email}.

%p= t('.message', email: @resource.email)
6 changes: 2 additions & 4 deletions app/views/devise/mailer/password_change.haml
@@ -1,4 +1,2 @@
%p
= t("password.change.greeting", email:@resource.email) #{@resource.email}!
%p
= t("password.change.description")
%p= t('.greeting', recipient: @resource.email)
%p= t('.message')
14 changes: 5 additions & 9 deletions app/views/devise/mailer/reset_password_instructions.haml
@@ -1,9 +1,5 @@
%p
= t("password.reset.greeting", email:@resource.email) #{@resource.email}!
%p
= t("password.reset.advise")
%p= link_to 'Change my password', edit_password_url(@resource, reset_password_token: @token)
%p
= t("password.reset.advise2")
%p
= t("password.reset.advise3")
%p= t('.greeting', recipient: @resource.email)
%p= t('.instruction')
%p= link_to t('.action'), edit_password_url(@resource, reset_password_token: @token)
%p= t('.instruction_2')
%p= t('.instruction_3')
11 changes: 4 additions & 7 deletions app/views/devise/mailer/unlock_instructions.haml
@@ -1,7 +1,4 @@
%p
= t("account.unlock.greeting", email:@resource.email) #{@resource.email}!
%p
= t("account.unlock.advise")
%p
= t("account.unlock.instruction")
%p= link_to 'Unlock my account', unlock_url(@resource, unlock_token: @token)
%p= t('.greeting', recipient: @resource.email)
%p= t('.message')
%p= t('.instruction')
%p= link_to t('.action'), unlock_url(@resource, unlock_token: @token)
11 changes: 5 additions & 6 deletions app/views/devise/passwords/edit.haml
@@ -1,19 +1,18 @@
%h2.mb-3 Change your password
%h2.mb-3= t('.change_your_password')
= form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :put }) do |f|
.row
.col-md-5
= f.hidden_field :reset_password_token
.field.form-group
= f.label :password, "New password"
= f.label :password, t('.new_password')
- if @minimum_password_length
%em
(#{@minimum_password_length} characters minimum)
%em= t('devise.shared.minimum_password_length', count: @minimum_password_length)
= f.password_field :password, autofocus: true, autocomplete: "new-password", :class => "form-control"
.field.form-group
= f.label :password_confirmation, "Confirm new password"
= f.label :password_confirmation, t('.confirm_new_password')
= f.password_field :password_confirmation, autocomplete: "new-password", :class => "form-control"
.actions
= f.button "Change my password", :type => "submit", :class => "btn mb-2"
= f.button t('.change_my_password'), :type => "submit", :class => "btn mb-2"
= render "devise/shared/links"
.col-md-7
= render "devise/shared/error_messages", resource: resource
6 changes: 3 additions & 3 deletions app/views/devise/passwords/new.haml
@@ -1,12 +1,12 @@
%h2.mb-3 Forgot your password?
%h2.mb-3= t('.forgot_your_password')
= form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :post }) do |f|
.row
.col-md-5
.field.form-group
= f.label :email
= f.label :email, t("activerecord.attributes.user.email")
= f.email_field :email, autofocus: true, autocomplete: "email", :class => "form-control"
.actions
= f.button "Resend password instructions", :type => "submit", :class => "btn mb-2"
= f.button t('.send_me_reset_password_instructions'), :type => "submit", :class => "btn mb-2"
= render "devise/shared/links"
.col-md-7
= render "devise/shared/error_messages", resource: resource
69 changes: 38 additions & 31 deletions app/views/devise/registrations/edit.haml
@@ -1,50 +1,54 @@
.container
%h3 User Settings
%h3= t(".title")
%hr/

.mb-3
= render "devise/shared/error_messages", resource: resource

%ul.nav.nav-tabs.mb-3{role: "tablist"}
%li.nav-item
%a#edit-profile-tab.nav-link.active{"aria-controls" => "edit-profile", "aria-selected" => "true", "data-toggle" => "tab", href: "#edit-profile", role: "tab"} Edit Profile
%a#edit-profile-tab.nav-link.active{"aria-controls" => "edit-profile", "aria-selected" => "true", "data-toggle" => "tab", href: "#edit-profile", role: "tab"}= t(".profile.title")
%li.nav-item
%a#change-email-tab.nav-link{"aria-controls" => "change-email", "aria-selected" => "false", "data-toggle" => "tab", href: "#change-email", role: "tab"} Change Email
%a#change-email-tab.nav-link{"aria-controls" => "change-email", "aria-selected" => "false", "data-toggle" => "tab", href: "#change-email", role: "tab"}= t(".email.title")
%li.nav-item
%a#change-password-tab.nav-link{"aria-controls" => "change-password", "aria-selected" => "false", "data-toggle" => "tab", href: "#change-password", role: "tab"} Change Password
%a#change-password-tab.nav-link{"aria-controls" => "change-password", "aria-selected" => "false", "data-toggle" => "tab", href: "#change-password", role: "tab"}= t(".password.title")

.tab-content
#edit-profile.tab-pane.fade.show.active{:"aria-labelledby" => "edit-profile-tab", role: "tabpanel"}
.row
.col.pull-left
= form_for resource, as: resource_name, url: registration_path(resource_name) do |f|
= f.fields_for :profile do |profile|
%h6 Gender
%h6= t(".profile.gender")
.form-group
.input-group
= profile.text_field :gender, :placeholder => 'Gender', :autocomplete => 'gender', :class => 'form-control'
= profile.text_field :gender, :placeholder => t(".profile.gender"), :autocomplete => 'gender', :class => 'form-control'
%h6
Nationality
= t(".profile.nationality.title")
%small
(National flag)
= t(".profile.nationality.small")
.field.form-group
= f.country_select :country, {:include_blank => true}, {:class => "form-control"}
%h6 Location
%h6
= t(".profile.location")
.form-group
.input-group
= profile.text_field :location, :placeholder => 'Location', :autocomplete => 'location', :class => 'form-control'
%h6 Occupation
= profile.text_field :location, :placeholder => t(".profile.location"), :autocomplete => 'location', :class => 'form-control'
%h6
= t(".profile.occupation")
.form-group
.input-group
= profile.text_field :occupation, :placeholder => 'Occupation', :autocomplete => 'occupation', :class => 'form-control'
%h6 Interests
= profile.text_field :occupation, :placeholder => t(".profile.occupation"), :autocomplete => 'occupation', :class => 'form-control'
%h6
= t(".profile.interests")
.form-group
.input-group
= profile.text_field :interests, :placeholder => 'Interests', :autocomplete => 'interests', :class => 'form-control'
%h6 Public Email
= profile.text_field :interests, :placeholder => t(".profile.interests"), :autocomplete => 'interests', :class => 'form-control'
%h6
= t(".profile.public-email")
.form-group
.input-group
= profile.text_field :public_email, :placeholder => 'Public Email', :autocomplete => 'public_email', :class => 'form-control'
= profile.text_field :public_email, :placeholder => t(".profile.public-email"), :autocomplete => 'public_email', :class => 'form-control'
%h6 Discord
.form-group
.input-group
Expand Down Expand Up @@ -74,53 +78,56 @@
.input-group-prepend
.input-group-text.devise-form-input-prepend steamcommunity.com/id/
= profile.text_field :steam, :autocomplete => 'steam', :class => 'form-control'
%h6 About me... (You may use html)
%h6
= t(".profile.about-me.title")
.row
.form-group
= profile.text_area :about, :placeholder => 'Write something interesting...', :autocomplete => 'about_me', :class => 'form-control'
= profile.text_area :about, :placeholder => t(".profile.about-me.placeholder"), :autocomplete => 'about_me', :class => 'form-control'
.form-group
.input-group
= f.password_field :current_password, :placeholder => 'Current password', :class => 'form-control'
= f.password_field :current_password, :placeholder => t(".current-password"), :class => 'form-control'
.btn-toolbar
.actions
= f.submit "Update", :class => 'btn btn-sm'
= f.submit t(".update"), :class => 'btn btn-sm'

#change-email.tab-pane.fade.show{:"aria-labelledby" => "change-email-tab", role: "tabpanel"}
.row
.col-md-5
%h4 Change Email
%h4
= t(".email.title")
= form_for(resource, as: resource_name, url: registration_path(resource_name), html: { method: :put }) do |f|
.form-group
.input-group
= f.email_field :email, autofocus: true, :placeholder => 'New Email', :class => 'form-control'
= f.email_field :email, autofocus: true, :placeholder => t(".email.new"), :class => 'form-control'
- if devise_mapping.confirmable? && resource.pending_reconfirmation?
.devise-text-pleasant
%i.fa.fa-exclamation-triangle{"aria-hidden" => "true"}
Awaiting confirmation for: #{resource.unconfirmed_email}
= t('.currently_waiting_confirmation_for_email', :email => resource.unconfirmed_email)
.form-group
.input-group
= f.password_field :current_password, :placeholder => 'Current password', :class => 'form-control'
= f.password_field :current_password, :placeholder => t(".current-password"), :class => 'form-control'
.btn-toolbar
.actions
= f.submit "Update", :class => 'btn btn-sm'
= f.submit t(".update"), :class => 'btn btn-sm'

#change-password.tab-pane.fade.show{:"aria-labelledby" => "change-password-tab", role: "tabpanel"}
.row
.col-md-5
%h4 Change password
%h4
= t(".password.title")
= form_for(resource, as: resource_name, url: registration_path(resource_name), html: { method: :put }) do |f|
.form-group
.input-group
- if @minimum_password_length
= f.password_field :password, autocomplete: "new-password", :placeholder => "New password (#{@minimum_password_length} characters minimum)", :class => 'form-control'
= f.password_field :password, autocomplete: "new-password", :placeholder => t(".password.new-length", length: @minimum_password_length) , :class => 'form-control'
- else
= f.password_field :password, autocomplete: "new-password", :placeholder => "New password", :class => 'form-control'
= f.password_field :password, autocomplete: "new-password", :placeholder => t(".password.new"), :class => 'form-control'
.form-group
.input-group
= f.password_field :password_confirmation, autocomplete: "new-password", :placeholder => 'Confirm new password', :class => 'form-control'
= f.password_field :password_confirmation, autocomplete: "new-password", :placeholder => t(".password.confirm"), :class => 'form-control'
.form-group
.input-group
= f.password_field :current_password, autocomplete: "current-password", :placeholder => 'Current password', :class => 'form-control'
= f.password_field :current_password, autocomplete: "current-password", :placeholder => t(".current-password"), :class => 'form-control'
.btn-toolbar
.actions
= f.submit "Update", :class => 'btn btn-sm'
= f.submit t(".update"), :class => 'btn btn-sm'
14 changes: 7 additions & 7 deletions app/views/devise/registrations/new.haml
@@ -1,24 +1,24 @@
%h2.mb-3 Register
%h2.mb-3=t('.sign_up')
= form_for(resource, as: resource_name, url: registration_path(resource_name)) do |f|
.row
.col-md-5
.field.form-group
= f.label(:username, "Re-Volt Username")
= f.label(:username, t(".username"))
= f.text_field :username, autocomplete: "username", :class => "form-control", :style => "text-transform: uppercase;"
.field.form-group
= f.label :email
= f.label :email, t("activerecord.attributes.user.email")
= f.email_field :email, autofocus: true, autocomplete: "email", :class => "form-control"
.field.form-group
= f.label :password
= f.label :password, t("devise.shared.links.password")
- if @minimum_password_length
%em
(#{@minimum_password_length} characters minimum)
= t('devise.shared.minimum_password_length', count: @minimum_password_length)
= f.password_field :password, autocomplete: "new-password", :class => "form-control"
.field.form-group
= f.label :password_confirmation
= f.label :password_confirmation, t("devise.shared.links.password-confirm")
= f.password_field :password_confirmation, autocomplete: "new-password", :class => "form-control"
.actions
= f.button "Sign up", :type => "submit", :class => "btn mb-2"
= f.button t('.sign_up'), :type => "submit", :class => "btn mb-2"
= render "devise/shared/links"
.col-md-7
= render "devise/shared/error_messages", resource: resource
10 changes: 5 additions & 5 deletions app/views/devise/sessions/new.haml
@@ -1,17 +1,17 @@
%h2.mb-3 Log in
%h2.mb-3= t('.sign_in')
= form_for(resource, as: resource_name, url: new_user_session_path) do |f|
.row
.col-md-5
.field.form-group
= f.label :email
= f.label :email, t("activerecord.attributes.user.email")
= f.email_field :email, autofocus: true, autocomplete: "email", :class => "form-control"
.field.form-group
= f.label :password
= f.label :password, t("activerecord.attributes.user.password")
= f.password_field :password, autocomplete: "current-password", :class => "form-control"
- if devise_mapping.rememberable?
.field.form-group
= f.check_box :remember_me
= f.label :remember_me
= f.label :remember_me, t("activerecord.attributes.user.remember_me")
.actions
= f.button "Log in", :type => "submit", :class => "btn mb-2"
= f.button t('.sign_in'), :type => "submit", :class => "btn mb-2"
= render "devise/shared/links"
10 changes: 5 additions & 5 deletions app/views/devise/shared/_error_messages.haml
@@ -1,9 +1,9 @@
- if resource.errors.any?
#error-explanation
%h5
= I18n.t("errors.messages.not_saved", |
count: resource.errors.count, |
resource: resource.class.model_name.human.downcase) |
#error_explanation{"data-turbo-cache" => "false"}
%h2
= I18n.t("errors.messages.not_saved", |
count: resource.errors.count, |
resource: devise_i18n_fix_model_name_case(resource.model_name.human, i18n_key: 'errors.messages.not_saved')) |
%ul
- resource.errors.full_messages.each do |message|
%li= message
12 changes: 6 additions & 6 deletions app/views/devise/shared/_links.haml
@@ -1,19 +1,19 @@
- if controller_name != 'sessions'
= link_to "Log in", new_user_session_path
= link_to t(".sign_in"), new_user_session_path
%br/
- if devise_mapping.registerable? && controller_name != 'registrations'
= link_to "Sign up", new_registration_path(resource_name)
= link_to t(".sign_up"), new_registration_path(resource_name)
%br/
- if devise_mapping.recoverable? && controller_name != 'passwords' && controller_name != 'registrations'
= link_to "Forgot your password?", new_password_path(resource_name)
= link_to t(".forgot_your_password"), new_password_path(resource_name)
%br/
- if devise_mapping.confirmable? && controller_name != 'confirmations'
= link_to "Didn't receive confirmation instructions?", new_confirmation_path(resource_name)
= link_to t('.didn_t_receive_confirmation_instructions'), new_confirmation_path(resource_name)
%br/
- 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('.didn_t_receive_unlock_instructions'), new_unlock_path(resource_name)
%br/
- if devise_mapping.omniauthable?
- resource_class.omniauth_providers.each do |provider|
= link_to "Sign in with #{OmniAuth::Utils.camelize(provider)}", omniauth_authorize_path(resource_name, provider), method: :post, :"data-turbo" => false
= button_to t('.sign_in_with_provider', provider: OmniAuth::Utils.camelize(provider)), omniauth_authorize_path(resource_name, provider), data: { turbo: false }
%br/

0 comments on commit c32a12d

Please sign in to comment.