[Libreoffice-commits] core.git: 19 commits - cui/source desktop/source editeng/source framework/source i18nlangtag/source include/i18nlangtag lingucomponent/source linguistic/source svl/source sw/source unotools/source

Eike Rathke erack at redhat.com
Tue Sep 3 11:36:06 PDT 2013


 cui/source/options/optgdlg.cxx                   |    6 ++---
 desktop/source/app/langselect.cxx                |    2 -
 desktop/source/deployment/gui/dp_gui_service.cxx |    2 -
 editeng/source/misc/unolingu.cxx                 |    2 -
 framework/source/services/substitutepathvars.cxx |    2 -
 i18nlangtag/source/languagetag/languagetag.cxx   |   14 ++++++++++++
 include/i18nlangtag/languagetag.hxx              |   26 +++++++++++++++++++++++
 lingucomponent/source/lingutil/lingutil.cxx      |    4 +--
 linguistic/source/convdicxml.cxx                 |    2 -
 linguistic/source/dicimp.cxx                     |    4 +--
 linguistic/source/gciterator.cxx                 |    2 -
 linguistic/source/lngsvcmgr.cxx                  |    8 +++----
 svl/source/config/languageoptions.cxx            |    2 -
 sw/source/filter/basflt/fltini.cxx               |    2 -
 sw/source/filter/html/htmlcss1.cxx               |    2 -
 sw/source/filter/html/htmlgrin.cxx               |    2 -
 sw/source/filter/html/svxcss1.cxx                |    2 -
 unotools/source/config/lingucfg.cxx              |    2 -
 unotools/source/config/syslocaleoptions.cxx      |    2 -
 19 files changed, 64 insertions(+), 24 deletions(-)

New commits:
commit 68c3328e10258460992c49edf9563e879c1eb90c
Author: Eike Rathke <erack at redhat.com>
Date:   Tue Sep 3 20:32:56 2013 +0200

    was convertIsoStringToLanguage(), use convertToLanguageTypeWithFallback()
    
    Change-Id: I6189cc5b45c085e3b8207980fb2931fab8fa3421

