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).
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