Reputation: 2014
I have a webforms website that needs to be set either to danish (DK) or swedish (SE) language depending on the domain (.se/.dk). Theres both some global and local resources. Mostly local. The language needs to be set once, global for the entire application, once the clients lands on the page (session start). The auto settings in web.config will not be sufficient, cause some of the users will have english settings on their browsers, launching the default resources (which is danish). Not optimal if youre a swedish user with english settings.
If i run an overrided method of InitializeCulture()
on for example default.aspx
and ask for host/domain and set the langauge from that, the culture will be reset to the default resources as soon as I leave the default page. Setting the culture in Session_Start
in global.asax
will do the same thing. Works on landing page, resets on sub page.
Whats the right way to do this?
I guess the question comes down to: Do I really have to call InitializeCulture()
on every single page?
Upvotes: 1
Views: 466
Reputation: 2014
Apparently yes - I have to call InitializeCulture on every single page:
InitializeCulture() on every single page necessary?
Upvotes: 1