Multi-lingual site but current culture is always en-GB
I've setup a multi-lingual site in Umbraco 4.9 and set the hostnames to the respective languages. Everything works as expected in our development environment using IIS 8.0.
However the staging environment is using IIS 6.0, and using System.Threading.Thread.CurrentThread.CurrentCulture I can see that the current culture is always set to en-GB.
What is your site structure setup like? And what does the <useDomainPrefixes> look like in the /config/umbracoSettings.config file look like? Does it differ from local to live?
Content - GB : Domain: domain.com, Language: English (United Kingdom) - FR : Domain: domain.com/fr, Language: French (France) - DE : Domain: domain.com/de, Language: German (Germany) - IT : Domain: domain.com/it, Language: Italian (Italy) - ES : Domain: domain.com/es, Language: Spanish (Spain) - CN : Domain: domain.com/zh, Language: Chinese (Simplified, PRC)
And what does the <useDomainPrefixes> look like in the /config/umbracoSettings.config file look like? Does it differ from local to live?
/config/umbracoSettings.config is the same for both local and live
<useDomainPrefixes>false</useDomainPrefixes>
I maybe clutching at straws here, but do you know if it is possible to override the CurrentCulture settings? Maybe hooking into Application_Start with something like the following
protected override void Application_Start(object sender, EventArgs e) { base.Application_Start(sender, e); // Insert your startup logic here }
Hmm, ok...I'm afraid that I have no clue about this one. Don't know if it's perhaps possible to tweak some web.config settings to get it working perhaps.
Sorry, I don't know if it's possible. But I guess it can't hurt to try :)
Btw...you should consider setting the useDomainPrefixes to true, since you can otherwise risk to have duplicate content issues.
Btw...you should consider setting the useDomainPrefixes to true, since you can otherwise risk to have duplicate content issues.
Appreciate your help Jan. I'll set useDomainPrefixes to true.
Solution
I decided upon coding my own GetDictionaryItem XSLT extension. I created a new class in App_Code as follows
using System; using System.Collections.Generic; using System.Linq; using System.Web; using umbraco; using umbraco.NodeFactory;
namespace Custom { [XsltExtension] public class Helpers { public Helpers() { } public static string GetDictionaryItem(string item) { var result = ""; var domains = umbraco.library.GetCurrentDomains(Node.getCurrentNodeId()); if (domains != null && domains.Length > 0) { var languageId = domains[0].Language.id; var cultureAlias = domains[0].Language.CultureAlias; result = new umbraco.cms.businesslogic.Dictionary.DictionaryItem(item).Value(languageId); } return result; } } }
Then in any XSLT file where I've used umbraco.library:GetDictionaryItem, I've replaced that with my custom extension Custom.Helpers:GetDictionaryItem.
Multi-lingual site but current culture is always en-GB
I've setup a multi-lingual site in Umbraco 4.9 and set the hostnames to the respective languages. Everything works as expected in our development environment using IIS 8.0.
However the staging environment is using IIS 6.0, and using System.Threading.Thread.CurrentThread.CurrentCulture I can see that the current culture is always set to en-GB.
Any ideas on how to resolve this issue?
Hi Sean
Is there any possibility of upgrading the webserver? Not sure why it acts differently on your staging environment though.
Have you checked that hostnames have been setup correctly on the staging environment?
/Jan
Is there any possibility of upgrading the webserver? Not sure why it acts differently on your staging environment though.
Would love to upgrade the server. Unfortunately it is not our server so we don't have any control over that.
Have you checked that hostnames have been setup correctly on the staging environment?
I've double checked ... triple checked them and as far as I know they are setup correctly.
Hi Sean
Ok, then that's not an option.
What is your site structure setup like? And what does the
<useDomainPrefixes>
look like in the /config/umbracoSettings.config file look like? Does it differ from local to live?/Jan
What is your site structure setup like?
Content
- GB : Domain: domain.com, Language: English (United Kingdom)
- FR : Domain: domain.com/fr, Language: French (France)
- DE : Domain: domain.com/de, Language: German (Germany)
- IT : Domain: domain.com/it, Language: Italian (Italy)
- ES : Domain: domain.com/es, Language: Spanish (Spain)
- CN : Domain: domain.com/zh, Language: Chinese (Simplified, PRC)
And what does the
<useDomainPrefixes>
look like in the /config/umbracoSettings.config file look like? Does it differ from local to live?/config/umbracoSettings.config is the same for both local and live
<useDomainPrefixes>false</useDomainPrefixes>
I maybe clutching at straws here, but do you know if it is possible to override the CurrentCulture settings? Maybe hooking into Application_Start with something like the following
Keeping my fingers crossed
Hi Sean
Hmm, ok...I'm afraid that I have no clue about this one. Don't know if it's perhaps possible to tweak some web.config settings to get it working perhaps.
Sorry, I don't know if it's possible. But I guess it can't hurt to try :)
Btw...you should consider setting the useDomainPrefixes to true, since you can otherwise risk to have duplicate content issues.
/Jan
Btw...you should consider setting the useDomainPrefixes to true, since you can otherwise risk to have duplicate content issues.
Appreciate your help Jan. I'll set useDomainPrefixes to true.
Solution
I decided upon coding my own GetDictionaryItem XSLT extension. I created a new class in App_Code as follows
Then in any XSLT file where I've used umbraco.library:GetDictionaryItem, I've replaced that with my custom extension Custom.Helpers:GetDictionaryItem.
Not sure why umbraco.library:GetDictionaryItem isn't working as expected but the custom extension does the job.
is working on a reply...