Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

316
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda