This project is read-only.

Orchard 1.4.2 and "Non default Localization" + how to test?

Topics: Customizing Orchard, Localization
Jul 20, 2012 at 1:30 AM
Edited Jul 20, 2012 at 1:44 AM

I believe I have figured out how easy the Localization module is but I believe I'm missing something as it relates to supported languages that are not the default.

In my example I added "es-ES" and modified it to (and my MenuItem.cshtml for my theme to include the menutext in a @T() method....) to translate "Home" into "Casa" (yes I realize a nonsensical example...bare with me)....

I was able to quickly see this translated text when I set the default culture in the settings to "es-ES" and go to the page with the menu item...but that isn't my use case.

My use case is that I want @T() text to be translated if and only if the Language in the header of the persons web browser is set to es-ES...otherwise, the default should still be en-US

I found the option in IE9 and removed english and added global spanish (es-ES) I defaulted the website back to en but assumed that it would still translate. given my browser was sending spanish.

That part didn't work.... =(  

I'm certainly on an English Windows 7 laptop.  I just hope that there is an easy explanation for what I'm doing wrong and hopefully not a fundamental misunderstanding.  I would like this to work for users that are truely on a spanish browser but also would like to ensure I can properly test it prior.

Can anyone please assist on ensuring my understanding is correct and help on how to test?

Jul 20, 2012 at 8:06 AM

I'm not sure if something like that is included in the core, since we custom coded a solution that sets the language based on culture prefix (/en/, /fr/, ...), language cookie (set using a drop down menu) or, as you need, based on the browser' language.

Jul 23, 2012 at 1:16 PM

You need to implement ICultureSelector to do the actual culture switch. The reason why there is no implementation of that out of the box (but there are a few on the gallery) is that there are many legitimate and different ways to switch the culture. We refused to pick one, preferring to leave the choice open.

Jul 24, 2012 at 12:20 AM

Hi guys, I should have clarified that I understand 100% that this would be a module.  What I was asking rather is whether a module already does this?  That is, detect the default laungage of the browser and auto transfer them.  Basically this module but instead of a pull down, it would detect the browser:

Jul 24, 2012 at 1:00 AM

I don't know, but it would be trivial to implement.