Skip to content

Commit c32a12d

Browse files
nickskylineBGMP
andauthored
Missing i18n strings (#63)
Resolves #60 --------- Co-authored-by: José Benavente <jose@bgm.cl>
1 parent 1a79ffb commit c32a12d

28 files changed

+2074
-769
lines changed

Gemfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ gem 'countries', '~> 5.7' # Collecti
77
gem 'country_select', '~> 8.0', '>= 8.0.3' # Provides a simple helper to get an HTML select list of countries
88
gem 'cssbundling-rails', '~> 1.1' # Use SCSS for stylesheets
99
gem 'devise', '~> 4.9.2' # Flexible authentication solution for Rails with Warden
10+
gem 'devise-i18n'
1011
gem 'faraday-http-cache', '~> 2.4' # Faraday middleware that respects HTTP cache
1112
gem 'foreman', '~> 0.87.2' # Process manager for applications with multiple components
1213
gem 'github_api', '~> 0.19.0' # GitHub API

Gemfile.lock

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,8 @@ GEM
128128
railties (>= 4.1.0)
129129
responders
130130
warden (~> 1.2.3)
131+
devise-i18n (1.12.0)
132+
devise (>= 4.9.0)
131133
diff-lcs (1.5.0)
132134
down (5.4.1)
133135
addressable (~> 2.8)
@@ -456,6 +458,7 @@ DEPENDENCIES
456458
country_select (~> 8.0, >= 8.0.3)
457459
cssbundling-rails (~> 1.1)
458460
devise (~> 4.9.2)
461+
devise-i18n
459462
ed25519 (~> 1.3)
460463
error_highlight (>= 0.4.0)
461464
factory_bot_rails (~> 6.2)
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
%h2.mb-3 Resend Instructions
1+
%h2.mb-3= t('.resend_confirmation_instructions')
22
= form_for(resource, as: resource_name, url: confirmation_path(resource_name), html: { method: :post }) do |f|
33
.row
44
.col-md-5
55
.field.form-group
6-
= f.label :email
6+
= f.label :email, t("activerecord.attributes.user.email")
77
= f.email_field :email, autofocus: true, autocomplete: "email", value: (resource.pending_reconfirmation? ? resource.unconfirmed_email : resource.email), :class => "form-control"
88
.actions
9-
= f.button "Resend confirmation instructions", :type => "submit", :class => "btn mb-2"
9+
= f.button t('.resend_confirmation_instructions'), :type => "submit", :class => "btn mb-2"
1010
= render "devise/shared/links"
1111
.col-md-7
1212
= render "devise/shared/error_messages", resource: resource
Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
%p
2-
= t("confirmation.welcome", email:@email) #{@email}!
3-
%p
4-
= t("confirmation.description")
5-
%p= link_to 'Confirm my account', confirmation_url(@resource, confirmation_token: @token)
1+
%p= t('.greeting', recipient: @email)
2+
%p= t('.instruction')
3+
%p= link_to t('.action'), confirmation_url(@resource, confirmation_token: @token)
Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
1-
%p
2-
= t("email.changed.greeting", email:@email) #{@email}!
1+
%p= t('.greeting', recipient: @email)
32
- if @resource.try(:unconfirmed_email?)
4-
%p
5-
= t("email.changed.changing", email:@resource.unconfirmed_email) #{@resource.unconfirmed_email}.
3+
%p= t('.message_unconfirmed', email: @resource.unconfirmed_email)
64
- else
7-
%p
8-
= t("email.changed.changed", email:@resource.email) #{@resource.email}.
9-
5+
%p= t('.message', email: @resource.email)
Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,2 @@
1-
%p
2-
= t("password.change.greeting", email:@resource.email) #{@resource.email}!
3-
%p
4-
= t("password.change.description")
1+
%p= t('.greeting', recipient: @resource.email)
2+
%p= t('.message')
Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
1-
%p
2-
= t("password.reset.greeting", email:@resource.email) #{@resource.email}!
3-
%p
4-
= t("password.reset.advise")
5-
%p= link_to 'Change my password', edit_password_url(@resource, reset_password_token: @token)
6-
%p
7-
= t("password.reset.advise2")
8-
%p
9-
= t("password.reset.advise3")
1+
%p= t('.greeting', recipient: @resource.email)
2+
%p= t('.instruction')
3+
%p= link_to t('.action'), edit_password_url(@resource, reset_password_token: @token)
4+
%p= t('.instruction_2')
5+
%p= t('.instruction_3')
Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
%p
2-
= t("account.unlock.greeting", email:@resource.email) #{@resource.email}!
3-
%p
4-
= t("account.unlock.advise")
5-
%p
6-
= t("account.unlock.instruction")
7-
%p= link_to 'Unlock my account', unlock_url(@resource, unlock_token: @token)
1+
%p= t('.greeting', recipient: @resource.email)
2+
%p= t('.message')
3+
%p= t('.instruction')
4+
%p= link_to t('.action'), unlock_url(@resource, unlock_token: @token)

app/views/devise/passwords/edit.haml

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,18 @@
1-
%h2.mb-3 Change your password
1+
%h2.mb-3= t('.change_your_password')
22
= form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :put }) do |f|
33
.row
44
.col-md-5
55
= f.hidden_field :reset_password_token
66
.field.form-group
7-
= f.label :password, "New password"
7+
= f.label :password, t('.new_password')
88
- if @minimum_password_length
9-
%em
10-
(#{@minimum_password_length} characters minimum)
9+
%em= t('devise.shared.minimum_password_length', count: @minimum_password_length)
1110
= f.password_field :password, autofocus: true, autocomplete: "new-password", :class => "form-control"
1211
.field.form-group
13-
= f.label :password_confirmation, "Confirm new password"
12+
= f.label :password_confirmation, t('.confirm_new_password')
1413
= f.password_field :password_confirmation, autocomplete: "new-password", :class => "form-control"
1514
.actions
16-
= f.button "Change my password", :type => "submit", :class => "btn mb-2"
15+
= f.button t('.change_my_password'), :type => "submit", :class => "btn mb-2"
1716
= render "devise/shared/links"
1817
.col-md-7
1918
= render "devise/shared/error_messages", resource: resource

app/views/devise/passwords/new.haml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
%h2.mb-3 Forgot your password?
1+
%h2.mb-3= t('.forgot_your_password')
22
= form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :post }) do |f|
33
.row
44
.col-md-5
55
.field.form-group
6-
= f.label :email
6+
= f.label :email, t("activerecord.attributes.user.email")
77
= f.email_field :email, autofocus: true, autocomplete: "email", :class => "form-control"
88
.actions
9-
= f.button "Resend password instructions", :type => "submit", :class => "btn mb-2"
9+
= f.button t('.send_me_reset_password_instructions'), :type => "submit", :class => "btn mb-2"
1010
= render "devise/shared/links"
1111
.col-md-7
1212
= render "devise/shared/error_messages", resource: resource
Lines changed: 38 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,54 @@
11
.container
2-
%h3 User Settings
2+
%h3= t(".title")
33
%hr/
44

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

