This project is read-only.

Best place to update WorkContext.CurrentCulture

Topics: Core, Localization, Writing modules, Writing themes
Apr 23, 2014 at 11:36 PM
Edited Apr 23, 2014 at 11:38 PM

I have a multi-tenant site, and i have a lot of rules to determine the language. Right now i am updating the currentCulture in the "builder.Describe("Layout").OnCreated" function using ShapeTableProvider interface. It works fine for everything that is inside the theme, widgets and so on. But if i have an extra module with some views, orchard will do it before calling the 'describe("Layout")' function, so the languages will not match.

I need to know where is the best place to add the logic for WorkContext.CurrentCulture before everything begins!!!

Any clue?
Apr 24, 2014 at 12:13 PM
You shouldn't really set that property but instead write an ICultureSelector implementation. There you can use arbitrary logic to set the current culture.
Apr 24, 2014 at 4:54 PM
mm.. thks, the thing is that i also need to put some data in the layout model depending on the logic for the culture, i would need to put more data than the currentculture in the workcontext.
But, regardings the core of the question, i think thats the right place! the implementation of the ICultureSelector.