umbraco login screen in Dutch
Rating: 3.5 / 5 stars - 4 vote(s).
At the last Benelux umbraco meeting in Ghent, I was wondering if anyone could tell why I always got my login screen in Dutch while I'm on a English version of my operation system. How the hell does umbraco know I'm native Belgian. Well, I've been digging deep into the code for v4 and found the answer. Look further for the answer.
1: protected override void OnPreRender(EventArgs e) { 2: base.OnPreRender(e);
3: Button1.Text = ui.Text("general", "login"); 4: // ...
5: }
Function can be found in the code for the login screen (Obsolete lines removed for clarity). It takes you to the code for translating all language-sensitive info on a page.
1: public static string GetText(string area, string key) { 2: if (string.IsNullOrEmpty(area) || string.IsNullOrEmpty(key))
3: return string.Empty;
4: string language = Thread.CurrentThread.CurrentCulture.TwoLetterISOLanguageName;
5: if (string.IsNullOrEmpty(language))
6: language = umbracoDefaultUILanguage;
7: XmlDocument langFile = getLanguageFile(language);
8: if (langFile != null) { 9: XmlNode node =
10: langFile.SelectSingleNode(string.Format("//area [@alias = '{0}']/key [@alias = '{1}']", area, key)); 11: if (node != null)
12: return xmlHelper.GetNodeValue(node);
13: }
14: return "[" + key + "]";
15:
16: }
I did some debugging and found out that language was set to 'nl'. Aha, but where does it come from then? Well, solution to my question was to investigate all possible settings for the current browser I was using, and strangely enough, only a single language 'Dutch (Belgium) [nl-BE]' was installed as language. Another Aha moment. And the answer to my question. Problem solved. Up to another one... Oh, and btw, problem didn't occur when using FF. Oh yes, FF didn't have the Dutch preferences set. Shame on IE. Hooray for FF.