middleman icon indicating copy to clipboard operation
middleman copied to clipboard

Problem with i18n when page is not translated to all target languages

Open guillerodriguez opened this issue 4 years ago • 8 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

guillerodriguez avatar Jan 28 '22 10:01 guillerodriguez

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.

stale[bot] avatar Apr 28 '22 10:04 stale[bot]

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

jclusso avatar May 23 '22 17:05 jclusso

No, unfortunately never managed to figure out what’s wrong..

El lunes, 23 de mayo de 2022, Jarrett Lusso @.***> escribió:

@guillerodriguez https://github.com/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.

— Reply to this email directly, view it on GitHub https://github.com/middleman/middleman/issues/2529#issuecomment-1134972853, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAS67KGZ4D3K5Q2CELMHOWLVLPBJNANCNFSM5NAKXHKQ . You are receiving this because you were mentioned.Message ID: @.***>

-- Guillermo Rodriguez Garcia @.***

guillerodriguez avatar Jun 02 '22 08:06 guillerodriguez

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.

stale[bot] avatar Aug 31 '22 10:08 stale[bot]

Do not close.

guillerodriguez avatar Aug 31 '22 11:08 guillerodriguez

@guillerodriguez is this still valid after latest merged pull requests?

markets avatar Feb 07 '23 00:02 markets

hi @guillerodriguez did you have a chance to check it out 🙏🏼? Thank you so much in advance!

markets avatar Feb 15 '23 23:02 markets