Custom language code

Vote:
 

Hello,

We are in need of adding a custom language code to our website. How hard is this to do? 

I am also interested if I can customize which language.xml is loaded when i visit a specific site and a specific URL. Example:

www.mysite.se is created in languagebranch "sv". mysite-SV.xml is loaded. -tag is 070-555-555

www.mysite.se/fi is created in languagebranch "sv". mysite-SV.xml is loaded. -tag is 070-555-555. I would like it to be something else, is this possible, and how can I control this? 

I am aware of how i'd need a unique language code for www.mysite.se/fi in order to access another XML, I was just curious if there was any other way of solving this problem without having to swich to another language code for this specific site or create my own custom language code.

Thanks!

#89717
Aug 22, 2014 16:20
Vote:
 

Hi Robin!

About your first question on custom language codes; not really difficult. We did some adding of Northern Sami and a couple of other unsupported languages in my last project. I assume that the codes do not already appear in EPiServer's website language manager in admin mode, which means that your OS have no support for it yet. Here is a short PowerShell script registering all cultures in the same directory with Windows, after running it you will find that you can add codes in EPi Admin (and yes, I shamelessly nicked some parts of a larger script written by one of my collegues back in the day).

[System.Reflection.Assembly]::Load("sysglobl, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL") | out-null
 
function RegisterCulture([string]$ldml,[string]$culture){
  $builder = [System.Globalization.CultureAndRegionInfoBuilder]::CreateFromLdml((get-item $ldml).FullName)
  $builder.Register()
}

dir *.ldml | %{
  RegisterCulture $_.FullName $_.BaseName
}

There is no error handling as you can see so it will crash if there is something wrong with your files or if the culture already exists, to resolve this you can add try-catch statements and first try to unregister before registering, like so:

[System.Globalization.CultureAndRegionInfoBuilder]::UnRegister($culture)

After this is just a matter of creating a couple of culture LDML files to register. I could see if I can dig up some file example for you should you need one, but I remember they are rather long.

Have a good weekend1

//Mathias

#89722
Aug 23, 2014 9:58
Vote:
 

Mathias: Thanks alot!

#90168
Sep 03, 2014 11:39
Vote:
 

No problem :) //Mathias

#90183
Sep 03, 2014 12:47
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.