Skip to content

Commit 388ea4e

Browse files
committed
Add Welsh About us text for non-ministerial departments
Welsh organisation pages of non-ministerial departments now render "Adran anweinidogol yw'r X" instead of falling back to English. Other organisation types continue to render in English until their sentence templates are confirmed by a translator.
1 parent 4efca01 commit 388ea4e

2 files changed

Lines changed: 41 additions & 0 deletions

File tree

config/locales/cy.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,10 @@ cy:
3737
jobs: Swyddi
3838
jobs_and_contacts: Swyddi a chontractau
3939
organisation_chart: Ein siart sefydliadol
40+
relationship:
41+
type_only_html: "%{type_name} yw'r %{name}."
42+
type:
43+
non_ministerial_department: Adran anweinidogol
4044
worldwide_organisation:
4145
corporate_information:
4246
about_our_services_html: Darganfod %{link}.

test/unit/app/helpers/organisation_helper_test.rb

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,4 +177,41 @@ def assert_display_name_text(organisation, expected_text)
177177
description = organisation_display_name_including_parental_and_child_relationships(org)
178178
assert_equal "TO works with the Department of Testing and is supported by 2 agencies and public bodies.", strip_html_tags(description)
179179
end
180+
181+
test "non-ministerial department renders Welsh identification sentence" do
182+
org = create(:organisation, acronym: "CC", name: "Comisiwn Elusennau", organisation_type: OrganisationType.non_ministerial_department)
183+
184+
I18n.with_locale(:cy) do
185+
assert_display_name_text org, "Adran anweinidogol yw'r CC."
186+
end
187+
end
188+
189+
test "non-ministerial department with parents renders Welsh identification sentence" do
190+
parent = create(:ministerial_department, name: "Department of Testing")
191+
org = create(:organisation, acronym: "CC", name: "Comisiwn Elusennau", organisation_type: OrganisationType.non_ministerial_department, parent_organisations: [parent])
192+
193+
I18n.with_locale(:cy) do
194+
assert_display_name_text org, "Adran anweinidogol yw'r CC."
195+
end
196+
end
197+
198+
test "non-ministerial department with supporting bodies renders mixed Welsh/English sentence in Welsh" do
199+
child = create(:organisation, acronym: "CO", name: "Child Organisation One")
200+
org = create(:organisation, acronym: "CC", name: "Comisiwn Elusennau", organisation_type: OrganisationType.non_ministerial_department)
201+
org.stubs(:supporting_bodies).returns([child])
202+
203+
I18n.with_locale(:cy) do
204+
description = organisation_display_name_including_parental_and_child_relationships(org)
205+
assert_equal "Adran anweinidogol yw'r CC, supported by 1 public body.", strip_html_tags(description)
206+
end
207+
end
208+
209+
test "non-Welsh-translated type falls back to English in Welsh locale" do
210+
parent = create(:ministerial_department, name: "Department of Testing")
211+
org = create(:organisation, acronym: "EA", name: "Executive Agency Example", organisation_type: OrganisationType.executive_agency, parent_organisations: [parent])
212+
213+
I18n.with_locale(:cy) do
214+
assert_display_name_text org, "EA is an executive agency, sponsored by the Department of Testing."
215+
end
216+
end
180217
end

0 commit comments

Comments
 (0)