Adding custom culture to Kentico (standard .NET or non-standard)

Arindam Debnath asked on June 26, 2018 13:52

How to properly add a custom culture to Kentico? It can be either standard .NET culture or custom to support a language in a particular region. For example, Latvian culture exists as a standard culture but how to support Russian language in Latvia if that's the business requirement.

Correct Answer

Arindam Debnath answered on June 26, 2018 14:04

This can be easily done. To add non-existing culture follow the steps below where we'll add Latvian Russian culture to Kentico.

  1. Open Localization app and select Cultures tab.
  2. Create a new Latvian Russian culture with these details: Name: Russian - Latvia, Code: ru-LV, Short name: Russian
  3. Assign to site.

The steps above are minimum you'll need to configure but in Pages app, the culture selector will not show flags, and in Pages listing view, you'll see images for the new culture are not found.

In order to solve this, and to show flags for ru-LV culture, follow the steps below:

  1. Locate Images.zip file within App_Themes/Default/Images. Extract this zip to a local directory.
  2. Go to Flags > 16x16, add a new 16x16 image file called ru-LV.png. In this case I just cloned lv-LV flag.
  3. Do the same for 48x48 directory but with a larger 48x48 size.
  4. Zip up this folder an name it Images.zip.
  5. Preferably rename existing Images.zip to something like Images_OLD.zip to keep a backup. Upload new Images.zip to the same location.
  6. Restart application.

In the content tree you should be able to see flags correctly.

In case you need to display the flag on the main site, you can use the macro below:

<img src="~/CMSPages/GetResource.ashx?image=[Images.zip]/Flags/48x48/{% PreferredCulture @%}.png" />

Hope this helps, and thanks for looking.

0 votesVote for this answer Unmark Correct answer

   Please, sign in to be able to submit a new answer.