Changing The Base Language of an EPiServer CMS 5 Site
The decision was made in 2009 to convert the language branch of all of our web sites from the previously existing /en/ locale to /en-US/. This gives us more flexibility to denote both the language and the region that a particular site is geared towards.
Unfortunately, there is no “clean” or “easy” way to do this in EPiServer CMS 5…but this is how I’ve accomplished this conversion on four separate (and very large) web sites:
Note: This information was gathered through my trial and error process and a wonderful blog post by Fredrik Haglund posted here: http://blog.fredrikhaglund.se/blog/2007/12/04/episerver-globalization-and-dynamic-properties/
Here is how I converted my sites from /en/ to /en-US/
- We’ll be playing with content at the database level today folks, so first I would advise you to backup your entire database (in my instance it’s Oracle but the table names are the same in SQL Server by the way…). When big changes like these happen, I like to work in a different environment than the one people always work in… so I start by copying my database and VPP folders to a different server, set up the site there, and begin the actual conversion…
- I like to lock out all my CMS users through web.config while these changes are being made… change the Allow Users option to an Administrative Group in web.config to do this.
- Enable your new language in EPiServer if it hasn’t been done already. (Admin –> Config –> Manage Web Site Languages)
- Open up your database (newly copied or backed up hopefully) and navigate to the table tblLanguageBranch. Note the PKID of the value you want to change.
- Delete the row of the language you want to change to, in my case, this would be the row with a PKID of 40 and a LanguageID of en-us.
- Note: you should have no primary key constraint violations since you just activated the new language, but if you do.. first go to tblPageLanguageSetting and delete the offending row there (the offending record will have a FKLangaugeBranchID equal to the one you deleted in step 4, in my case, 40). You might have to go through some of the other content tables and delete records - let the primary key violations be your guide here, my sites had no /en-us/ pages to begin with, so I did not have to perform this step.
- Change the LanguageID value of the main base language to the new value. In my case, I changed en to en-US.
- Note: Fredrik’s blog mentions creating a new row and filling it with the content of the old one (His Step 4)..this is not necessary unless you want to reuse the old language, and you can automatically do this if you want just by turning it back on in the Manage Web Site Languages option through Admin Mode.
- Restart EPiServer using iisreset on the machine in question.
- Note: We have a script internally that flushes the app pool cache.. this does NOT work, you have to physically start and stop IIS.
- At this point, you’re basically done with the conversion..but I always have to perform cleanup, as some things won’t always match up exactly.
- Fredrik’s blog mentions checking the LangaugeID value in the tblKeyword, tblPage, tblPageLanguage, tblWorkPage, and tblPageTypeDefault pages to the right value. I have never had to do this in EPiServer CMS 5.
- Dynamic Properties hold their values even if you change the /en-US/ – make sure you go through and reset your Dynamic Properties using the correct language/locale combination through Edit Mode.
- Some page links keep their values – we always go through page by page to make sure all pages link to the correct language and locale.
- After all is said and done, we run our whole site through Xenu’s Link Sleuth program (http://home.snafu.de/tilman/xenulink.html) to check for any links pointing to /en/. This helps a lot to make sure everything looks right.
- Once everything checks out, we move the (now edited) database back into the CMS, allow users to login again through web.config, and away we go…
.
Comments