1

I'm using a vanilla Sitecore 82u6.

When checking the .showconfig.aspx page I realized that the default language name is:

<setting name="ClientLanguage" value="en" patch:source="Sitecore.DefaultLanguage.config"/>

On the Sitecore.Globalization.LanguageDefinition class, the name property is defined by the following logic:

this._name = id + (!string.IsNullOrEmpty(this._region) ? "-" + region : string.Empty);

But if we look at the LanguageDefinitions list on the same page, we can't find a language with this name

<languageDefinitions>
<languages>
<language id="af" region="ZA" codepage="65001" encoding="utf-8" charset="iso-8859-1" icon="flags/16x16/flag_South_Africa.PNG"/>
<language id="ar" region="AE" codepage="65001" encoding="utf-8" charset="windows-1256" icon="flags/16x16/flag_united_arab_emirates.png"/>
<language id="ar" region="BH" codepage="65001" encoding="utf-8" charset="windows-1256" icon="flags/16x16/flag_Bahrain.PNG"/>
<language id="ar" region="DZ" codepage="65001" encoding="utf-8" charset="windows-1256" icon="flags/16x16/flag_Algeria.PNG"/>
<language id="ar" region="EG" codepage="65001" encoding="utf-8" charset="windows-1256" icon="flags/16x16/flag_Egypt.PNG"/>
<language id="ar" region="IQ" codepage="65001" encoding="utf-8" charset="windows-1256" icon="flags/16x16/flag_Iraq.PNG"/>
<language id="ar" region="JO" codepage="65001" encoding="utf-8" charset="windows-1256" icon="flags/16x16/flag_Jordan.PNG"/>
<language id="ar" region="KW" codepage="65001" encoding="utf-8" charset="windows-1256" icon="flags/16x16/flag_Kuwait.PNG"/>
<language id="ar" region="LB" codepage="65001" encoding="utf-8" charset="windows-1256" icon="flags/16x16/flag_Lebanon.PNG"/>
<language id="ar" region="LY" codepage="65001" encoding="utf-8" charset="windows-1256" icon="flags/16x16/flag_Libya.PNG"/>
<language id="ar" region="MA" codepage="65001" encoding="utf-8" charset="windows-1256" icon="flags/16x16/flag_Morocco.PNG"/>
<language id="ar" region="OM" codepage="65001" encoding="utf-8" charset="windows-1256" icon="flags/16x16/flag_Oman.PNG"/>
<language id="ar" region="QA" codepage="65001" encoding="utf-8" charset="windows-1256" icon="flags/16x16/flag_Qatar.PNG"/>
<language id="ar" region="SA" codepage="65001" encoding="utf-8" charset="windows-1256" icon="flags/16x16/flag_Saudi_Arabia.PNG"/>
<language id="ar" region="SY" codepage="65001" encoding="utf-8" charset="windows-1256" icon="flags/16x16/flag_Syria.PNG"/>
<language id="ar" region="TN" codepage="65001" encoding="utf-8" charset="windows-1256" icon="flags/16x16/flag_Tunisia.PNG"/>
<language id="ar" region="YE" codepage="65001" encoding="utf-8" charset="windows-1256" icon="flags/16x16/flag_Yemen.PNG"/>
<language id="be" region="BY" codepage="65001" encoding="utf-8" charset="koi8-r" icon="flags/16x16/flag_Belarus.PNG"/>
<language id="bg" region="BG" codepage="65001" encoding="utf-8" charset="koi8-r" icon="flags/16x16/flag_Bulgaria.PNG"/>
<language id="ca" region="ES" codepage="65001" encoding="utf-8" charset="iso-8859-1" icon="flags/16x16/flag_Spain.PNG"/>
<language id="cs" region="CZ" codepage="65001" encoding="utf-8" charset="iso-8859-2" icon="flags/16x16/flag_Czech_Republic.PNG"/>
<language id="da" region="" codepage="65001" encoding="utf-8" charset="iso-8859-1" icon="flags/16x16/flag_Denmark.PNG" spellchecker="da-DK.tdf"/>
<language id="de" region="AT" codepage="65001" encoding="utf-8" charset="iso-8859-1" icon="flags/16x16/flag_Austria.PNG"/>
<language id="de" region="CH" codepage="65001" encoding="utf-8" charset="iso-8859-1" icon="flags/16x16/flag_Switzerland.PNG"/>
<language id="de" region="DE" codepage="65001" encoding="utf-8" charset="iso-8859-1" icon="flags/16x16/flag_Germany.PNG" spellchecker="de-DE.tdf"/>
<language id="de" region="LI" codepage="65001" encoding="utf-8" charset="iso-8859-1" icon="flags/16x16/flag_Liechtenstein.PNG"/>
<language id="de" region="LU" codepage="65001" encoding="utf-8" charset="iso-8859-1" icon="flags/16x16/flag_Luxembourg.PNG"/>
<language id="el" region="GR" codepage="65001" encoding="utf-8" charset="iso-8859-7" icon="flags/16x16/flag_Greece.PNG"/>
<language id="en" region="AU" codepage="65001" encoding="utf-8" charset="iso-8859-1" icon="flags/16x16/flag_Australia.PNG"/>
<language id="en" region="BZ" codepage="65001" encoding="utf-8" charset="iso-8859-1" icon="flags/16x16/flag_Belize.PNG"/>
<language id="en" region="CA" codepage="65001" encoding="utf-8" charset="iso-8859-1" icon="flags/16x16/flag_Canada.PNG"/>
<language id="en" region="GB" codepage="65001" encoding="utf-8" charset="iso-8859-1" icon="flags/16x16/flag_great_britain.png" spellchecker="en-GB.tdf"/>
<language id="en" region="IE" codepage="65001" encoding="utf-8" charset="iso-8859-1" icon="flags/16x16/flag_Ireland.PNG"/>
<language id="en" region="JM" codepage="65001" encoding="utf-8" charset="iso-8859-1" icon="flags/16x16/flag_Jamaica.PNG"/>
<language id="en" region="NZ" codepage="65001" encoding="utf-8" charset="iso-8859-1" icon="flags/16x16/flag_New_Zealand.PNG"/>
<language id="en" region="PH" codepage="65001" encoding="utf-8" charset="iso-8859-1" icon="flags/16x16/flag_philippines.png"/>
<language id="en" region="TT" codepage="65001" encoding="utf-8" charset="iso-8859-1" icon="flags/16x16/flag_Trinidad_and_Tobago.PNG"/>
<language id="en" region="US" codepage="65001" encoding="utf-8" charset="iso-8859-1" icon="flags/16x16/flag_USA.PNG" spellchecker="en-US.tdf"/>
<language id="en" region="ZA" codepage="65001" encoding="utf-8" charset="iso-8859-1" icon="flags/16x16/flag_South_Africa.PNG"/>
<language id="en" region="ZW" codepage="65001" encoding="utf-8" charset="iso-8859-1" icon="flags/16x16/flag_Zimbabwe.PNG"/>
<language id="es" region="AR" codepage="65001" encoding="utf-8" charset="windows-1256" icon="flags/16x16/flag_Argentina.PNG"/>
<language id="es" region="BO" codepage="65001" encoding="utf-8" charset="iso-8859-1" icon="flags/16x16/flag_Bolivia.PNG"/>
<language id="es" region="CL" codepage="65001" encoding="utf-8" charset="iso-8859-1" icon="flags/16x16/flag_Chile.PNG"/>
<language id="es" region="CO" codepage="65001" encoding="utf-8" charset="iso-8859-1" icon="flags/16x16/flag_Colombia.PNG"/>
<language id="es" region="CR" codepage="65001" encoding="utf-8" charset="iso-8859-1" icon="flags/16x16/flag_Costa_Rica.PNG"/>
<language id="es" region="DO" codepage="65001" encoding="utf-8" charset="iso-8859-1" icon="flags/16x16/flag_Dominican_Republic.PNG"/>
<language id="es" region="EC" codepage="65001" encoding="utf-8" charset="iso-8859-1" icon="flags/16x16/flag_equador.png"/>
<language id="es" region="ES" codepage="65001" encoding="utf-8" charset="iso-8859-1" icon="flags/16x16/flag_Spain.PNG" spellchecker="es-ES.tdf"/>
<language id="es" region="GT" codepage="65001" encoding="utf-8" charset="iso-8859-1" icon="flags/16x16/flag_Guatemala.PNG"/>
<language id="es" region="HN" codepage="65001" encoding="utf-8" charset="iso-8859-1" icon="flags/16x16/flag_Honduras.PNG"/>
<language id="es" region="MX" codepage="65001" encoding="utf-8" charset="iso-8859-1" icon="flags/16x16/flag_Mexico.PNG"/>
<language id="es" region="NI" codepage="65001" encoding="utf-8" charset="iso-8859-1" icon="flags/16x16/flag_Nicaragua.PNG"/>
<language id="es" region="PA" codepage="65001" encoding="utf-8" charset="iso-8859-1" icon="flags/16x16/flag_Panama.PNG"/>
<language id="es" region="PE" codepage="65001" encoding="utf-8" charset="iso-8859-1" icon="flags/16x16/flag_Peru.PNG"/>
<language id="es" region="PR" codepage="65001" encoding="utf-8" charset="iso-8859-1" icon="flags/16x16/flag_Puerto_Rico.PNG"/>
<language id="es" region="PY" codepage="65001" encoding="utf-8" charset="iso-8859-1" icon="flags/16x16/flag_Paraquay.PNG"/>
<language id="es" region="SV" codepage="65001" encoding="utf-8" charset="iso-8859-1" icon="flags/16x16/flag_El_Salvador.PNG"/>
<language id="es" region="UY" codepage="65001" encoding="utf-8" charset="iso-8859-1" icon="flags/16x16/flag_Uruquay.PNG"/>
<language id="es" region="VE" codepage="65001" encoding="utf-8" charset="iso-8859-1" icon="flags/16x16/flag_Venezuela.PNG"/>
<language id="et" region="EE" codepage="65001" encoding="utf-8" charset="windows-1257" icon="flags/16x16/flag_Estonia.PNG"/>
<language id="eu" region="ES" codepage="65001" encoding="utf-8" charset="iso-8859-1" icon="flags/16x16/flag_Spain.PNG"/>
<language id="fa" region="IR" codepage="65001" encoding="utf-8" charset="windows-1256" icon="flags/16x16/flag_Iran.PNG"/>
<language id="fi" region="FI" codepage="65001" encoding="utf-8" charset="iso-8859-1" icon="flags/16x16/flag_Finland.PNG"/>
<language id="fo" region="FO" codepage="65001" encoding="utf-8" charset="iso-8859-1" icon="flags/16x16/flag_Faroe_Islands.PNG"/>
<language id="fr" region="BE" codepage="65001" encoding="utf-8" charset="iso-8859-1" icon="flags/16x16/flag_Belgium.PNG"/>
<language id="fr" region="CA" codepage="65001" encoding="utf-8" charset="iso-8859-1" icon="flags/16x16/flag_Canada.PNG"/>
<language id="fr" region="CH" codepage="65001" encoding="utf-8" charset="iso-8859-1" icon="flags/16x16/flag_Switzerland.PNG"/>
<language id="fr" region="FR" codepage="65001" encoding="utf-8" charset="iso-8859-1" icon="flags/16x16/flag_France.PNG" spellchecker="fr-FR.tdf"/>
<language id="fr" region="LU" codepage="65001" encoding="utf-8" charset="iso-8859-1" icon="flags/16x16/flag_Luxembourg.PNG"/>
<language id="fr" region="MC" codepage="65001" encoding="utf-8" charset="iso-8859-1" icon="flags/16x16/flag_monaco.png"/>
<language id="gl" region="ES" codepage="65001" encoding="utf-8" charset="iso-8859-1" icon="flags/16x16/flag_Spain.PNG"/>
<language id="gu" region="IN" codepage="65001" encoding="utf-8" charset="koi8-r" icon="flags/16x16/flag_India.PNG"/>
<language id="he" region="IL" codepage="65001" encoding="utf-8" charset="windows-1255" icon="flags/16x16/flag_Israel.PNG"/>
<language id="hi" region="IN" codepage="65001" encoding="utf-8" charset="koi8-r" icon="flags/16x16/flag_India.PNG"/>
<language id="hr" region="BA" codepage="65001" encoding="utf-8" charset="iso-8859-2" icon="flags/16x16/flag_Bosnia_and_Herzegovina.PNG"/>
<language id="hr" region="HR" codepage="65001" encoding="utf-8" charset="iso-8859-2" icon="flags/16x16/flag_Croatia.PNG"/>
<language id="hu" region="HU" codepage="65001" encoding="utf-8" charset="iso-8859-2" icon="flags/16x16/flag_Hungary.PNG"/>
<language id="hy" region="AM" codepage="65001" encoding="utf-8" charset="koi8-r" icon="flags/16x16/flag_Armenia.PNG"/>
<language id="id" region="ID" codepage="65001" encoding="utf-8" charset="iso-8859-1" icon="flags/16x16/flag_Indonesia.PNG"/>
<language id="is" region="IS" codepage="65001" encoding="utf-8" charset="iso-8859-1" icon="flags/16x16/flag_Iceland.PNG"/>
<language id="it" region="CH" codepage="65001" encoding="utf-8" charset="iso-8859-1" icon="flags/16x16/flag_Switzerland.PNG"/>
<language id="it" region="IT" codepage="65001" encoding="utf-8" charset="iso-8859-1" icon="flags/16x16/flag_Italy.PNG" spellchecker="it-IT.tdf"/>
<language id="ja" region="JP" codepage="65001" encoding="utf-8" charset="iso-2022-jp" icon="flags/16x16/flag_Japan.PNG"/>
<language id="ka" region="GE" codepage="65001" encoding="utf-8" charset="koi8-r" icon="flags/16x16/flag_Georgia.PNG"/>
<language id="kk" region="KZ" codepage="65001" encoding="utf-8" charset="koi8-r" icon="flags/16x16/flag_Kazakhstan.PNG"/>
<language id="kn" region="IN" codepage="65001" encoding="utf-8" charset="koi8-r" icon="flags/16x16/flag_India.PNG"/>
<language id="ko" region="KR" codepage="65001" encoding="utf-8" charset="ks_c_5601-1987" icon="flags/16x16/flag_south_korea.png"/>
<language id="ky" region="KG" codepage="65001" encoding="utf-8" charset="koi8-r" icon="flags/16x16/flag_Kyrgyzstan.PNG"/>
<language id="lt" region="LT" codepage="65001" encoding="utf-8" charset="windows-1257" icon="flags/16x16/flag_Lithuania.PNG"/>
<language id="lv" region="LV" codepage="65001" encoding="utf-8" charset="windows-1257" icon="flags/16x16/flag_Latvia.PNG"/>
<language id="mi" region="NZ" codepage="65001" encoding="utf-8" charset="koi8-r" icon="flags/16x16/flag_New_Zealand.PNG"/>
<language id="mk" region="MK" codepage="65001" encoding="utf-8" charset="koi8-r" icon="flags/16x16/flag_Macedonia.PNG"/>
<language id="mn" region="MN" codepage="65001" encoding="utf-8" charset="koi8-r" icon="flags/16x16/flag_Mongolia.PNG"/>
<language id="mr" region="IN" codepage="65001" encoding="utf-8" charset="koi8-r" icon="flags/16x16/flag_India.PNG"/>
<language id="ms" region="BN" codepage="65001" encoding="utf-8" charset="iso-8859-1" icon="flags/16x16/flag_brunei.png "/>
<language id="ms" region="MY" codepage="65001" encoding="utf-8" charset="iso-8859-1" icon="flags/16x16/flag_Malaysia.PNG"/>
<language id="mt" region="MT" codepage="65001" encoding="utf-8" charset="koi8-r" icon="flags/16x16/flag_Malta.PNG"/>
<language id="nb" region="NO" codepage="65001" encoding="utf-8" charset="iso-8859-1" icon="flags/16x16/flag_Norway.PNG"/>
<language id="nl" region="BE" codepage="65001" encoding="utf-8" charset="iso-8859-1" icon="flags/16x16/flag_Belgium.PNG"/>
<language id="nl" region="NL" codepage="65001" encoding="utf-8" charset="iso-8859-1" icon="flags/16x16/flag_Netherlands.PNG"/>
<language id="nn" region="NO" codepage="65001" encoding="utf-8" charset="iso-8859-1" icon="flags/16x16/flag_Norway.PNG"/>
<language id="pa" region="IN" codepage="65001" encoding="utf-8" charset="koi8-r" icon="flags/16x16/flag_India.PNG"/>
<language id="pl" region="PL" codepage="65001" encoding="utf-8" charset="iso-8859-2" icon="flags/16x16/flag_Poland.PNG"/>
<language id="pt" region="BR" codepage="65001" encoding="utf-8" charset="iso-8859-1" icon="flags/16x16/flag_Brazil.PNG"/>
<language id="pt" region="PT" codepage="65001" encoding="utf-8" charset="iso-8859-1" icon="flags/16x16/flag_Portugal.PNG"/>
<language id="ro" region="RO" codepage="65001" encoding="utf-8" charset="iso-8859-2" icon="flags/16x16/flag_Romania.PNG"/>
<language id="ru" region="RU" codepage="65001" encoding="utf-8" charset="koi8-r" icon="flags/16x16/flag_Russia.PNG"/>
<language id="sa" region="IN" codepage="65001" encoding="utf-8" charset="koi8-r" icon="flags/16x16/flag_India.PNG"/>
<language id="se" region="FI" codepage="65001" encoding="utf-8" charset="iso-8859-1" icon="flags/16x16/flag_Finland.PNG"/>
<language id="se" region="NO" codepage="65001" encoding="utf-8" charset="iso-8859-1" icon="flags/16x16/flag_Norway.PNG"/>
<language id="se" region="SE" codepage="65001" encoding="utf-8" charset="iso-8859-1" icon="flags/16x16/flag_Sweden.PNG"/>
<language id="sk" region="SK" codepage="65001" encoding="utf-8" charset="iso-8859-2" icon="flags/16x16/flag_Slovakia.PNG"/>
<language id="sl" region="SI" codepage="65001" encoding="utf-8" charset="iso-8859-2" icon="flags/16x16/flag_Slovenia.PNG"/>
<language id="sq" region="AL" codepage="65001" encoding="utf-8" charset="iso-8859-2" icon="flags/16x16/flag_Albania.PNG"/>
<language id="sv" region="FI" codepage="65001" encoding="utf-8" charset="iso-8859-1" icon="flags/16x16/flag_Finland.PNG"/>
<language id="sv" region="SE" codepage="65001" encoding="utf-8" charset="iso-8859-1" icon="flags/16x16/flag_Sweden.PNG"/>
<language id="sw" region="KE" codepage="65001" encoding="utf-8" charset="iso-8859-1" icon="flags/16x16/flag_Kenya.PNG"/>
<language id="ta" region="IN" codepage="65001" encoding="utf-8" charset="koi8-r" icon="flags/16x16/flag_India.PNG"/>
<language id="te" region="IN" codepage="65001" encoding="utf-8" charset="koi8-r" icon="flags/16x16/flag_India.PNG"/>
<language id="th" region="TH" codepage="65001" encoding="utf-8" charset="windows-874" icon="flags/16x16/flag_Thailand.PNG"/>
<language id="tn" region="ZA" codepage="65001" encoding="utf-8" charset="iso-8859-1" icon="flags/16x16/flag_South_Africa.PNG"/>
<language id="tr" region="TR" codepage="65001" encoding="utf-8" charset="iso-8859-9" icon="flags/16x16/flag_Turkey.PNG"/>
<language id="tt" region="RU" codepage="65001" encoding="utf-8" charset="koi8-r" icon="flags/16x16/flag_Russia.PNG"/>
<language id="uk" region="UA" codepage="65001" encoding="utf-8" charset="koi8-r" icon="flags/16x16/flag_Ukraine.PNG"/>
<language id="ur" region="PK" codepage="65001" encoding="utf-8" charset="windows-1256" icon="flags/16x16/flag_pakistan.png "/>
<language id="vi" region="VN" codepage="65001" encoding="utf-8" charset="windows-1258" icon="flags/16x16/flag_Vietnam.PNG"/>
<language id="xh" region="ZA" codepage="65001" encoding="utf-8" charset="iso-8859-1" icon="flags/16x16/flag_South_Africa.PNG"/>
<language id="zh" region="CN" codepage="65001" encoding="utf-8" charset="gb2312" icon="flags/16x16/flag_china.png"/>
<language id="zh" region="SG" codepage="65001" encoding="utf-8" charset="gb2312" icon="flags/16x16/flag_Singapore.PNG"/>
<language id="zh" region="TW" codepage="65001" encoding="utf-8" charset="big5" icon="flags/16x16/flag_Taiwan.PNG"/>
<language id="zu" region="ZA" codepage="65001" encoding="utf-8" charset="iso-8859-1" icon="flags/16x16/flag_South_Africa.PNG"/>
</languages>
</languageDefinitions>

That means that if you parse each one of the above language definition names using

LanguageDefinitions.Definitions.Select(definition => Language.Parse(definition.Name));

None of them would be equals to

Language.Parse("en")

Since the Language.Equals(..) uses

language1.Name.Equals(language2.Name, StringComparison.OrdinalIgnoreCase);

Do you guys know what I'm missing here? I'm pretty sure that one of my assumptions here is not correct since that OOTB setup works properly.

1

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.