Skip to content

Replace hard-coded English strings in views with i18n calls#7114

Open
rawOrlando wants to merge 32 commits intomainfrom
i18n-hard-coded-fix
Open

Replace hard-coded English strings in views with i18n calls#7114
rawOrlando wants to merge 32 commits intomainfrom
i18n-hard-coded-fix

Conversation

@rawOrlando
Copy link
Contributor

@rawOrlando rawOrlando commented May 23, 2025

Fixes

Part of #1386

Summary

Replace hard-coded English with I18n calls

Guidance for testing, such as acceptance criteria or new user interface behaviors:

View the affected pages locally

Type of change (for release notes)

notes-minor

Detailed Description

Use i15r and manual modification to remove hard-coded English from our views to have localized translations from I18n show

Changes proposed in this pull request:

Replace hard-coded English with I18n calls

Todo:

Only got through some of the view directories
Views

  • catalog
  • collections
  • hyrax
    • admin
    • base
    • batch_edits
    • batch_select
    • batch_upload
    • citations
    • collections
    • contact_form
    • contact_mailer
    • content_block
    • dashboard
    • despositors
    • embargoes
    • file_sets
    • homepage
    • leases
    • my
    • notification
    • operations
    • pages
    • permissions
    • single_use_links
    • single_use_links_viewer
    • static
    • stats
    • transfers
    • uploads
    • users
  • layouts
  • records
  • shared

Note: Content_block has some hard-coded English that looks like legal terms. Take care with the translation.

  • Translate
    The Instructions to translate require you to get a Google API key. I tried to get one for the Cloud Translation API but was told I would need a credit card and pay. I am not doing that.

@rawOrlando
Copy link
Contributor Author

Putting this down, I will try to do more when time permits.

If someone else picks this up, I found I15r to be quite zealous with what it tries to convert, often converting code. So you will have to babysit the changes it tries to make.

Also squash down the commits before sending this off to a review.

@github-actions
Copy link

github-actions bot commented May 23, 2025

Test Results

    13 files  ±0      13 suites  ±0   2h 54m 20s ⏱️ + 4m 25s
 6 910 tests ±0   6 604 ✅ ±0  306 💤 ±0  0 ❌ ±0 
18 362 runs  ±0  17 861 ✅ ±0  501 💤 ±0  0 ❌ ±0 

Results for commit 243cdde. ± Comparison against base commit 2492884.

This pull request removes 365 and adds 365 tests. Note that renamed tests count towards both.
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to create #<Hyrax::PermissionTemplate:0x00007f0cf3548358>
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to create #<Hyrax::PermissionTemplate:0x00007f2defbef8d8>
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to create #<Hyrax::PermissionTemplate:0x00007f6508bcc810>
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to create #<Hyrax::PermissionTemplateAccess:0x00007f0cf3523990>
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to create #<Hyrax::PermissionTemplateAccess:0x00007f2df8cf0dc8>
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to create #<Hyrax::PermissionTemplateAccess:0x00007f6508b7c090>
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to destroy AdminSet: 3581c853-e7fc-4da2-a733-7366989cbd5b
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to destroy Hyrax::AdministrativeSet: 13f78f3d-57fa-419b-8ac4-f6e169893ec1
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to destroy Hyrax::AdministrativeSet: ecd80b71-c159-4c93-8efe-a0216fee71b3
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to edit AdminSet: b848a679-d568-4b46-af1c-6103930da2b1
…
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to create #<Hyrax::PermissionTemplate:0x00007f25990794d0>
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to create #<Hyrax::PermissionTemplate:0x00007fb7f33f1418>
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to create #<Hyrax::PermissionTemplate:0x00007feb62cd6f40>
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to create #<Hyrax::PermissionTemplateAccess:0x00007f2598fb7f88>
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to create #<Hyrax::PermissionTemplateAccess:0x00007fb7f32b0b58>
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to create #<Hyrax::PermissionTemplateAccess:0x00007feb62cb7460>
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to destroy AdminSet: 672cc5ab-672f-47f5-9ffe-e9c9cdc1932e
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to destroy Hyrax::AdministrativeSet: 1abe6970-e2ca-40ac-ad9d-bc86a50700c0
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to destroy Hyrax::AdministrativeSet: 7f74c285-d894-47c0-aca4-d8bfde4a25b8
spec.abilities.ability_spec ‑ Hyrax::Ability AdminSets and PermissionTemplates a user without edit access is expected not to be able to edit AdminSet: 9f59459a-b319-450c-b925-571afe1b42ce
…

♻️ This comment has been updated with latest results.

@randalldfloyd
Copy link
Contributor

@rawOrlando Wow this is a huge contribution on this issue! If it's okay with you, I'm going to convert this to a draft PR so that everyone knows there's still more to do in both views and the locales. But thanks for the big lift so far!

@randalldfloyd randalldfloyd marked this pull request as draft May 27, 2025 15:13
@rawOrlando
Copy link
Contributor Author

rawOrlando commented Oct 29, 2025

Thought I found a free api to tranlate instead of google translates, libretranslate. but i found out it cost money to use. nope, they tryied to swindled me. You just need to run the service locally

@rawOrlando rawOrlando force-pushed the i18n-hard-coded-fix branch 9 times, most recently from 61080f0 to e2c5193 Compare November 4, 2025 14:45
@rawOrlando
Copy link
Contributor Author

I left these two alone, I think we will need some legal folks to look over any translations of them.
app/views/hyrax/content_blocks/templates/agreement.html.erb
app/views/hyrax/content_blocks/templates/terms.html.erb

@rawOrlando
Copy link
Contributor Author

script used to create translations https://github.com/samvera-labs/translate_missing/tree/main

@rawOrlando rawOrlando marked this pull request as ready for review November 6, 2025 19:50
@rawOrlando
Copy link
Contributor Author

@randalldfloyd, is this GitHub set up so that all the commits will be squashed down to one? Should I clean up my commits?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants