Our SEO guy asked us to change the Spanish language code from es-MX to es-US for SEO reasons. We currently use the dictionary to handle a lot of translated strings, so it seemed to make the most sense to create es-US as a new language and have it fall back to es-MX (which in turn falls back to English for terms we don't have translated). For some reason, though, the fallback skips right past es-MX and uses the English version. If I create a new version of the dictionary item in the es-US language it works as expected. And, of course, it's been successfully falling back from es-MX to English already.

So far I've:

  1. created the es-US language definition item [Master] System > Languages and set the fallback to es-MX
  2. ensured that both item-level and field-level fallback is enabled in the configs
  3. republished the site
  4. reindexed everything in SOLR

The code simply calls Sitecore.Globalization.Translate.TextByLanguage() and stores the result on the view model, and I've confirmed that it's passing in the expected language code.

What am I missing?

(Sitecore 8.1u3, SOLR 6.1.0)

  • Seems like there is an issue with the cached dictionary file maybe. Try deleting dictionary.dat file from the website/temp folder and clearing the cache if necessary. Any reason you are using TextByLanguage() eather than Sitecore.Globalization.Translate.Text("key") and letting that do it's fallback thing?
    – jammykam
    Jan 20 at 20:35
  • No luck with that, unfortunately. At this point I've tried backing out the changes and I'm still getting English for everything. I'm stumped. As to why we're using TextByLanguage(), it's because in this case the rendering is in Spanish but the rest of the page is English. Jan 21 at 14:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.