Problem with i18n when page is not translated to all target languages
guillerodriguez opened this issue · comments
Expected behavior and actual behavior
I have a Middleman site which is translated to 4 languages: en, es, de, fr. i18n config is as follows:
activate :i18n, :langs => [:en, :es, :de, :fr], :mount_at_root => false
For most pages there is a single source file which lives under source/localizable; i18n-specific strings are translated via the <%= t('key') %>
helper. This works fine.
For some pages, though, there are different language specific versions.
If a language-specific version is available for all languages, then this works fine as well. Let's assume I have:
- source/localizable/test.html.erb
- source/localizable/test.es.html.erb
- source/localizable/test.fr.html.erb
- source/localizable/test.de.html.erb
If I build the site then all works as expected.
However if the language-specific version is missing for some languages, then the "default" version seems to be used for all languages. Let's assume I have:
- source/localizable/test.html.erb
- source/localizable/test.es.html.erb
When I build the site, I see that the default version is used for French and German (good) but also for Spanish (bad)
Not sure if this is related but in the build log I see:
create build/en/test.html
create build/es/test.html
create build/fr/test.html
create build/de/test.html
identical build/es/test.html
The Spanish page is being processed twice -- but both times with the wrong content (the content for the default language).
Steps to reproduce the problem (from a clean middleman installation)
See above.
Additional information
- Ruby version: ruby 2.6.8p205 (2021-07-07 revision 67951) [arm64-darwin20]
- Middleman version: I was using 4.3 but this is also reproducible with 4.4.2
- OS version: macOS BigSur 11.6 with Apple M1
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
@guillerodriguez did you ever figure anything out? We had pages where I18n isn't falling back to using the default translations when they are missing.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Do not close.
@guillerodriguez is this still valid after latest merged pull requests?
hi @guillerodriguez did you have a chance to check it out 🙏🏼? Thank you so much in advance!