This project is read-only.

System.Globalization.CultureInfo and N2.Engine.Globalization.ILanguage

Topics: Developer Forum
Oct 25, 2008 at 9:20 AM
Hi Christian

I've noticed that on the CultureInfo that we get from System.Globalization.CultureInfo and the info that we get from N2.Engine.Globalization.ILanguage is different.
My expectations were that when I have globalized the site the pages will be driven by the selected language and culture so I can freely use DateTime.Now.ToShortDateString() for example to format the dates.
In the moment I am getting the following from System.Globalization.CultureInfo

CurrentCulture: {sv-SE}
CurrentUICulture: {en-US}
InstalledUICulture: {en-US}

and this from Engine.Resolve<N2.Engine.Globalization.ILanguageGateway>().GetLanguage(CurrentPage)

FlagUrl: "~/Edit/Globalization/flags/MK.png"
LanguageCode: "mk-MK"
LanguageTitle: "Macedonian"

Is there some kind of workaround to acomplish in the example above, to have the CurentCulture equals {mk-MK} if the LanguageRoot is Macedonian?

Nov 1, 2008 at 6:16 PM
I thought it worked like that. I'll check it out. You could go into the master page and reset the thread culture from there.
Nov 2, 2008 at 8:37 PM
Hi Christian

That is exactly what I did afterwards... but it will be great if it works automaticaly when choosing the language for the site...

Thanks anyway...and one more time N2 ROCKS!!!
Nov 3, 2008 at 8:54 PM
Hi again, in the templates this code is executed at each request. Are you building your own globalization?
Nov 4, 2008 at 7:14 AM
Yes I am buliding my own globalization... for some tips and tricks I am refering to your templates project and stealing some code which I assume is OK?