Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

319
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda