Developer forum

Forum » CMS - Standard features » Change language names in language selecter

Change language names in language selecter

Jonas Nielsen
Reply

Hi,

Is there a way to change and translate the names of the languages that apears in the language selecter? 

1) I want to use the local language name. e.g. "Danish" is the same no matter what language I select.
Preferable this should be "Dansk" - show in the native form and not English. 

2) The Spanish language apears like this: "Spanish, International Sort". I would prefer it to just say "Spanish" as the current name is unnecessarily long.

Language_names.jpg

Replies

 
Nicolai Pedersen Dynamicweb Employee
Nicolai Pedersen
Reply

Hi Jonas

Currently you van only change that directly in the template:

\Files\Templates\Designs\Swift\Swift_Preferences.cshtml

There is this line of code in line 254: 

<span class="align-middle">@language.Area.DisplayName</span>

Which can be changed to one fo these:

<span class="align-middle">@language.Area.Name</span>
<span class="align-middle">@language.Area.Title</span>
<span class="align-middle">@language.Area.CultureInfo.NativeName</span>

Using either the name of the website from the backend, the title specified on the website settings or the "Native name" of the region info selected on the website settings.

The last option will give you the name of the country in its native name - and some additiional info. You might be able to do this to get only the name:

<span class="align-middle">@language.Area.CultureInfo.NativeName.Split('(')[0].Trim()</span>

BR Nicolai

 

You must be logged in to post in the forum