diff --git a/sw/source/filter/html/svxcss1.cxx b/sw/source/filter/html/svxcss1.cxx
index e04ccbd..4790c90 100644
--- a/sw/source/filter/html/svxcss1.cxx
+++ b/sw/source/filter/html/svxcss1.cxx
@@ -3089,7 +3089,7 @@ static void ParseCSS1_so_language( const CSS1Expression *pExpr,
     if( CSS1_IDENT == pExpr->GetType() ||
         CSS1_STRING == pExpr->GetType() )
     {
-        LanguageType eLang = LanguageTag( pExpr->GetString() ).getLanguageType();
+        LanguageType eLang = LanguageTag::convertToLanguageTypeWithFallback( pExpr->GetString() );
         if( LANGUAGE_DONTKNOW != eLang )
         {
             SvxLanguageItem aLang( eLang, aItemIds.nLanguage );
commit 9817bd0faf74cb606b63a461b0e87aa401167c77
Author: Eike Rathke <erack at redhat.com>
Date:   Tue Sep 3 20:28:44 2013 +0200

    was convertIsoStringToLanguage(), use convertToLanguageTypeWithFallback()
    
    Change-Id: Ib57abbb298160ce21fd584a5f3b88519e5422cfc

diff --git a/sw/source/filter/html/htmlgrin.cxx b/sw/source/filter/html/htmlgrin.cxx
index 2a125cb..58097a1 100644
--- a/sw/source/filter/html/htmlgrin.cxx
+++ b/sw/source/filter/html/htmlgrin.cxx
@@ -988,7 +988,7 @@ void SwHTMLParser::InsertBodyOptions()
     }
     if( aLang.Len() )
     {
-        LanguageType eLang = LanguageTag::convertToLanguageType( aLang );
+        LanguageType eLang = LanguageTag::convertToLanguageTypeWithFallback( aLang );
         if( LANGUAGE_DONTKNOW != eLang )
         {
             sal_uInt16 nWhich = 0;
commit fe8f47ce22130b23b7546bb741664e8fc5ffd58f
Author: Eike Rathke <erack at redhat.com>
Date:   Tue Sep 3 20:26:07 2013 +0200

    was convertIsoStringToLanguage(), use convertToLanguageTypeWithFallback()
    
    Change-Id: I12cf6ad7ad658646dcee8cb54776e0915f1c8042

diff --git a/sw/source/filter/html/htmlcss1.cxx b/sw/source/filter/html/htmlcss1.cxx
index 8d31718..bfbcf0c 100644
--- a/sw/source/filter/html/htmlcss1.cxx
+++ b/sw/source/filter/html/htmlcss1.cxx
@@ -1934,7 +1934,7 @@ sal_Bool SwHTMLParser::ParseStyleOptions( const String &rStyle,
 
     if( pLang && pLang->Len() )
     {
-        LanguageType eLang = LanguageTag::convertToLanguageType( *pLang );
+        LanguageType eLang = LanguageTag::convertToLanguageTypeWithFallback( *pLang );
         if( LANGUAGE_DONTKNOW != eLang )
         {
             SvxLanguageItem aLang( eLang, RES_CHRATR_LANGUAGE );
commit a5fd27a77b39368c473757fc7b27a7a7fb2ca43c
Author: Eike Rathke <erack at redhat.com>
Date:   Tue Sep 3 20:22:54 2013 +0200

    was convertIsoStringToLanguage(), use convertToLanguageTypeWithFallback()
    
    Change-Id: I123fe95ea4d772571001bc97133705d43a335465

diff --git a/sw/source/filter/basflt/fltini.cxx b/sw/source/filter/basflt/fltini.cxx
index b882d64..0729e3b 100644
--- a/sw/source/filter/basflt/fltini.cxx
+++ b/sw/source/filter/basflt/fltini.cxx
@@ -628,7 +628,7 @@ void SwAsciiOptions::ReadUserData( const OUString& rStr )
                 sFont = sToken;
                 break;
             case 3:         // Language
-                nLanguage = LanguageTag::convertToLanguageType( sToken );
+                nLanguage = LanguageTag::convertToLanguageTypeWithFallback( sToken );
                 break;
             }
         }
commit bdf442a86ad32cfd95352bf352080674c93b032a
Author: Eike Rathke <erack at redhat.com>
Date:   Tue Sep 3 20:08:39 2013 +0200

    was convertIsoStringToLanguage(), use convertToLanguageTypeWithFallback()
    
    Change-Id: I4cfda0f08e1d85acc7f1b5819b8e0f64c4985bb1

diff --git a/unotools/source/config/syslocaleoptions.cxx b/unotools/source/config/syslocaleoptions.cxx
index 561cb20..a02834b 100644
--- a/unotools/source/config/syslocaleoptions.cxx
+++ b/unotools/source/config/syslocaleoptions.cxx
@@ -674,7 +674,7 @@ void SvtSysLocaleOptions::GetCurrencyAbbrevAndLanguage( OUString& rAbbrev,
     {
         rAbbrev = rConfigString.copy( 0, nDelim );
         OUString aIsoStr( rConfigString.copy( nDelim+1 ) );
-        eLang = LanguageTag::convertToLanguageType( aIsoStr );
+        eLang = LanguageTag::convertToLanguageTypeWithFallback( aIsoStr );
     }
     else
     {
commit 46f34ef59e76383df0cd3c040f80a9a4ea712bc9
Author: Eike Rathke <erack at redhat.com>
Date:   Tue Sep 3 20:05:47 2013 +0200

    was convertIsoStringToLanguage(), use convertToLanguageTypeWithFallback()
    
    Change-Id: If5dfd19368e2bd94aa55e06a65d68f422bae3877

diff --git a/unotools/source/config/lingucfg.cxx b/unotools/source/config/lingucfg.cxx
index 5adef30..47bcadc 100644
--- a/unotools/source/config/lingucfg.cxx
+++ b/unotools/source/config/lingucfg.cxx
@@ -82,7 +82,7 @@ static sal_Int16 lcl_CfgAnyToLanguage( const uno::Any &rVal )
 {
     OUString aTmp;
     rVal >>= aTmp;
-    return (aTmp.isEmpty()) ? LANGUAGE_SYSTEM : LanguageTag::convertToLanguageType( aTmp );
+    return (aTmp.isEmpty()) ? LANGUAGE_SYSTEM : LanguageTag::convertToLanguageTypeWithFallback( aTmp );
 }
 
 SvtLinguOptions::SvtLinguOptions()
commit 5cc71722912ac2d6caa4ab967293667954fde09c
Author: Eike Rathke <erack at redhat.com>
Date:   Tue Sep 3 19:53:16 2013 +0200

    was convertIsoStringToLanguage(), use convertToLanguageTypeWithFallback()
    
    Change-Id: Ib45634b0baad4ef4c6754b13cee6d92c2bc504f8

diff --git a/svl/source/config/languageoptions.cxx b/svl/source/config/languageoptions.cxx
index 15b1604..9bebe8a 100644
--- a/svl/source/config/languageoptions.cxx
+++ b/svl/source/config/languageoptions.cxx
@@ -191,7 +191,7 @@ LanguageType SvtSystemLanguageOptions::GetWin16SystemLanguage() const
 {
     if( m_sWin16SystemLocale.isEmpty() )
         return LANGUAGE_NONE;
-    return LanguageTag::convertToLanguageType( m_sWin16SystemLocale );
+    return LanguageTag::convertToLanguageTypeWithFallback( m_sWin16SystemLocale );
 }
 
 bool SvtSystemLanguageOptions::isKeyboardLayoutTypeInstalled(sal_Int16 scriptType) const
commit 39c9c7420a5464b4b52cd73622e991ebee30e4a0
Author: Eike Rathke <erack at redhat.com>
Date:   Tue Sep 3 19:50:25 2013 +0200

    was convertIsoStringToLanguage(), use convertToLanguageTypeWithFallback()
    
    Change-Id: Ieea44614271c79beb7a9a3fce35acf921ccb478f

diff --git a/lingucomponent/source/lingutil/lingutil.cxx b/lingucomponent/source/lingutil/lingutil.cxx
index f8ae521..b6db0b9 100644
--- a/lingucomponent/source/lingutil/lingutil.cxx
+++ b/lingucomponent/source/lingutil/lingutil.cxx
@@ -198,7 +198,7 @@ void MergeNewStyleDicsAndOldStyleDics(
         sal_Int32 nLocaleNames = aLocaleNames.getLength();
         for (sal_Int32 k = 0;  k < nLocaleNames; ++k)
         {
-            LanguageType nLang = LanguageTag::convertToLanguageType( aLocaleNames[k] );
+            LanguageType nLang = LanguageTag::convertToLanguageTypeWithFallback( aLocaleNames[k] );
             aNewStyleLanguages.insert( nLang );
         }
     }
@@ -214,7 +214,7 @@ void MergeNewStyleDicsAndOldStyleDics(
         DBG_ASSERT( nOldStyleDics, "old style dictionary with more then one language found!");
         if (nOldStyleDics > 0)
         {
-            LanguageType nLang = LanguageTag::convertToLanguageType( aIt2->aLocaleNames[0] );
+            LanguageType nLang = LanguageTag::convertToLanguageTypeWithFallback( aIt2->aLocaleNames[0] );
 
             if (nLang == LANGUAGE_DONTKNOW || linguistic::LinguIsUnspecified( nLang))
             {
commit 3945267d677fc311205ac23ed0aa1ba2eef21097
Author: Eike Rathke <erack at redhat.com>
Date:   Tue Sep 3 19:48:44 2013 +0200

    was convertIsoStringToLanguage(), use convertToLanguageTypeWithFallback()
    
    Change-Id: Ic08b09824cffdc9b633ba13ec3050cc109f671cd

diff --git a/framework/source/services/substitutepathvars.cxx b/framework/source/services/substitutepathvars.cxx
index f3950e1..b9b390c 100644
--- a/framework/source/services/substitutepathvars.cxx
+++ b/framework/source/services/substitutepathvars.cxx
@@ -1161,7 +1161,7 @@ void SubstitutePathVariables::SetPredefinedPathVariables( PredefinedPathVariable
     // Detect the language type of the current office
     aPreDefPathVariables.m_eLanguageType = LANGUAGE_ENGLISH_US;
     OUString aLocaleStr( utl::ConfigManager::getLocale() );
-    aPreDefPathVariables.m_eLanguageType = LanguageTag::convertToLanguageType( aLocaleStr );
+    aPreDefPathVariables.m_eLanguageType = LanguageTag::convertToLanguageTypeWithFallback( aLocaleStr );
     // We used to have an else branch here with a LOG_ERROR, but that
     // always fired in some unit tests when this code was built with
     // debug=t, so it seems fairly pointless, especially as
commit a67763c10c432fdd075e052cbd90e2750932fb90
Author: Eike Rathke <erack at redhat.com>
Date:   Tue Sep 3 19:39:59 2013 +0200

    was convertIsoStringToLanguage(), use convertToLocaleWithFallback()
    
    Change-Id: I57df767ba5bfbd7b0f9cc7420de0ddbd2fa64685

diff --git a/editeng/source/misc/unolingu.cxx b/editeng/source/misc/unolingu.cxx
index 9dced46..79d0906 100644
--- a/editeng/source/misc/unolingu.cxx
+++ b/editeng/source/misc/unolingu.cxx
@@ -130,7 +130,7 @@ void ThesDummy_Impl::GetCfgLocales()
         Locale *pLocale = pLocaleSeq->getArray();
         for (sal_Int32 i = 0;  i < nLen;  ++i)
         {
-            pLocale[i] = LanguageTag::convertToLocale( pNodeNames[i] );
+            pLocale[i] = LanguageTag::convertToLocaleWithFallback( pNodeNames[i] );
         }
     }
 }
commit 9000ee0e9eabd3f1fc1e8c763054d54105005115
Author: Eike Rathke <erack at redhat.com>
Date:   Tue Sep 3 19:38:26 2013 +0200

    added convertToLocaleWithFallback()
    
    Change-Id: I9eb1418721026a0d869b97aa577bc3196f960488

diff --git a/i18nlangtag/source/languagetag/languagetag.cxx b/i18nlangtag/source/languagetag/languagetag.cxx
index acda42e..63da4fc 100644
--- a/i18nlangtag/source/languagetag/languagetag.cxx
+++ b/i18nlangtag/source/languagetag/languagetag.cxx
@@ -1640,4 +1640,11 @@ LanguageType LanguageTag::convertToLanguageTypeWithFallback( const OUString& rBc
     return LanguageTag( rBcp47).makeFallback().getLanguageType( true);
 }
 
+
+// static
+com::sun::star::lang::Locale LanguageTag::convertToLocaleWithFallback( const OUString& rBcp47 )
+{
+    return LanguageTag( rBcp47).makeFallback().getLocale( true);
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/i18nlangtag/languagetag.hxx b/include/i18nlangtag/languagetag.hxx
index 946b459..9b922f7 100644
--- a/include/i18nlangtag/languagetag.hxx
+++ b/include/i18nlangtag/languagetag.hxx
@@ -448,6 +448,19 @@ public:
      */
     static LanguageType convertToLanguageTypeWithFallback( const OUString& rBcp47 );
 
+    /** Convert BCP 47 string to Locale with fallback, convenience method.
+
+        NOTE: exists only for consistency with the other convertTo...()
+        methods, internally uses a temporary LanguageTag instance for
+        conversion so does not save anything compared to
+        LanguageTag(rBcp47).makeFallback().getLocale(bResolveSystem).
+
+        @see    makeFallback()
+
+        Always resolves an empty tag to the system locale.
+     */
+    static com::sun::star::lang::Locale convertToLocaleWithFallback( const OUString& rBcp47 );
+
 private:
 
     enum Decision
commit cfe0862cc669893e4b1229183e9aa64776e464d3
Author: Eike Rathke <erack at redhat.com>
Date:   Tue Sep 3 19:28:36 2013 +0200

    was convertIsoStringToLanguage(), use convertToLanguageTypeWithFallback()
    
    Change-Id: Idfbf8bf9007268fb8a5c636be0454ae2704c3ddd

diff --git a/desktop/source/app/langselect.cxx b/desktop/source/app/langselect.cxx
index 3eadf83..cef2851 100644
--- a/desktop/source/app/langselect.cxx
+++ b/desktop/source/app/langselect.cxx
@@ -79,7 +79,7 @@ void setMsLangIdFallback(OUString const & locale) {
     // #i32939# setting of default document language
     // See #i42730# for rules for determining source of settings
     if (!locale.isEmpty()) {
-        LanguageType type = LanguageTag::convertToLanguageType(locale);
+        LanguageType type = LanguageTag::convertToLanguageTypeWithFallback(locale);
         switch (SvtLanguageOptions::GetScriptTypeOfLanguage(type)) {
         case SCRIPTTYPE_ASIAN:
             MsLangId::setConfiguredAsianFallback(type);
commit 5f4f3ddfec61ee5d99b3c491b108a7b08de8eabf
Author: Eike Rathke <erack at redhat.com>
Date:   Tue Sep 3 19:18:21 2013 +0200

    was convertIsoStringToLanguage(), use convertToLanguageTypeWithFallback()
    
    Change-Id: Iaa3d2d2dbe06eec91f1c4f2609cc1e3f5f7bbb7b

diff --git a/cui/source/options/optgdlg.cxx b/cui/source/options/optgdlg.cxx
index 1510a16..55d76b5 100644
--- a/cui/source/options/optgdlg.cxx
+++ b/cui/source/options/optgdlg.cxx
@@ -1045,7 +1045,7 @@ OfaLanguagesTabPage::OfaLanguagesTabPage( Window* pParent, const SfxItemSet& rSe
         LanguageType aLang = LANGUAGE_DONTKNOW;
         for (sal_IntPtr i=0; i<seqInstalledLanguages.getLength(); i++)
         {
-            aLang = LanguageTag::convertToLanguageType(seqInstalledLanguages[i]);
+            aLang = LanguageTag::convertToLanguageTypeWithFallback(seqInstalledLanguages[i]);
             if (aLang != LANGUAGE_DONTKNOW)
             {
                 //sal_uInt16 p = m_pUserInterfaceLB->InsertLanguage(aLang);
@@ -1245,7 +1245,7 @@ sal_Bool OfaLanguagesTabPage::FillItemSet( SfxItemSet& rSet )
 
     OUString sLang = pLangConfig->aSysLocaleOptions.GetLocaleConfigString();
     LanguageType eOldLocale = (!sLang.isEmpty() ?
-        LanguageTag::convertToLanguageType( sLang ) : LANGUAGE_SYSTEM);
+        LanguageTag::convertToLanguageTypeWithFallback( sLang ) : LANGUAGE_SYSTEM);
     LanguageType eNewLocale = m_pLocaleSettingLB->GetSelectLanguage();
     if ( eOldLocale != eNewLocale )
     {
@@ -1407,7 +1407,7 @@ void OfaLanguagesTabPage::Reset( const SfxItemSet& rSet )
 {
     OUString sLang = pLangConfig->aSysLocaleOptions.GetLocaleConfigString();
     if ( !sLang.isEmpty() )
-        m_pLocaleSettingLB->SelectLanguage(LanguageTag::convertToLanguageType(sLang));
+        m_pLocaleSettingLB->SelectLanguage(LanguageTag::convertToLanguageTypeWithFallback(sLang));
     else
         m_pLocaleSettingLB->SelectLanguage( LANGUAGE_USER_SYSTEM_CONFIG );
     sal_Bool bReadonly = pLangConfig->aSysLocaleOptions.IsReadOnly(SvtSysLocaleOptions::E_LOCALE);
commit 06fcf0f065f8ec9c0d3b26588bd6171f373d8c74
Author: Eike Rathke <erack at redhat.com>
Date:   Tue Sep 3 19:05:12 2013 +0200

    was convertIsoStringToLanguage(), use convertToLanguageTypeWithFallback()
    
    Change-Id: I0202c11e46201e22e62d8edfb81924c3e9551353

diff --git a/linguistic/source/lngsvcmgr.cxx b/linguistic/source/lngsvcmgr.cxx
index 95e165f..3b7c5a4 100644
--- a/linguistic/source/lngsvcmgr.cxx
+++ b/linguistic/source/lngsvcmgr.cxx
@@ -880,7 +880,7 @@ void LngSvcMgr::Notify( const uno::Sequence< OUString > &rPropertyNames )
 
                 LanguageType nLang = LANGUAGE_NONE;
                 if (!aKeyText.isEmpty())
-                    nLang = LanguageTag::convertToLanguageType( aKeyText );
+                    nLang = LanguageTag::convertToLanguageTypeWithFallback( aKeyText );
 
                 GetSpellCheckerDsp_Impl( sal_False );     // don't set service list, it will be done below
                 pSpellDsp->SetServiceList( LanguageTag::convertToLocale(nLang), aSvcImplNames );
@@ -905,7 +905,7 @@ void LngSvcMgr::Notify( const uno::Sequence< OUString > &rPropertyNames )
 
                 LanguageType nLang = LANGUAGE_NONE;
                 if (!aKeyText.isEmpty())
-                    nLang = LanguageTag::convertToLanguageType( aKeyText );
+                    nLang = LanguageTag::convertToLanguageTypeWithFallback( aKeyText );
 
                 if (SvtLinguConfig().HasGrammarChecker())
                 {
@@ -933,7 +933,7 @@ void LngSvcMgr::Notify( const uno::Sequence< OUString > &rPropertyNames )
 
                 LanguageType nLang = LANGUAGE_NONE;
                 if (!aKeyText.isEmpty())
-                    nLang = LanguageTag::convertToLanguageType( aKeyText );
+                    nLang = LanguageTag::convertToLanguageTypeWithFallback( aKeyText );
 
                 GetHyphenatorDsp_Impl( sal_False );   // don't set service list, it will be done below
                 pHyphDsp->SetServiceList( LanguageTag::convertToLocale(nLang), aSvcImplNames );
@@ -958,7 +958,7 @@ void LngSvcMgr::Notify( const uno::Sequence< OUString > &rPropertyNames )
 
                 LanguageType nLang = LANGUAGE_NONE;
                 if (!aKeyText.isEmpty())
-                    nLang = LanguageTag::convertToLanguageType( aKeyText );
+                    nLang = LanguageTag::convertToLanguageTypeWithFallback( aKeyText );
 
                 GetThesaurusDsp_Impl( sal_False );  // don't set service list, it will be done below
                 pThesDsp->SetServiceList( LanguageTag::convertToLocale(nLang), aSvcImplNames );
commit 156e5035e700739f5b8dcfb46c7220d52dbed9db
Author: Eike Rathke <erack at redhat.com>
Date:   Tue Sep 3 18:59:36 2013 +0200

    was convertIsoStringToLanguage(), use convertToLanguageTypeWithFallback()
    
    Change-Id: I3bf7d28e18d25672159daec7c49081bb11afc044

diff --git a/linguistic/source/gciterator.cxx b/linguistic/source/gciterator.cxx
index 694dcd7..5544aee 100644
--- a/linguistic/source/gciterator.cxx
+++ b/linguistic/source/gciterator.cxx
@@ -1022,7 +1022,7 @@ void GrammarCheckingIterator::GetConfiguredGCSvcs_Impl()
                 {
                     // only the first entry is used, there should be only one grammar checker per language
                     const OUString aImplName( aImplNames[0] );
-                    const LanguageType nLang = LanguageTag::convertToLanguageType( pElementNames[i] );
+                    const LanguageType nLang = LanguageTag::convertToLanguageTypeWithFallback( pElementNames[i] );
                     aTmpGCImplNamesByLang[ nLang ] = aImplName;
                 }
             }
commit 959181323f539c0cc685013bb4d50ed5360614a6
Author: Eike Rathke <erack at redhat.com>
Date:   Tue Sep 3 18:56:42 2013 +0200

    was convertIsoStringToLanguage(), use convertToLanguageTypeWithFallback()
    
    Change-Id: I1795da53192e0c679a248ebd878a96e11ebbee80

diff --git a/linguistic/source/dicimp.cxx b/linguistic/source/dicimp.cxx
index ca490f4..f14792c 100644
--- a/linguistic/source/dicimp.cxx
+++ b/linguistic/source/dicimp.cxx
@@ -121,8 +121,8 @@ sal_Int16 ReadDicVersion( SvStreamPtr &rpStream, sal_uInt16 &nLng, sal_Bool &bNe
                 if (aTagValue.equalsL(RTL_CONSTASCII_STRINGPARAM("<none>")))
                     nLng = LANGUAGE_NONE;
                 else
-                    nLng = LanguageTag(OStringToOUString(
-                        aTagValue, RTL_TEXTENCODING_ASCII_US)).getLanguageType();
+                    nLng = LanguageTag::convertToLanguageTypeWithFallback(
+                            OStringToOUString( aTagValue, RTL_TEXTENCODING_ASCII_US));
             }
 
             // type: negative / positive
commit 59124d7e4facd57f9cbaba9f9fb86f199ab32302
Author: Eike Rathke <erack at redhat.com>
Date:   Tue Sep 3 18:52:47 2013 +0200

    was convertIsoStringToLanguage(), use convertToLanguageTypeWithFallback()
    
    Change-Id: I9031b64d420ca527c13c19c4f7f3e47ead98eb6b

diff --git a/linguistic/source/convdicxml.cxx b/linguistic/source/convdicxml.cxx
index 80b8bee..9b409bd 100644
--- a/linguistic/source/convdicxml.cxx
+++ b/linguistic/source/convdicxml.cxx
@@ -223,7 +223,7 @@ void ConvDicXMLDictionaryContext_Impl::StartElement(
         OUString aValue = rxAttrList->getValueByIndex(i);
 
         if ( nPrefix == XML_NAMESPACE_TCD && aLocalName == "lang" )
-            nLanguage = LanguageTag::convertToLanguageType( aValue );
+            nLanguage = LanguageTag::convertToLanguageTypeWithFallback( aValue );
         else if ( nPrefix == XML_NAMESPACE_TCD && aLocalName == "conversion-type" )
             nConversionType = GetConversionTypeFromText( aValue );
     }
commit b641e39d0aa9356717018e94925485d4755f8bbb
Author: Eike Rathke <erack at redhat.com>
Date:   Tue Sep 3 18:50:40 2013 +0200

    added convertToLanguageTypeWithFallback()
    
    Change-Id: Ib57a7c6fc57192b4a615f5ad0e43c580769513e9

diff --git a/i18nlangtag/source/languagetag/languagetag.cxx b/i18nlangtag/source/languagetag/languagetag.cxx
index de48d06..acda42e 100644
--- a/i18nlangtag/source/languagetag/languagetag.cxx
+++ b/i18nlangtag/source/languagetag/languagetag.cxx
@@ -1633,4 +1633,11 @@ LanguageType LanguageTag::convertToLanguageType( const OUString& rBcp47, bool bR
     return LanguageTag( rBcp47).getLanguageType( bResolveSystem);
 }
 
+
+// static
+LanguageType LanguageTag::convertToLanguageTypeWithFallback( const OUString& rBcp47 )
+{
+    return LanguageTag( rBcp47).makeFallback().getLanguageType( true);
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/i18nlangtag/languagetag.hxx b/include/i18nlangtag/languagetag.hxx
index d87c5e3..946b459 100644
--- a/include/i18nlangtag/languagetag.hxx
+++ b/include/i18nlangtag/languagetag.hxx
@@ -435,6 +435,19 @@ public:
      */
     static LanguageType convertToLanguageType( const OUString& rBcp47, bool bResolveSystem = true );
 
+    /** Convert BCP 47 string to MS-LangID with fallback, convenience method.
+
+        NOTE: exists only for consistency with the other convertTo...()
+        methods, internally uses a temporary LanguageTag instance for
+        conversion so does not save anything compared to
+        LanguageTag(rBcp47).makeFallback().getLanguageType(bResolveSystem).
+
+        @see    makeFallback()
+
+        Always resolves an empty tag to the system locale.
+     */
+    static LanguageType convertToLanguageTypeWithFallback( const OUString& rBcp47 );
+
 private:
 
     enum Decision
commit d695e8d0ea9e144e24928c45d56f59a2b59867b1
Author: Eike Rathke <erack at redhat.com>
Date:   Tue Sep 3 18:26:07 2013 +0200

    was convertIsoStringToLanguage(), use makeFallback()
    
    Change-Id: I215e418d314cbc8bbc333c2d75cdc1a0c07e9071

diff --git a/desktop/source/deployment/gui/dp_gui_service.cxx b/desktop/source/deployment/gui/dp_gui_service.cxx
index 39cc7ae..e823e3c 100644
--- a/desktop/source/deployment/gui/dp_gui_service.cxx
+++ b/desktop/source/deployment/gui/dp_gui_service.cxx
@@ -237,7 +237,7 @@ void ServiceImpl::startExecuteModal(
                 throw RuntimeException( "Cannot initialize VCL!",
                                         static_cast<OWeakObject *>(this) );
             AllSettings as = app->GetSettings();
-            as.SetUILanguageTag( LanguageTag( utl::ConfigManager::getLocale() ) );
+            as.SetUILanguageTag( LanguageTag( utl::ConfigManager::getLocale() ).makeFallback() );
             app->SetSettings( as );
             app->SetDisplayName(
                 utl::ConfigManager::getProductName() +


More information about the Libreoffice-commits mailing list