I have looked forward to the new propertbag concept in CMS6. I have always wanted a store for different kind of data/settings that are not pages. One area I find troublesome is the language xml files. If you have more than one server you need to copy those files to each of them. And there aint no easy method of say that this text should be changeble based on languages without having to code it inside a xml file.
For those of you that haven't used LangaugeManger a lot it has basically one function Translate(key). If you provide a key (like /search/searchbutton) it will look up in the xml files inside the lang/ folder and find that text in the current Threads language. If the text aint there it will return a error messages.
So on friday when i got a mail with a download link, I started the download right away. But something went wrong with the install procedure or something else, cause my OS crashed and I needed a total reinstall. Finnaly I’m on Windows 7 :)
First I made a small LanguageManagerStore class
that instead of retrieving data from xml files, it uses the DataStore to get the LangaugeItem object
If you want to see how to do it you can check out Ted Nybergs blog post
Then I thought of a lot of different ways of intercept the existing method in EPiServers LangaugeManger, but I am stucked here. if only one of the methods inside that class could be virtual it would have made this code so much better. Then I could have change all places that depends on LangaugeManger and translate (witch is as far as I know every language depended text). So please devs add virtual to methods.
I therefore had to make two base classes(TemplatePage, UserControlBase) that override the Translate method and use my Translate method.
- TranslatePageBase : TemplatePage
- TranslateUserControl:UserControlBase
Then I made Three different ControlAdapters that will change text.
- <episerver:Translate …. />
overrides the Render method and used my Translate method
Then i made 2 other that extend the
And if you add an attribute to a control called translate=”true” it will take the text inside and use that text as a key and also add the text to the data store.

This will render like this
Editing
I then made a small edit page that shows all the keys in all language and display it in a grid.
Download
You can check the code out here
https://www.coderesort.com/svn/epicode/Itera.Language/trunk