Kaydet (Commit) 122a15f4 authored tarafından Eike Rathke's avatar Eike Rathke

support en-GB-oxendict additionally to now deprecated en-GB-oed

Have them separated so when saving loaded documents the same tag is used
to keep the generator happy.

When to switch in UI language listbox? Or should we have both entries?

Change-Id: If78600229c4b24f6ee598c25d5a8974fef410bb5
üst 701e21b2
......@@ -420,7 +420,8 @@ void TestLanguageTag::testAllTags()
}
// 'en-GB-oed' is known grandfathered for English, Oxford English
// Dictionary spelling
// Dictionary spelling.
// Deprecated as of 2015-04-17, prefer en-GB-oxendict instead.
{
OUString s_en_GB_oed( "en-GB-oed" );
LanguageTag en_GB_oed( s_en_GB_oed );
......@@ -436,13 +437,38 @@ void TestLanguageTag::testAllTags()
CPPUNIT_ASSERT( en_GB_oed.getLanguageAndScript() == "en" );
CPPUNIT_ASSERT( en_GB_oed.getVariants() == "oed" );
::std::vector< OUString > en_GB_oed_Fallbacks( en_GB_oed.getFallbackStrings( true));
CPPUNIT_ASSERT( en_GB_oed_Fallbacks.size() == 3);
CPPUNIT_ASSERT( en_GB_oed_Fallbacks.size() == 4);
CPPUNIT_ASSERT( en_GB_oed_Fallbacks[0] == "en-GB-oed");
CPPUNIT_ASSERT( en_GB_oed_Fallbacks[1] == "en-GB");
CPPUNIT_ASSERT( en_GB_oed_Fallbacks[2] == "en");
CPPUNIT_ASSERT( en_GB_oed_Fallbacks[1] == "en-GB-oxendict");
CPPUNIT_ASSERT( en_GB_oed_Fallbacks[2] == "en-GB");
CPPUNIT_ASSERT( en_GB_oed_Fallbacks[3] == "en");
// 'en-oed' is not a valid fallback!
}
// 'en-GB-oxendict' as preferred over 'en-GB-oed'.
{
OUString s_en_GB_oxendict( "en-GB-oxendict" );
LanguageTag en_GB_oxendict( s_en_GB_oxendict );
lang::Locale aLocale = en_GB_oxendict.getLocale();
CPPUNIT_ASSERT( en_GB_oxendict.getBcp47() == s_en_GB_oxendict );
CPPUNIT_ASSERT( aLocale.Language == "qlt" );
CPPUNIT_ASSERT( aLocale.Country == "GB" );
CPPUNIT_ASSERT( aLocale.Variant == s_en_GB_oxendict );
CPPUNIT_ASSERT( en_GB_oxendict.getLanguageType() == LANGUAGE_USER_ENGLISH_UK_OXENDICT );
CPPUNIT_ASSERT( en_GB_oxendict.isValidBcp47() );
CPPUNIT_ASSERT( !en_GB_oxendict.isIsoLocale() );
CPPUNIT_ASSERT( !en_GB_oxendict.isIsoODF() );
CPPUNIT_ASSERT( en_GB_oxendict.getLanguageAndScript() == "en" );
CPPUNIT_ASSERT( en_GB_oxendict.getVariants() == "oxendict" );
::std::vector< OUString > en_GB_oxendict_Fallbacks( en_GB_oxendict.getFallbackStrings( true));
CPPUNIT_ASSERT( en_GB_oxendict_Fallbacks.size() == 5);
CPPUNIT_ASSERT( en_GB_oxendict_Fallbacks[0] == "en-GB-oxendict");
CPPUNIT_ASSERT( en_GB_oxendict_Fallbacks[1] == "en-GB-oed");
CPPUNIT_ASSERT( en_GB_oxendict_Fallbacks[2] == "en-oxendict");
CPPUNIT_ASSERT( en_GB_oxendict_Fallbacks[3] == "en-GB");
CPPUNIT_ASSERT( en_GB_oxendict_Fallbacks[4] == "en");
}
#if USE_LIBLANGTAG
// 'zh-yue-HK' uses redundant 'zh-yue' and should be preferred 'yue-HK'
#if 0
......
......@@ -741,7 +741,8 @@ static Bcp47CountryEntry const aImplBcp47CountryEntries[] =
// MS-LangID full BCP47, ISO3166, ISO639-Variant or other fallback
{ LANGUAGE_CATALAN_VALENCIAN, "ca-ES-valencia", "ES", "ca-valencia" },
{ LANGUAGE_OBSOLETE_USER_CATALAN_VALENCIAN, "ca-ES-valencia", "ES", "" }, // In case MS format files using the old value escaped into the wild, map them back.
{ LANGUAGE_USER_ENGLISH_UK_OED, "en-GB-oed", "GB", "" }, // grandfathered
{ LANGUAGE_USER_ENGLISH_UK_OED, "en-GB-oed", "GB", "" }, // grandfathered, deprecated, prefer en-GB-oxendict
{ LANGUAGE_USER_ENGLISH_UK_OXENDICT,"en-GB-oxendict", "GB", "" },
// { LANGUAGE_YUE_CHINESE_HONGKONG, "zh-yue-HK", "HK", "" }, // MS reserved, prefer yue-HK; do not add unless LanguageTag::simpleExtract() can handle it to not call liblangtag for rsc!
{ LANGUAGE_DONTKNOW, "", "", "" } // marks end of table
};
......
......@@ -2150,6 +2150,15 @@ LanguageTag & LanguageTag::makeFallback()
getBcp47(); // have maBcp47 now
if (bIncludeFullBcp47)
aVec.push_back( maBcp47);
// Special cases for deprecated tags and their replacements, include both
// in fallbacks in a sensible order.
/* TODO: could such things be generalized and automated with liblangtag? */
if (maBcp47 == "en-GB-oed")
aVec.push_back( "en-GB-oxendict");
else if (maBcp47 == "en-GB-oxendict")
aVec.push_back( "en-GB-oed");
OUString aScript;
OUString aVariants( getVariants());
OUString aTmp;
......
......@@ -706,6 +706,7 @@ typedef unsigned short LanguageType;
#define LANGUAGE_USER_VENETIAN 0x0695
#define LANGUAGE_USER_ENGLISH_GAMBIA 0x9009 /* makeLangID( 0x24, getPrimaryLanguage( LANGUAGE_ENGLISH_UK)) */
#define LANGUAGE_USER_OCCITAN_ARANESE 0x8082 /* makeLangID( 0x20, getPrimaryLanguage( LANGUAGE_OCCITAN_FRANCE)) */
#define LANGUAGE_USER_ENGLISH_UK_OXENDICT 0x9409 /* makeLangID( 0x25, getPrimaryLanguage( LANGUAGE_ENGLISH_UK)) */
/* Primary language ID range for on-the-fly assignment. */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment