Skip to content

Commit

Permalink
Remove translation calls to config/locales directory (#5480)
Browse files Browse the repository at this point in the history
* test: add EmancipationChecklistReminderNotification RSpec test

* Remove localization from EmancipationChecklistReminderNotification

* Modify all I18n.t calls to hardcoded string

* Modify remaining translate and t calls to hardcoded string

* Remove controllers, models and views localization files

* Delete all translations from en.yml file

* Use localization call on invitation instructions

* Revert back to devise translation calls

* Fix lint issue on multiline string

* Return devise translation call to sessions/new_spec.rb
  • Loading branch information
fchagasjr authored Jan 13, 2024
1 parent 0da9941 commit 2828276
Show file tree
Hide file tree
Showing 14 changed files with 84 additions and 640 deletions.
4 changes: 2 additions & 2 deletions app/decorators/volunteer_decorator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ class VolunteerDecorator < UserDecorator

def cc_reminder_text
if h.current_user.supervisor?
h.t("volunteers.send_reminder_button.supervisor_checkbox_text")
"Send CC to Supervisor"
elsif h.current_user.casa_admin?
h.t("volunteers.send_reminder_button.admin_checkbox_text")
"Send CC to Supervisor and Admin"
end
end
end
28 changes: 13 additions & 15 deletions app/models/case_contact.rb
Original file line number Diff line number Diff line change
Expand Up @@ -205,24 +205,22 @@ def supervisor_active?
end

def self.options_for_sorted_by
sorted_by_params.map do |option|
[I18n.t("models.case_contact.options_for_sorted_by.#{option}"), option]
end
sorted_by_params.each.map { |option_pair| option_pair.reverse }
end

private_class_method def self.sorted_by_params
%i[
occurred_at_asc
occurred_at_desc
contact_type_asc
contact_type_desc
medium_type_asc
medium_type_desc
want_driving_reimbursement_asc
want_driving_reimbursement_desc
contact_made_asc
contact_made_desc
]
{
occurred_at_asc: "Date of contact (oldest first)",
occurred_at_desc: "Date of contact (newest first)",
contact_type_asc: "Contact type (A-z)",
contact_type_desc: "Contact type (z-A)",
medium_type_asc: "Contact medium (A-z)",
medium_type_desc: "Contact medium (z-A)",
want_driving_reimbursement_asc: "Want driving reimbursement ('no' first)",
want_driving_reimbursement_desc: "Want driving reimbursement ('yes' first)",
contact_made_asc: "Contact made ('no' first)",
contact_made_desc: "Contact made ('yes' first)"
}
end
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,14 @@ class EmancipationChecklistReminderNotification < BaseNotification
# Define helper methods to make rendering easier.

def message
t(".message", case_number: params[:casa_case].case_number)
casa_case = params[:casa_case]
"Your case #{casa_case.case_number} is a transition aged youth. " \
"We want to make sure that along the way, we’re preparing our youth for emancipation. " \
"Make sure to check the emancipation checklist."
end

def title
t(".title")
"Emancipation Checklist Reminder"
end

def url
Expand Down
2 changes: 1 addition & 1 deletion app/views/devise/mailer/invitation_instructions.text.erb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
<% else %>
A CASA console admin account has been created for you. Your console account is associated with this email.
If you are ready to get started, please set your password. This is the first step to accessing your new account.
<%= t 'devise.mailer.invitation_instructions.accept_until', due_date: l(@resource.invitation_due_at, format: :'devise.mailer.invitation_instructions.accept_until_format') %>
<%= "This invitation will be due in #{I18n.l(@resource.invitation_due_at, format: :'devise.mailer.invitation_instructions.accept_until_format')}." %>
<% end %>
<%= link_to "Set your password", accept_invitation_url(@resource, invitation_token: @token) %>
8 changes: 4 additions & 4 deletions app/views/layouts/application.html.erb
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
<!DOCTYPE html>
<html>
<head>
<title><%= translate('page.meta.title') %></title>
<title>CASA Volunteer Tracking</title>

<meta name="description" content="<%= translate('page.meta.description') %>">
<meta name="description" content="Volunteer activity tracking for CASA volunteers, supervisors, and administrators.">
<meta name="viewport" content="width=device-width,initial-scale=1">

<%= csrf_meta_tags %>
<%= csp_meta_tag %>

<%= og_tag :title, content: translate('page.meta.title') %>
<%= og_tag :description, content: translate('page.meta.description') %>
<%= og_tag :title, content: "CASA Volunteer Tracking" %>
<%= og_tag :description, content: "Volunteer activity tracking for CASA volunteers, supervisors, and administrators." %>
<%= og_tag :url, content: root_url %>
<%= og_tag :image, content: image_url('login.jpg') %>

Expand Down
6 changes: 0 additions & 6 deletions config/locales/controllers.en.yml

This file was deleted.

86 changes: 0 additions & 86 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,29 +30,6 @@
# available at https://guides.rubyonrails.org/i18n.html.

en:
hello: "Hello world"
activerecord:
attributes:
learning_hour:
learning_hour_type: "Type of Learning"
pundit:
default: "Sorry, you are not authorized to perform this action."
casa_case_policy:
new?: "Sorry, you are not authorized to create CASA cases."
case_contact_policy:
edit?: "Sorry, you can only edit case contacts that you have logged."
update?: "Sorry, you can only edit case contacts that you have logged."
forms:
casa_admin:
mark_inactive_warning: "WARNING: Marking an admin inactive will make them unable to login. Are you sure you want to do this?"
supervisor:
mark_inactive_warning: "WARNING: Marking a supervisor inactive will make them unable to login. Are you sure you want to do this?"
volunteer:
mark_inactive_warning: "WARNING: Marking a volunteer inactive will make them unable to login. Are you sure you want to do this?"
page:
meta:
title: CASA Volunteer Tracking
description: Volunteer activity tracking for CASA volunteers, supervisors, and administrators.
time:
formats:
day_and_date: "%A, %d-%b-%Y"
Expand All @@ -62,69 +39,6 @@ en:
youth_date_of_birth: "%B %Y"
short_date: "%-m/%d"
edit_profile: "%B %d, %Y at %I:%M %p %Z"
notifications:
emancipation_checklist_reminder_notification:
title: "Emancipation Checklist Reminder"
message: "Your case %{case_number} is a transition aged youth. We want to make sure that along the way, we’re preparing our youth for emancipation. Make sure to check the emancipation checklist."
followup_resolved_notification:
title: "Followup resolved"
message: "%{created_by_name} resolved a follow up. Click to see more."
followup_notification:
title: "New followup"
message: "%{created_by_name} has flagged a Case Contact that needs follow up."
note: "Note: \"%{note}\""
more_info: "Click to see more."
youth_birthday_notification:
title: "Youth Birthday Notification"
message: "Your youth, case number: %{case_number} has a birthday next month."
button:
delete: Delete
undelete: undelete
edit: Edit
back: Back
submit: Submit
resolve: Resolve Reminder
follow_up: Make Reminder
go_back_to_form: Go Back to Form
continue_submitting: Continue Submitting
close: Close
detail_view: Detail View
common:
yes_text: "Yes"
no_text: "No"
both_text: Both
active: Active
inactive: Inactive
status: Status
day: Day
month: Month
year: Year
none: None
email: Email
name: Name
display_name: Display name
phone_number: Phone number
address: Address
date:
formats:
full: "%B %-d, %Y"
case_contact:
create: Case contact was successfully created.
update: "Case contact created at %{created_at}, was successfully updated."
destroy: Contact is successfully deleted.
restore: Contact is successfully restored.
case_min_validation: At least one case must be selected
thank_you_1: Thanks for all you do!
thank_you_2: Thank you for your hard work!
thank_you_3: Thank you for a job well done!
thank_you_4: Thank you for volunteering!
thank_you_5: Thanks for being a great volunteer!
thank_you_6: One of the greatest gifts you can give is your time!
thank_you_7: Those who can do, do. Those who can do more, volunteer.
thank_you_8: Volunteers do not necessarily have the time, they just have the heart.
communication_preferences:
header: "Communication Preferences"
paragraph: "Tell us how you'd like to receive notifications."
email_me: "Email Me"
text_me: "Text Me"
save_preferences: "Save Preferences"
14 changes: 0 additions & 14 deletions config/locales/models.en.yml

This file was deleted.

Loading

0 comments on commit 2828276

Please sign in to comment.