i18nlangtag/qa/cppunit/test_languagetag.cxx | 1 + i18nlangtag/source/isolang/isolang.cxx | 3 ++- i18nlangtag/source/isolang/mslangid.cxx | 5 ----- i18nlangtag/source/languagetag/languagetag.cxx | 8 ++++++++ include/i18nlangtag/languagetag.hxx | 8 ++++++++ oox/source/core/xmlfilterbase.cxx | 2 +- oox/source/export/drawingml.cxx | 2 +- sw/source/filter/ww8/docxattributeoutput.cxx | 2 +- 8 files changed, 22 insertions(+), 9 deletions(-)
New commits: commit 49f1f04c5bb9922b237ec7ed6a9b58f7f1c2e781 Author: Eike Rathke <[email protected]> Date: Tue Sep 5 15:32:14 2017 +0200 Use LanguageTag::getBcp47MS() to write MS malformed tags to OOXML, tdf#83190 Change-Id: Id706cf40f717005df840e7856528dd7bbc866e98 diff --git a/oox/source/core/xmlfilterbase.cxx b/oox/source/core/xmlfilterbase.cxx index b66dcf9e7301..e5190c512384 100644 --- a/oox/source/core/xmlfilterbase.cxx +++ b/oox/source/core/xmlfilterbase.cxx @@ -566,7 +566,7 @@ writeElement( const FSHelperPtr& pDoc, sal_Int32 nXmlElement, const LanguageTag& // and obsoleted by RFC 5646, see // http://dublincore.org/documents/dcmi-terms/#terms-language // http://dublincore.org/documents/dcmi-terms/#elements-language - writeElement( pDoc, nXmlElement, rLanguageTag.getBcp47() ); + writeElement( pDoc, nXmlElement, rLanguageTag.getBcp47MS() ); } static void diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx index 3e66a504aa14..f0d3ea78431f 100644 --- a/oox/source/export/drawingml.cxx +++ b/oox/source/export/drawingml.cxx @@ -1382,7 +1382,7 @@ void DrawingML::WriteRunProperties( const Reference< XPropertySet >& rRun, bool mAny >>= aLocale; LanguageTag aLanguageTag( aLocale); if (!aLanguageTag.isSystemLocale()) - usLanguage = aLanguageTag.getBcp47(); + usLanguage = aLanguageTag.getBcp47MS(); } if( GETAD( CharEscapement ) ) diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index 1332baf8f628..f1413e5f62d7 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -6515,7 +6515,7 @@ void DocxAttributeOutput::CharKerning( const SvxKerningItem& rKerning ) void DocxAttributeOutput::CharLanguage( const SvxLanguageItem& rLanguage ) { OString aLanguageCode( OUStringToOString( - LanguageTag( rLanguage.GetLanguage()).getBcp47(), + LanguageTag( rLanguage.GetLanguage()).getBcp47MS(), RTL_TEXTENCODING_UTF8)); switch ( rLanguage.Which() ) commit 750991d454f60d5718e17cbdcdeb4a438adfe6ab Author: Eike Rathke <[email protected]> Date: Tue Sep 5 15:30:03 2017 +0200 Map MS malformed es-ES_tradnl to proper BCP 47 es-ES-u-co-trad, tdf#83190 See BCP 47 Extension U https://tools.ietf.org/html/rfc6067 and http://www.unicode.org/repos/cldr/tags/latest/common/bcp47/collation.xml http://www.unicode.org/repos/cldr/trunk/common/bcp47/collation.xml Change-Id: I2b946ab00c2efdc1a877a5e6ce91bc703bcd9db0 diff --git a/i18nlangtag/qa/cppunit/test_languagetag.cxx b/i18nlangtag/qa/cppunit/test_languagetag.cxx index cef9011a95fd..e9ef5739fabd 100644 --- a/i18nlangtag/qa/cppunit/test_languagetag.cxx +++ b/i18nlangtag/qa/cppunit/test_languagetag.cxx @@ -691,6 +691,7 @@ bool checkMapping( const OUString& rStr1, const OUString& rStr2 ) if (rStr1 == "crk-Latn-CN" ) return rStr2 == "crk-Latn-CA"; if (rStr1 == "crk-Cans-CN" ) return rStr2 == "crk-Cans-CA"; if (rStr1 == "en-GB-oed" ) return rStr2 == "en-GB-oxendict"; + if (rStr1 == "es-ES_tradnl") return rStr2 == "es-ES-u-co-trad"; return rStr1 == rStr2; } diff --git a/i18nlangtag/source/isolang/isolang.cxx b/i18nlangtag/source/isolang/isolang.cxx index 602ec4447bbd..cee528e5ebde 100644 --- a/i18nlangtag/source/isolang/isolang.cxx +++ b/i18nlangtag/source/isolang/isolang.cxx @@ -180,7 +180,6 @@ static IsoLanguageCountryEntry const aImplIsoLangEntries[] = { LANGUAGE_ITALIAN, "it", "IT", k0 }, { LANGUAGE_DUTCH, "nl", "NL", k0 }, { LANGUAGE_SPANISH_MODERN, "es", "ES", k0 }, - { LANGUAGE_SPANISH_DATED, "es", "ES", k0 }, { LANGUAGE_PORTUGUESE, "pt", "PT", k0 }, { LANGUAGE_PORTUGUESE_BRAZILIAN, "pt", "BR", k0 }, { LANGUAGE_DANISH, "da", "DK", k0 }, @@ -763,6 +762,8 @@ static Bcp47CountryEntry const aImplBcp47CountryEntries[] = { LANGUAGE_OBSOLETE_USER_CATALAN_VALENCIAN, "ca-ES-valencia", "ES", "", k0 }, // In case MS format files using the old value escaped into the wild, map them back. { LANGUAGE_USER_ENGLISH_UK_OXENDICT, "en-GB-oxendict", "GB", "", k0 }, { LANGUAGE_USER_ENGLISH_UK_OED, "en-GB-oed", "GB", "", LANGUAGE_USER_ENGLISH_UK_OXENDICT }, // grandfathered, deprecated, prefer en-GB-oxendict + { LANGUAGE_SPANISH_DATED, "es-ES-u-co-trad", "ES", "es-u-co-trad", k0 }, // RFC6067/CLDR + { LANGUAGE_SPANISH_DATED, "es-ES_tradnl", "ES", "", kSAME }, // MS malformed // { LANGUAGE_YUE_CHINESE_HONGKONG, "zh-yue-HK", "HK", "", 0 }, // MS reserved, prefer yue-HK; do not add unless LanguageTag::simpleExtract() can handle it to not call liblangtag for rsc! { LANGUAGE_DONTKNOW, "", "", "", k0 } // marks end of table }; diff --git a/i18nlangtag/source/isolang/mslangid.cxx b/i18nlangtag/source/isolang/mslangid.cxx index 41231f8a7e1b..25e5a4109e7d 100644 --- a/i18nlangtag/source/isolang/mslangid.cxx +++ b/i18nlangtag/source/isolang/mslangid.cxx @@ -539,11 +539,6 @@ LanguageType MsLangId::getReplacementForObsoleteLanguage( LanguageType nLang ) else if (nLang == LANGUAGE_NORWEGIAN) nLang = LANGUAGE_NORWEGIAN_BOKMAL; - // #i94435# A Spanish variant that differs only in collation details we - // do not support. - else if (nLang == LANGUAGE_SPANISH_DATED) - nLang = LANGUAGE_SPANISH_MODERN; - // The erroneous Tibetan vs. Dzongkha case, #i53497# // We (and MS) have stored LANGUAGE_TIBETAN_BHUTAN. This will need // special attention if MS one day decides to actually use commit 93f490887c837c8a81b035d4c404da186a9bc9a2 Author: Eike Rathke <[email protected]> Date: Tue Sep 5 15:19:12 2017 +0200 Introduce LanguageTag::getBcp47MS() for writing MS malformed tags, tdf#83190 Change-Id: I1e2815b9ae60681c7cddc416cc05bf4c70dcc48a diff --git a/i18nlangtag/source/languagetag/languagetag.cxx b/i18nlangtag/source/languagetag/languagetag.cxx index 2da3b95174ed..09b443983d45 100644 --- a/i18nlangtag/source/languagetag/languagetag.cxx +++ b/i18nlangtag/source/languagetag/languagetag.cxx @@ -2359,6 +2359,14 @@ LanguageTag & LanguageTag::makeFallback() } +OUString LanguageTag::getBcp47MS() const +{ + if (getLanguageType() == LANGUAGE_SPANISH_DATED) + return "es-ES_tradnl"; + return getBcp47(); +} + + bool LanguageTag::equals( const LanguageTag & rLanguageTag ) const { // If SYSTEM is not to be resolved or either both are SYSTEM or none, we diff --git a/include/i18nlangtag/languagetag.hxx b/include/i18nlangtag/languagetag.hxx index 20f159f4d171..5088756e4691 100644 --- a/include/i18nlangtag/languagetag.hxx +++ b/include/i18nlangtag/languagetag.hxx @@ -120,6 +120,14 @@ public: */ const OUString & getBcp47( bool bResolveSystem = true ) const; + /** Obtain BCP 47 language tag, but with MS malformed exceptions. + + To be used *only* in OOXML filter context. + For example, es-ES-u-co-trad is stored as es-ES_tradnl which is not a + valid BCP 47 language tag. + */ + OUString getBcp47MS() const; + /** Obtain language tag as Locale. As a convention, language tags that can not be expressed as "pure" _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
