Skip to content

Commit 951382d

Browse files
Revert "FYST-2325-state-names-switching-between-english-and-spanish-upon-refr…"
This reverts commit 433a1a8.
1 parent 433a1a8 commit 951382d

File tree

3 files changed

+17
-52
lines changed

3 files changed

+17
-52
lines changed

app/services/state_file/state_information_service.rb

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,9 @@ class << self
4242
end
4343
end
4444

45-
def state_name(state_code, locale = I18n.locale)
45+
def state_name(state_code)
4646
raise InvalidStateCodeError, state_code unless STATES_INFO.key?(state_code)
47-
I18n.t("state_file.state_information_service.#{state_code}.state_name", locale: locale)
47+
I18n.t("state_file.state_information_service.#{state_code}.state_name")
4848
end
4949

5050
def department_of_taxation(state_code)
@@ -96,11 +96,8 @@ def active_state_codes
9696
@_active_state_codes ||= STATES_INFO.keys.map(&:to_s).freeze
9797
end
9898

99-
def state_code_to_name_map(locale = I18n.locale)
100-
@_state_code_to_name_map ||= {}
101-
@_state_code_to_name_map[locale] ||= active_state_codes.to_h do |state_code|
102-
[state_code, state_name(state_code, locale)]
103-
end.freeze
99+
def state_code_to_name_map
100+
@_state_code_to_name_map ||= active_state_codes.to_h { |state_code, _| [state_code, state_name(state_code)] }.freeze
104101
end
105102

106103
def state_intake_classes

app/views/state_file/state_file_pages/about_page.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
<%= t(".closed_forever_subheader_html", faq_link: state_faq_path(us_state: 'us')) %>
1010
</div>
1111

12-
<%= link_to "https://pya.fileyourstatetaxes.org/#{I18n.locale}/year_select", class: "button button--primary button--home no-external", id: "firstCta", role: "button", style: "display: flex; justify-content: center; align-items: center; text-align: center;" do %>
12+
<%= link_to "https://pya.fileyourstatetaxes.org/#{I18n.locale}/year_select", class: "button button--primary button--home", id: "firstCta", role: "button", style: "display: flex; justify-content: center; align-items: center; text-align: center;" do %>
1313
<%= t(".download_your_return") %>
1414
<% end %>
1515

spec/services/state_file/state_information_service_spec.rb

Lines changed: 12 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -8,60 +8,28 @@
88
end
99

1010
describe ".state_code_to_name_map" do
11-
it "returns a map of all the state codes to state names in English by default" do
12-
I18n.with_locale(:en) do
13-
result = {
14-
"az" => "Arizona",
15-
"md" => "Maryland",
16-
"nc" => "North Carolina",
17-
"nj" => "New Jersey",
18-
"ny" => "New York",
19-
"id" => "Idaho",
20-
}
21-
22-
expect(described_class.state_code_to_name_map).to eq(result)
23-
end
24-
end
25-
26-
it "is locale aware and returns localized state names for the current locale" do
27-
I18n.with_locale(:es) do
28-
result = {
29-
"az" => I18n.t("state_file.state_information_service.az.state_name"),
30-
"md" => I18n.t("state_file.state_information_service.md.state_name"),
31-
"nc" => I18n.t("state_file.state_information_service.nc.state_name"),
32-
"nj" => I18n.t("state_file.state_information_service.nj.state_name"),
33-
"ny" => I18n.t("state_file.state_information_service.ny.state_name"),
34-
"id" => I18n.t("state_file.state_information_service.id.state_name"),
35-
}
36-
37-
expect(described_class.state_code_to_name_map).to eq(result)
38-
end
11+
it "returns a map of all the state codes to state names" do
12+
result = {
13+
"az" => "Arizona",
14+
"md" => "Maryland",
15+
"nc" => "North Carolina",
16+
"nj" => "New Jersey",
17+
"ny" => "New York",
18+
"id" => "Idaho",
19+
}
20+
expect(described_class.state_code_to_name_map).to eq result
3921
end
4022
end
4123

4224
describe ".state_intake_classes" do
4325
it "returns an array of the intake classes" do
44-
expect(described_class.state_intake_classes).to match_array [
45-
StateFileAzIntake,
46-
StateFileIdIntake,
47-
StateFileMdIntake,
48-
StateFileNcIntake,
49-
StateFileNjIntake,
50-
StateFileNyIntake,
51-
]
26+
expect(described_class.state_intake_classes).to match_array [StateFileAzIntake, StateFileIdIntake, StateFileMdIntake, StateFileNcIntake, StateFileNjIntake, StateFileNyIntake]
5227
end
5328
end
5429

5530
describe ".state_intake_class_names" do
5631
it "returns an array of the intake classes as strings" do
57-
expect(described_class.state_intake_class_names).to match_array [
58-
"StateFileAzIntake",
59-
"StateFileIdIntake",
60-
"StateFileMdIntake",
61-
"StateFileNcIntake",
62-
"StateFileNjIntake",
63-
"StateFileNyIntake",
64-
]
32+
expect(described_class.state_intake_class_names).to match_array ["StateFileAzIntake", "StateFileIdIntake", "StateFileMdIntake", "StateFileNcIntake", "StateFileNjIntake", "StateFileNyIntake"]
6533
end
6634
end
6735

0 commit comments

Comments
 (0)