Programmatically created pages getting wrong master language in migrated EPiServer environment

I ran in to a problem with my migrated EPiServer 4 website when creating new pages programmatically. The old site was using English as the master language, but my new one would be all in Swedish. I had used the version of the Advanced Language Manipulation Tool that Mari Jørgensen updated to convert my pages, as well as the SQL provided by Dane Richards (comment on the same page) to fix my dynamic properties. All good so far; when creating new pages in the EPiServer Edit mode I would get the proper master language. However, when I came to creating new ones by code, they refused to be Swedish. For some reason, all I got was a bunch of English ones.

I got curious and turned on the globalization interface in episerver.config (uiShowGlobalizationUserInterface=”true”). After refreshing my browser and going into the Language Settings, I noticed that I had no languages available in the Available Languages box.

No Available Languages selected in the EPiServer Edit mode Language Settings

After I had checked the box for Swedish, and saved my changes, I was pleased to see my generated pages being created in the proper language. Apparently EPiServer was feeding me English when there were no languages available. Turning the globalization interface (uiShowGlobalizationUserInterface=”false”) back to false made it seem like nothing had ever happened.

I am anxious to do some Reflectoring on this, but it will have to wait for another time and another post.

Leave a Reply