88
%ul.nav.nav-tabs.mb-3{role: "tablist"}
99
%li.nav-item
10-
%a#edit-profile-tab.nav-link.active{"aria-controls" => "edit-profile", "aria-selected" => "true", "data-toggle" => "tab", href: "#edit-profile", role: "tab"} Edit Profile
10+
%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")
1111
%li.nav-item
12-
%a#change-email-tab.nav-link{"aria-controls" => "change-email", "aria-selected" => "false", "data-toggle" => "tab", href: "#change-email", role: "tab"} Change Email
12+
%a#change-email-tab.nav-link{"aria-controls" => "change-email", "aria-selected" => "false", "data-toggle" => "tab", href: "#change-email", role: "tab"}= t(".email.title")
1313
%li.nav-item
14-
%a#change-password-tab.nav-link{"aria-controls" => "change-password", "aria-selected" => "false", "data-toggle" => "tab", href: "#change-password", role: "tab"} Change Password
14+
%a#change-password-tab.nav-link{"aria-controls" => "change-password", "aria-selected" => "false", "data-toggle" => "tab", href: "#change-password", role: "tab"}= t(".password.title")
1515

1616
.tab-content
1717
#edit-profile.tab-pane.fade.show.active{:"aria-labelledby" => "edit-profile-tab", role: "tabpanel"}
1818
.row
1919
.col.pull-left
2020
= form_for resource, as: resource_name, url: registration_path(resource_name) do |f|
2121
= f.fields_for :profile do |profile|
22-
%h6 Gender
22+
%h6= t(".profile.gender")
2323
.form-group
2424
.input-group
25-
= profile.text_field :gender, :placeholder => 'Gender', :autocomplete => 'gender', :class => 'form-control'
25+
= profile.text_field :gender, :placeholder => t(".profile.gender"), :autocomplete => 'gender', :class => 'form-control'
2626
%h6
27-
Nationality
27+
= t(".profile.nationality.title")
2828
%small
29-
(National flag)
29+
= t(".profile.nationality.small")
3030
.field.form-group
3131
= f.country_select :country, {:include_blank => true}, {:class => "form-control"}
32-
%h6 Location
32+
%h6
33+
= t(".profile.location")
3334
.form-group
3435
.input-group
35-
= profile.text_field :location, :placeholder => 'Location', :autocomplete => 'location', :class => 'form-control'
36-
%h6 Occupation
36+
= profile.text_field :location, :placeholder => t(".profile.location"), :autocomplete => 'location', :class => 'form-control'
37+
%h6
38+
= t(".profile.occupation")
3739
.form-group
3840
.input-group
39-
= profile.text_field :occupation, :placeholder => 'Occupation', :autocomplete => 'occupation', :class => 'form-control'
40-
%h6 Interests
41+
= profile.text_field :occupation, :placeholder => t(".profile.occupation"), :autocomplete => 'occupation', :class => 'form-control'
42+
%h6
43+
= t(".profile.interests")
4144
.form-group
4245
.input-group
43-
= profile.text_field :interests, :placeholder => 'Interests', :autocomplete => 'interests', :class => 'form-control'
44-
%h6 Public Email
46+
= profile.text_field :interests, :placeholder => t(".profile.interests"), :autocomplete => 'interests', :class => 'form-control'
47+
%h6
48+
= t(".profile.public-email")
4549
.form-group
4650
.input-group
47-
= profile.text_field :public_email, :placeholder => 'Public Email', :autocomplete => 'public_email', :class => 'form-control'
51+
= profile.text_field :public_email, :placeholder => t(".profile.public-email"), :autocomplete => 'public_email', :class => 'form-control'
4852
%h6 Discord
4953
.form-group
5054
.input-group
@@ -74,53 +78,56 @@
7478
.input-group-prepend
7579
.input-group-text.devise-form-input-prepend steamcommunity.com/id/
7680
= profile.text_field :steam, :autocomplete => 'steam', :class => 'form-control'
77-
%h6 About me... (You may use html)
81+
%h6
82+
= t(".profile.about-me.title")
7883
.row
7984
.form-group
80-
= profile.text_area :about, :placeholder => 'Write something interesting...', :autocomplete => 'about_me', :class => 'form-control'
85+
= profile.text_area :about, :placeholder => t(".profile.about-me.placeholder"), :autocomplete => 'about_me', :class => 'form-control'
8186
.form-group
8287
.input-group
83-
= f.password_field :current_password, :placeholder => 'Current password', :class => 'form-control'
88+
= f.password_field :current_password, :placeholder => t(".current-password"), :class => 'form-control'
8489
.btn-toolbar
8590
.actions
86-
= f.submit "Update", :class => 'btn btn-sm'
91+
= f.submit t(".update"), :class => 'btn btn-sm'
8792

