Friday 13 December 2013

Adding Custom Language Code in Sitecore

Leave a Comment
In my current project, I have got one situation where I have to use Serbian language for one of our sites. On further investigation, I have found that Predefined Language Code for Serbia is not coming up in drop down of Globalization Control Panel in Sitecore.
Thus I have decided to add custom Language-Country Code sr-RS for Serbia. Unfortunately, I was getting below error while adding custom Language-Country Code sr-RS.
“The name “sr-RS” is not a valid or supported culture identifier.”
sr-RS is not a valid Language-Country Code.  Sitecore uses culture mechanisms of the .Net Framework. Following Language-Country Codes are available for Serbia in .Net Framework 4.0:

Language-Country codeCulture
sr Serbian
sr-Cyrl Serbian (Cyrillic)
sr-Cyrl-BA Serbian (Cyrillic, Bosnia and Herzegovina)
sr-Cyrl-CS Serbian (Cyrillic, Serbia and Montenegro (Former))
sr-Cyrl-ME Serbian (Cyrillic, Montenegro)
sr-Cyrl-RS Serbian (Cyrillic, Serbia)
sr-Latn Serbian (Latin)
sr-Latn-BA Serbian (Latin, Bosnia and Herzegovina)
sr-Latn-CS Serbian (Latin, Serbia and Montenegro (Former))
sr-Latn-ME Serbian (Latin, Montenegro)
sr-Latn-RS Serbian (Latin, Serbia)
In my case, sr-Latn-RS is the appropriate Language Country Code for the website. You can add any .Net framework supported Culture Code as per your requirement. Below are the steps of adding custom Language Country Code (sr-Latn-RS) for Serbia in Sitecore:
  1. Login to Sitecore Instance: Desktop Mode.  
  2. Click on Sitecore Menu -> Control Panel -> Globalization -> Add a new language
  3. You’ll get following pop up screen where you can add custom Language Code in Sitecore.
  4. Enter sr in Language textbox and Latn-RS in Country/Region Code textbox. Click on Next.

  5. Add file path of Spellchecker dictionary. This is optional step. You can ignore this step and click on Next without entering Spellchecker file path. You can read more about Adding Dictionaries to the Spellchecker.
  6. Click on Finish.
  7. You can see Sitecore Language Item at /sitecore/system/Languages/sr-Latn-RS path in Sitecore content tree.
You can also try The Language Registration tool which allows to register a language in Sitecore that doesn’t have the corresponding language in .Net Framework. This tool is now available in Sitecore Market place.
Comments and suggestions are most welcome. Happy coding! 


Post a Comment