[Libreoffice-commits] core.git: sw/source

Eike Rathke erack at redhat.com
Wed Jul 10 09:58:44 PDT 2013


 sw/source/ui/dbui/dbinsdlg.cxx |   22 ++++++++++------------
 1 file changed, 10 insertions(+), 12 deletions(-)

New commits:
commit 166c0724acc28ef121ea75d10ee3f7f95942f27f
Author: Eike Rathke <erack at redhat.com>
Date:   Wed Jul 10 18:56:30 2013 +0200

    use LanguageTag to convert
    
    Change-Id: Ieb160cf3f9ce1f298a007b42326885e927255433

diff --git a/sw/source/ui/dbui/dbinsdlg.cxx b/sw/source/ui/dbui/dbinsdlg.cxx
index bcaad87..a237b50 100644
--- a/sw/source/ui/dbui/dbinsdlg.cxx
+++ b/sw/source/ui/dbui/dbinsdlg.cxx
@@ -1670,11 +1670,7 @@ void SwInsertDBColAutoPilot::Commit()
 
         if( eLang != ePrevLang )
         {
-            /* FIXME-BCP47: handle language tags! */
-            lang::Locale aLocale( LanguageTag( eLang ).getLocale());
-            /* umm.. what's this string anyway, "Country-Language" instead of
-             * "Language-Country" ??? */
-            (( sPrevLang = aLocale.Country ) += OUString( '-' )) += aLocale.Language;
+            sPrevLang = LanguageTag( eLang ).getBcp47();
             ePrevLang = eLang;
         }
 
@@ -1757,13 +1753,15 @@ void SwInsertDBColAutoPilot::Load()
                 OUString sNumberFormatLocale;
                 pSubProps[5] >>= sNumberFormatLocale;
 
-                /* FIXME-BCP47: handle language tags, and cope with the wrong
-                 * Country-Language string that
-                 * SwInsertDBColAutoPilot::Commit() writes so far! */
-                lang::Locale aLocale;
-                aLocale.Language = sNumberFormatLocale.copy(0, 2);
-                aLocale.Country = sNumberFormatLocale.copy(3, 2);
-                pInsDBColumn->eUsrNumFmtLng = LanguageTag( aLocale ).getLanguageType();
+                /* XXX Earlier versions wrote a Country-Language string in
+                 * SwInsertDBColAutoPilot::Commit() that here was read as
+                 * Language-Country with 2 characters copied to language,
+                 * 1 character separator and unconditionally 2 characters read
+                 * as country. So for 'DE-de' and locales that have similar
+                 * case-insensitive equal language/country combos that may have
+                 * worked, for all others not. FIXME if you need to read old
+                 * data that you were never able to read before. */
+                pInsDBColumn->eUsrNumFmtLng = LanguageTag( sNumberFormatLocale ).getLanguageType();
 
                 pInsDBColumn->nUsrNumFmt = rNFmtr.GetEntryKey( pInsDBColumn->sUsrNumFmt,
                                                         pInsDBColumn->eUsrNumFmtLng );


More information about the Libreoffice-commits mailing list