Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

315
Views
Rails 7 unable to find localized template when using underscore locale (lang_region)

We are trying to update a Rails 6.1.4 app to the freshly released Rails 7.0.0 version. After following some guides and tweaking our basic configuration the app works just fine.

Our views using localized strings interpolated by the I18n gem work just fine.

But when we try to access our localized templates, those that have a locale variant in it's path like employees.pt_BR.html.erb, we keep getting:

Marketing::LandingsController#employees is missing a template for request formats: text/html

That did not happen in Rails 6.1.4 and we suspect it's due to using a non conventional naming for our locales. We use language_REGION (e.g. pt_BR) instead of the dash and conventional format according to Rails docs which is language-REGION (e.g. pt-BR).

In our application.rb we have:

config.i18n.available_locales = %i[
      es_AR
      es_MX
      es_UY
      es_CL
      es_PE
      es_PY
      es_EC
      es_VE
      es_CO
      es_BO
      pt_BR
      en
      pt
      es
    ]
config.i18n.default_locale = :es_AR

If we change our locales config to the conventional naming format, the localized templates work just fine.

Has rendering localized templates with underscores been deprecated or is this a bug in Rails 7.0.1?

PS: There's an open GH issue in Rails repo (https://github.com/rails/rails/issues/44154).

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

It was a bug and was fixed with a PR we created. Further discussion: github.com/rails/rails/pull/44174

Using Rails 7 from the github repo should solve this

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!