8893
#change-email.tab-pane.fade.show{:"aria-labelledby" => "change-email-tab", role: "tabpanel"}
8994
.row
9095
.col-md-5
91-
%h4 Change Email
96+
%h4
97+
= t(".email.title")
9298
= form_for(resource, as: resource_name, url: registration_path(resource_name), html: { method: :put }) do |f|
9399
.form-group
94100
.input-group
95-
= f.email_field :email, autofocus: true, :placeholder => 'New Email', :class => 'form-control'
101+
= f.email_field :email, autofocus: true, :placeholder => t(".email.new"), :class => 'form-control'
96102
- if devise_mapping.confirmable? && resource.pending_reconfirmation?
97103
.devise-text-pleasant
98104
%i.fa.fa-exclamation-triangle{"aria-hidden" => "true"}
99-
Awaiting confirmation for: #{resource.unconfirmed_email}
105+
= t('.currently_waiting_confirmation_for_email', :email => resource.unconfirmed_email)
100106
.form-group
101107
.input-group
102-
= f.password_field :current_password, :placeholder => 'Current password', :class => 'form-control'
108+
= f.password_field :current_password, :placeholder => t(".current-password"), :class => 'form-control'
103109
.btn-toolbar
104110
.actions
105-
= f.submit "Update", :class => 'btn btn-sm'
111+
= f.submit t(".update"), :class => 'btn btn-sm'
106112

107113
#change-password.tab-pane.fade.show{:"aria-labelledby" => "change-password-tab", role: "tabpanel"}
108114
.row
109115
.col-md-5
110-
%h4 Change password
116+
%h4
117+
= t(".password.title")
111118
= form_for(resource, as: resource_name, url: registration_path(resource_name), html: { method: :put }) do |f|
112119
.form-group
113120
.input-group
114121
- if @minimum_password_length
115-
= f.password_field :password, autocomplete: "new-password", :placeholder => "New password (#{@minimum_password_length} characters minimum)", :class => 'form-control'
122+
= f.password_field :password, autocomplete: "new-password", :placeholder => t(".password.new-length", length: @minimum_password_length) , :class => 'form-control'
116123
- else
117-
= f.password_field :password, autocomplete: "new-password", :placeholder => "New password", :class => 'form-control'
124+
= f.password_field :password, autocomplete: "new-password", :placeholder => t(".password.new"), :class => 'form-control'
118125
.form-group
119126
.input-group
120-
= f.password_field :password_confirmation, autocomplete: "new-password", :placeholder => 'Confirm new password', :class => 'form-control'
127+
= f.password_field :password_confirmation, autocomplete: "new-password", :placeholder => t(".password.confirm"), :class => 'form-control'
121128
.form-group
122129
.input-group
123-
= f.password_field :current_password, autocomplete: "current-password", :placeholder => 'Current password', :class => 'form-control'
130+
= f.password_field :current_password, autocomplete: "current-password", :placeholder => t(".current-password"), :class => 'form-control'
124131
.btn-toolbar
125132
.actions
126-
= f.submit "Update", :class => 'btn btn-sm'
133+
= f.submit t(".update"), :class => 'btn btn-sm'
Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
1-
%h2.mb-3 Register
1+
%h2.mb-3=t('.sign_up')
22
= form_for(resource, as: resource_name, url: registration_path(resource_name)) do |f|
33
.row
44
.col-md-5
55
.field.form-group
6-
= f.label(:username, "Re-Volt Username")
6+
= f.label(:username, t(".username"))
77
= f.text_field :username, autocomplete: "username", :class => "form-control", :style => "text-transform: uppercase;"
88
.field.form-group
9-
= f.label :email
9+
= f.label :email, t("activerecord.attributes.user.email")
1010
= f.email_field :email, autofocus: true, autocomplete: "email", :class => "form-control"
1111
.field.form-group
12-
= f.label :password
12+
= f.label :password, t("devise.shared.links.password")
1313
- if @minimum_password_length
1414
%em
15-
(#{@minimum_password_length} characters minimum)
15+
= t('devise.shared.minimum_password_length', count: @minimum_password_length)
1616
= f.password_field :password, autocomplete: "new-password", :class => "form-control"
1717
.field.form-group
18-
= f.label :password_confirmation
18+
= f.label :password_confirmation, t("devise.shared.links.password-confirm")
1919
= f.password_field :password_confirmation, autocomplete: "new-password", :class => "form-control"
2020
.actions
21-
= f.button "Sign up", :type => "submit", :class => "btn mb-2"
21+
= f.button t('.sign_up'), :type => "submit", :class => "btn mb-2"
2222
= render "devise/shared/links"
2323
.col-md-7
2424
= render "devise/shared/error_messages", resource: resource

app/views/devise/sessions/new.haml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
1-
%h2.mb-3 Log in
1+
%h2.mb-3= t('.sign_in')
22
= form_for(resource, as: resource_name, url: new_user_session_path) do |f|
33
.row
44
.col-md-5
55
.field.form-group
6-
= f.label :email
6+
= f.label :email, t("activerecord.attributes.user.email")
77
= f.email_field :email, autofocus: true, autocomplete: "email", :class => "form-control"
88
.field.form-group
9-
= f.label :password
9+
= f.label :password, t("activerecord.attributes.user.password")
1010
= f.password_field :password, autocomplete: "current-password", :class => "form-control"
1111
- if devise_mapping.rememberable?
1212
.field.form-group
1313
= f.check_box :remember_me
14-
= f.label :remember_me
14+
= f.label :remember_me, t("activerecord.attributes.user.remember_me")
1515
.actions
16-
= f.button "Log in", :type => "submit", :class => "btn mb-2"
16+
= f.button t('.sign_in'), :type => "submit", :class => "btn mb-2"
1717
= render "devise/shared/links"
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
- if resource.errors.any?
2-
#error-explanation
3-
%h5
4-
= I18n.t("errors.messages.not_saved", |
5-
count: resource.errors.count, |
6-
resource: resource.class.model_name.human.downcase) |
2+
#error_explanation{"data-turbo-cache" => "false"}
3+
%h2
4+
= I18n.t("errors.messages.not_saved", |
5+
count: resource.errors.count, |
6+
resource: devise_i18n_fix_model_name_case(resource.model_name.human, i18n_key: 'errors.messages.not_saved')) |
77
%ul
88
- resource.errors.full_messages.each do |message|
99
%li= message

app/views/devise/shared/_links.haml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
- if controller_name != 'sessions'
2-
= link_to "Log in", new_user_session_path
2+
= link_to t(".sign_in"), new_user_session_path
33
%br/
44
- if devise_mapping.registerable? && controller_name != 'registrations'
5-
= link_to "Sign up", new_registration_path(resource_name)
5+
= link_to t(".sign_up"), new_registration_path(resource_name)
66
%br/
77
- if devise_mapping.recoverable? && controller_name != 'passwords' && controller_name != 'registrations'
8-
= link_to "Forgot your password?", new_password_path(resource_name)
8+
= link_to t(".forgot_your_password"), new_password_path(resource_name)
99
%br/
1010
- if devise_mapping.confirmable? && controller_name != 'confirmations'
11-
= link_to "Didn't receive confirmation instructions?", new_confirmation_path(resource_name)
11+
= link_to t('.didn_t_receive_confirmation_instructions'), new_confirmation_path(resource_name)
1212
%br/
1313
- if devise_mapping.lockable? && resource_class.unlock_strategy_enabled?(:email) && controller_name != 'unlocks'
14-
= link_to "Didn't receive unlock instructions?", new_unlock_path(resource_name)
14+
= link_to t('.didn_t_receive_unlock_instructions'), new_unlock_path(resource_name)
1515
%br/
1616
- if devise_mapping.omniauthable?
1717
- resource_class.omniauth_providers.each do |provider|
18-
= link_to "Sign in with #{OmniAuth::Utils.camelize(provider)}", omniauth_authorize_path(resource_name, provider), method: :post, :"data-turbo" => false
18+
= button_to t('.sign_in_with_provider', provider: OmniAuth::Utils.camelize(provider)), omniauth_authorize_path(resource_name, provider), data: { turbo: false }
1919
%br/

0 commit comments

Comments
 (0)