diff options
author | Eike Rathke <erack@redhat.com> | 2013-09-10 23:13:06 +0200 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2013-09-10 23:22:25 +0200 |
commit | b6cd9d8d5042fb24deb58bd762d8266867d1d0f4 (patch) | |
tree | 7ded7f8c64e3849c8c82c8c041d43b3e8accf02f /i18nlangtag | |
parent | bc273e9e0d7b3a8c17beffa71a3165eb1c034d82 (diff) |
changed all 'sh' language to 'sr-Latn'
Change-Id: Iafadaea87501bc3675eaf2856b5050a7e3ecaa37
Diffstat (limited to 'i18nlangtag')
-rw-r--r-- | i18nlangtag/qa/cppunit/test_languagetag.cxx | 34 | ||||
-rw-r--r-- | i18nlangtag/source/isolang/isolang.cxx | 23 | ||||
-rw-r--r-- | i18nlangtag/source/languagetag/languagetag.cxx | 22 |
3 files changed, 61 insertions, 18 deletions
diff --git a/i18nlangtag/qa/cppunit/test_languagetag.cxx b/i18nlangtag/qa/cppunit/test_languagetag.cxx index aace20a3d8ff..72297cc50c8e 100644 --- a/i18nlangtag/qa/cppunit/test_languagetag.cxx +++ b/i18nlangtag/qa/cppunit/test_languagetag.cxx @@ -130,12 +130,7 @@ void TestLanguageTag::testAllTags() CPPUNIT_ASSERT( aLocale.Language == "qlt" ); CPPUNIT_ASSERT( aLocale.Country == "RS" ); CPPUNIT_ASSERT( aLocale.Variant == s_sr_Latn_RS ); - /* TODO: conversion doesn't know this yet, once it does activate test. */ -#if 0 CPPUNIT_ASSERT( sr_RS.getLanguageType() == LANGUAGE_USER_SERBIAN_LATIN_SERBIA ); -#else - CPPUNIT_ASSERT( sr_RS.getLanguageType() == LANGUAGE_SYSTEM ); -#endif CPPUNIT_ASSERT( sr_RS.isValidBcp47() == true ); CPPUNIT_ASSERT( sr_RS.isIsoLocale() == false ); CPPUNIT_ASSERT( sr_RS.isIsoODF() == true ); @@ -146,6 +141,35 @@ void TestLanguageTag::testAllTags() } { + OUString s_sh_RS( "sh-RS" ); + LanguageTag sh_RS( s_sh_RS, true ); + lang::Locale aLocale = sh_RS.getLocale(); + CPPUNIT_ASSERT( sh_RS.getBcp47() == s_sh_RS ); + CPPUNIT_ASSERT( aLocale.Language == "sh" ); + CPPUNIT_ASSERT( aLocale.Country == "RS" ); + CPPUNIT_ASSERT( aLocale.Variant == "" ); + CPPUNIT_ASSERT( sh_RS.getLanguageType() == LANGUAGE_USER_SERBIAN_LATIN_SERBIA ); + CPPUNIT_ASSERT( sh_RS.isValidBcp47() == true ); + CPPUNIT_ASSERT( sh_RS.isIsoLocale() == true ); + CPPUNIT_ASSERT( sh_RS.isIsoODF() == true ); + CPPUNIT_ASSERT( sh_RS.getLanguage() == "sh" ); + CPPUNIT_ASSERT( sh_RS.getCountry() == "RS" ); + CPPUNIT_ASSERT( sh_RS.getScript() == "" ); + CPPUNIT_ASSERT( sh_RS.getLanguageAndScript() == "sh" ); + ::std::vector< OUString > sh_RS_Fallbacks( sh_RS.getFallbackStrings( true)); + CPPUNIT_ASSERT( sh_RS_Fallbacks.size() == 6); + CPPUNIT_ASSERT( sh_RS_Fallbacks[0] == "sh-RS"); + CPPUNIT_ASSERT( sh_RS_Fallbacks[1] == "sr-Latn-RS"); + CPPUNIT_ASSERT( sh_RS_Fallbacks[2] == "sr-Latn"); + CPPUNIT_ASSERT( sh_RS_Fallbacks[3] == "sr-RS"); + CPPUNIT_ASSERT( sh_RS_Fallbacks[4] == "sr"); + CPPUNIT_ASSERT( sh_RS_Fallbacks[5] == "sh"); + CPPUNIT_ASSERT( sh_RS.makeFallback().getBcp47() == "sr-Latn-RS"); + CPPUNIT_ASSERT( sh_RS.getBcp47() == "sr-Latn-RS"); + CPPUNIT_ASSERT( sh_RS.getLanguageType() == LANGUAGE_USER_SERBIAN_LATIN_SERBIA ); + } + + { OUString s_ca_ES_valencia( "ca-ES-valencia" ); LanguageTag ca_ES_valencia( s_ca_ES_valencia, true ); lang::Locale aLocale = ca_ES_valencia.getLocale(); diff --git a/i18nlangtag/source/isolang/isolang.cxx b/i18nlangtag/source/isolang/isolang.cxx index 74eb73790ebf..76ad252a3edc 100644 --- a/i18nlangtag/source/isolang/isolang.cxx +++ b/i18nlangtag/source/isolang/isolang.cxx @@ -283,12 +283,12 @@ static IsoLanguageCountryEntry const aImplIsoLangEntries[] = { LANGUAGE_SERBIAN_CYRILLIC, "sr", "CS", false }, // alias to be able to integrate localizations, rsc needs it { LANGUAGE_USER_SERBIAN_CYRILLIC_MONTENEGRO, "sr", "ME", false }, { LANGUAGE_SERBIAN_CYRILLIC_BOSNIA_HERZEGOVINA, "sr", "BA", false }, - { LANGUAGE_USER_SERBIAN_LATIN_SERBIA, "sh", "RS", false }, // Serbian Latin in Serbia; kludge, needed to be sr_Latn_RS instead, script codes not supported yet - { LANGUAGE_SERBIAN_LATIN, "sh", "YU", false }, // legacy Serbian Latin in Serbia and Montenegro (former Yugoslavia); kludge, needed to be sr_Latn_CS instead, script codes not supported yet - { LANGUAGE_SERBIAN_LATIN, "sh", "CS", false }, // Serbian Latin in Serbia and Montenegro; kludge, needed to be sr_Latn_CS instead, script codes not supported yet - { LANGUAGE_USER_SERBIAN_LATIN_MONTENEGRO, "sh", "ME", false }, // Serbian Latin in Montenegro; kludge, needed to be sr_Latn_ME instead, script codes not supported yet - { LANGUAGE_SERBIAN_LATIN_BOSNIA_HERZEGOVINA, "sh", "BA", false }, - { LANGUAGE_SERBIAN_LATIN_NEUTRAL, "sh", "" , false }, // kludge, needed to be sr_Latn instead, script codes not supported yet + { LANGUAGE_USER_SERBIAN_LATIN_SERBIA, "sh", "RS", true }, // legacy kludge, is sr-Latn-RS now + { LANGUAGE_SERBIAN_LATIN, "sh", "YU", true }, // legacy kludge, is sr-Latn-YU now + { LANGUAGE_SERBIAN_LATIN, "sh", "CS", true }, // legacy kludge, is sr-Latn-CS now + { LANGUAGE_USER_SERBIAN_LATIN_MONTENEGRO, "sh", "ME", true }, // legacy kludge, is sr-Latn-ME now + { LANGUAGE_SERBIAN_LATIN_BOSNIA_HERZEGOVINA, "sh", "BA", true }, // legacy kludge, is sr-Latn-BA now + { LANGUAGE_SERBIAN_LATIN_NEUTRAL, "sh", "" , true }, // legacy kludge, is sr-Latn now { LANGUAGE_ARMENIAN, "hy", "AM", false }, { LANGUAGE_AZERI_LATIN, "az", "AZ", false }, // { LANGUAGE_AZERI_CYRILLIC, "az", "AZ", false }, // script codes not supported yet @@ -575,9 +575,14 @@ static IsoLanguageCountryEntry const aImplIsoLangEntries[] = static IsoLanguageScriptCountryEntry const aImplIsoLangScriptEntries[] = { - // MS-LangID ISO639-ISO15924, ISO3166 -// { LANGUAGE_USER_SERBIAN_LATIN_SERBIA, "sr-Latn", "RS" }, // for example, once we support it in l10n; TODO: adapt unit test in this case - { LANGUAGE_DONTKNOW, "", "" } // marks end of table + // MS-LangID ISO639-ISO15924, ISO3166 + { LANGUAGE_USER_SERBIAN_LATIN_SERBIA, "sr-Latn", "RS" }, + { LANGUAGE_SERBIAN_LATIN, "sr-Latn", "CS" }, // Serbian Latin in Serbia and Montenegro; note that not all applications may know about the 'CS' reusage mess, see https://en.wikipedia.org/wiki/ISO_3166-2:CS + { LANGUAGE_SERBIAN_LATIN, "sr-Latn", "YU" }, // legacy Serbian Latin in Yugoslavia + { LANGUAGE_USER_SERBIAN_LATIN_MONTENEGRO, "sr-Latn", "ME" }, + { LANGUAGE_SERBIAN_LATIN_BOSNIA_HERZEGOVINA,"sr-Latn", "BA" }, + { LANGUAGE_SERBIAN_LATIN_NEUTRAL, "sr-Latn", "" }, + { LANGUAGE_DONTKNOW, "", "" } // marks end of table }; static Bcp47CountryEntry const aImplBcp47CountryEntries[] = diff --git a/i18nlangtag/source/languagetag/languagetag.cxx b/i18nlangtag/source/languagetag/languagetag.cxx index 3e1b33191086..7e3a7d7d12e7 100644 --- a/i18nlangtag/source/languagetag/languagetag.cxx +++ b/i18nlangtag/source/languagetag/languagetag.cxx @@ -1239,17 +1239,31 @@ LanguageTag & LanguageTag::makeFallback() aVec.push_back( aLanguage + "-CN"); aVec.push_back( aLanguage); } + else if (aLanguage == "sh") + { + ::std::vector< OUString > aRep( LanguageTag( "sr-Latn-" + aCountry).getFallbackStrings( true)); + aVec.insert( aVec.end(), aRep.begin(), aRep.end()); + aVec.push_back( aLanguage); // 'sh' after all 'sr...'? + } else if (aLanguage == "ca" && aCountry == "XV") { - ::std::vector< OUString > aCav( LanguageTag( "ca-ES-valencia").getFallbackStrings( true)); - aVec.insert( aVec.end(), aCav.begin(), aCav.end()); + ::std::vector< OUString > aRep( LanguageTag( "ca-ES-valencia").getFallbackStrings( true)); + aVec.insert( aVec.end(), aRep.begin(), aRep.end()); // Already includes 'ca' language fallback. } else aVec.push_back( aLanguage); } - else if (bIncludeFullBcp47) - aVec.push_back( aLanguage); + else + { + if (bIncludeFullBcp47) + aVec.push_back( aLanguage); + if (aLanguage == "sh") + { + ::std::vector< OUString > aRep( LanguageTag( "sr-Latn").getFallbackStrings( true)); + aVec.insert( aVec.end(), aRep.begin(), aRep.end()); + } + } return aVec; } |