[Libreoffice-commits] .: svtools/langsupport svtools/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Fri Nov 16 11:43:48 PST 2012


 svtools/langsupport/langsupport.cxx |   11 ++---------
 svtools/source/control/fmtfield.cxx |   16 +++++++---------
 2 files changed, 9 insertions(+), 18 deletions(-)

New commits:
commit ee30270f590902e0971410dad7991d56a8506549
Author: Eike Rathke <erack at redhat.com>
Date:   Fri Nov 16 19:36:50 2012 +0100

    use LanguageTag
    
    Change-Id: I1d7ba0066ab871ac471a57bbbf0bbf07bc6350cc

diff --git a/svtools/langsupport/langsupport.cxx b/svtools/langsupport/langsupport.cxx
index 3a05c9a..1d5cf7f 100644
--- a/svtools/langsupport/langsupport.cxx
+++ b/svtools/langsupport/langsupport.cxx
@@ -31,7 +31,7 @@
 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
 #include <comphelper/processfactory.hxx>
 #include <cppuhelper/bootstrap.hxx>
-#include <i18npool/mslangid.hxx>
+#include <i18npool/languagetag.hxx>
 #include <sal/main.h>
 #include <svtools/langtab.hxx>
 #include <tools/extendapplicationenvironment.hxx>
@@ -76,14 +76,7 @@ SAL_IMPLEMENT_MAIN()
                 continue;
             }
 
-            lang::Locale aLocale;
-
-            MsLangId::convertLanguageToLocale(eLang, aLocale);
-
-            rtl::OUStringBuffer aBuf(aLocale.Language);
-            if (!aLocale.Country.isEmpty())
-                aBuf.append('-').append(aLocale.Country);
-            rtl::OUString sTag = aBuf.makeStringAndClear();
+            rtl::OUString sTag( LanguageTag( eLang).getBcp47());
 
             std::cout << rtl::OUStringToOString(sTag, osl_getThreadTextEncoding()).getStr()
                 << std::endl;
diff --git a/svtools/source/control/fmtfield.cxx b/svtools/source/control/fmtfield.cxx
index 5619551..8bb336f 100644
--- a/svtools/source/control/fmtfield.cxx
+++ b/svtools/source/control/fmtfield.cxx
@@ -35,7 +35,7 @@
 #include <vcl/svapp.hxx>
 #include <svl/zformat.hxx>
 #include <svtools/fmtfield.hxx>
-#include <i18npool/mslangid.hxx>
+#include <i18npool/languagetag.hxx>
 #include <com/sun/star/lang/Locale.hpp>
 #include <com/sun/star/util/SearchOptions.hpp>
 #include <com/sun/star/util/SearchAlgorithms.hpp>
@@ -293,8 +293,8 @@ SvNumberFormatter* FormattedField::StaticFormatter::GetFormatter()
     if (!s_cFormatter)
     {
         // get the Office's locale and translate
-        LanguageType eSysLanguage = MsLangId::convertLocaleToLanguage(
-                SvtSysLocale().GetLocaleData().getLocale() );
+        LanguageType eSysLanguage = LanguageTag(
+                SvtSysLocale().GetLocaleData().getLocale()).getLanguageType( false);
         s_cFormatter = new SvNumberFormatter(
             ::comphelper::getProcessServiceFactory(),
             eSysLanguage);
@@ -619,8 +619,8 @@ void FormattedField::SetFormatter(SvNumberFormatter* pFormatter, sal_Bool bReset
         if ( m_pFormatter )
         {
             // get the Office's locale and translate
-            LanguageType eSysLanguage = MsLangId::convertLocaleToLanguage(
-                    SvtSysLocale().GetLocaleData().getLocale() );
+            LanguageType eSysLanguage = LanguageTag(
+                    SvtSysLocale().GetLocaleData().getLocale()).getLanguageType( false);
             // get the standard numeric format for this language
             m_nFormatKey = m_pFormatter->GetStandardFormat( NUMBERFORMAT_NUMBER, eSysLanguage );
         }
@@ -1144,8 +1144,7 @@ void DoubleNumericField::ResetConformanceTester()
     sal_Unicode cSeparatorDecimal = '.';
     if (pFormatEntry)
     {
-        Locale aLocale;
-        MsLangId::convertLanguageToLocale( pFormatEntry->GetLanguage(), aLocale );
+        Locale aLocale( LanguageTag( pFormatEntry->GetLanguage()).getLocale());
         LocaleDataWrapper aLocaleInfo( aLocale );
 
         String sSeparator = aLocaleInfo.getNumThousandSep();
@@ -1236,8 +1235,7 @@ void DoubleCurrencyField::UpdateCurrencyFormat()
     sal_uInt16 nDigits = GetDecimalDigits();
 
     // build a new format string with the base class' and my own settings
-    Locale aLocale;
-    MsLangId::convertLanguageToLocale( eLanguage, aLocale );
+    Locale aLocale( LanguageTag( eLanguage).getLocale());
     LocaleDataWrapper aLocaleInfo( aLocale );
 
     XubString sNewFormat;


More information about the Libreoffice-commits mailing list