[Libreoffice-commits] core.git: 5 commits - i18npool/inc i18npool/source sal/inc svx/inc vcl/generic

Eike Rathke erack at redhat.com
Mon Feb 18 08:51:43 PST 2013


 i18npool/inc/i18npool/languagetag.hxx       |   29 ++++++++++++++++
 i18npool/source/languagetag/languagetag.cxx |   48 ++++++++++++++++++++++++++++
 sal/inc/sal/log-areas.dox                   |    7 +++-
 svx/inc/svx/svdglob.hxx                     |   13 -------
 vcl/generic/fontmanager/fontconfig.cxx      |    3 +
 5 files changed, 87 insertions(+), 13 deletions(-)

New commits:
commit 4090979ce0502d808b540305c89030fb9b59eeb9
Author: Eike Rathke <erack at redhat.com>
Date:   Mon Feb 18 17:49:41 2013 +0100

    ditched class SdrResId and some forward leftovers
    
    Change-Id: I700f6c860ad41c6ab3426d1988631f1c5bf30533

diff --git a/svx/inc/svx/svdglob.hxx b/svx/inc/svx/svdglob.hxx
index 1f8b9a1..dbec676 100644
--- a/svx/inc/svx/svdglob.hxx
+++ b/svx/inc/svx/svdglob.hxx
@@ -20,7 +20,7 @@
 #ifndef _SVDGLOB_HXX
 #define _SVDGLOB_HXX
 
-#include <tools/resid.hxx>
+#include <sal/config.h>
 #include <tools/string.hxx>
 
 #include <svx/svxdllapi.h>
@@ -29,22 +29,11 @@
 //   forward declaration
 //************************************************************
 
-class Link;
 class ResMgr;
-class SdrEngineDefaults;
-
-//************************************************************
-//   Defines
-//************************************************************
 
 // Get the resource manager for the app
 ResMgr* ImpGetResMgr();
 
-class SdrResId: ResId {
-public:
-    SdrResId(sal_uInt16 nId): ResId(nId,*ImpGetResMgr()) {}
-};
-
 // ResourceCache for frequently used strings.
 // Global string resources with the IDs from
 // SDR_StringCacheBegin (256) to SDR_StringCacheEnd
commit 8d23b47454043122b61b2e1dc08d84ee09e1a081
Author: Eike Rathke <erack at redhat.com>
Date:   Sat Feb 16 02:29:18 2013 +0100

    added LanguageTag::getFallbackStrings()
    
    Change-Id: Ia597cb184e0402e776cde50967541f008e22d4c9

diff --git a/i18npool/inc/i18npool/languagetag.hxx b/i18npool/inc/i18npool/languagetag.hxx
index 3394c1b..324fcd3 100644
--- a/i18npool/inc/i18npool/languagetag.hxx
+++ b/i18npool/inc/i18npool/languagetag.hxx
@@ -16,6 +16,8 @@
 #include <i18npool/i18npooldllapi.h>
 #include <i18npool/lang.h>
 
+#include <vector>
+
 typedef struct _rtl_Locale rtl_Locale;  // as in rtl/locale.h
 
 
@@ -212,6 +214,25 @@ public:
      */
     LanguageTag &                   makeFallback();
 
+    /** Return a vector of fall-back strings.
+
+        In order:
+        full BCP 47 tag, same as getBcp47()
+        lll-Ssss-CC
+        lll-Ssss
+        lll-CC
+        lll
+
+        Only strings that differ from a higher order are included, for example
+        if there is no script the elements will be bcp47, lll-CC, lll; if the
+        bcp47 string is identical to lll-CC then only lll-CC, lll.
+
+        Note that lll is only ISO 639-1/2 alpha code and CC is only ISO 3166
+        alpha code. If the region can not be expressed as ISO 3166 then no -CC
+        tags are included.
+     */
+    ::std::vector< OUString >       getFallbackStrings() const;
+
     /* Test equality of two LangageTag. */
     bool    operator==( const LanguageTag & rLanguageTag ) const;
 
diff --git a/i18npool/source/languagetag/languagetag.cxx b/i18npool/source/languagetag/languagetag.cxx
index 31b1ae0..33b2c57 100644
--- a/i18npool/source/languagetag/languagetag.cxx
+++ b/i18npool/source/languagetag/languagetag.cxx
@@ -1003,6 +1003,46 @@ LanguageTag & LanguageTag::makeFallback()
 }
 
 
+::std::vector< OUString > LanguageTag::getFallbackStrings() const
+{
+    ::std::vector< OUString > aVec;
+    OUString aLanguage( getLanguage());
+    OUString aCountry( getCountry());
+    if (isIsoLocale())
+    {
+        if (!aCountry.isEmpty())
+            aVec.push_back( aLanguage + "-" + aCountry);
+        aVec.push_back( aLanguage);
+        return aVec;
+    }
+    aVec.push_back( getBcp47());
+    OUString aTmp;
+    if (hasScript())
+    {
+        OUString aScript( getScript());
+        if (!aCountry.isEmpty())
+        {
+            aTmp = aLanguage + "-" + aScript + "-" + aCountry;
+            if (aTmp != aVec[0])
+                aVec.push_back( aTmp);
+        }
+        aTmp = aLanguage + "-" + aScript;
+        if (aTmp != aVec[0])
+            aVec.push_back( aTmp);
+    }
+    if (!aCountry.isEmpty())
+    {
+        aTmp = aLanguage + "-" + aCountry;
+        if (aTmp != aVec[0])
+            aVec.push_back( aTmp);
+    }
+    aTmp = aLanguage;
+    if (aTmp != aVec[0])
+        aVec.push_back( aTmp);
+    return aVec;
+}
+
+
 bool LanguageTag::operator==( const LanguageTag & rLanguageTag ) const
 {
     // Compare full language tag strings but SYSTEM unresolved.
commit ca04dec8b9670d936395771da43818f00e670482
Author: Eike Rathke <erack at redhat.com>
Date:   Sat Feb 16 00:49:29 2013 +0100

    added LanguageTag::hasScript()
    
    Change-Id: If9eaca46ef8daa544ee208444f79423122b10739

diff --git a/i18npool/inc/i18npool/languagetag.hxx b/i18npool/inc/i18npool/languagetag.hxx
index bb86b72..3394c1b 100644
--- a/i18npool/inc/i18npool/languagetag.hxx
+++ b/i18npool/inc/i18npool/languagetag.hxx
@@ -127,6 +127,8 @@ public:
     /** Get ISO 15924 script code, if not the default script according to
         BCP 47. For default script an empty string is returned.
 
+        @see hasScript()
+
         Always resolves an empty tag to the system locale.
      */
     rtl::OUString                   getScript() const;
@@ -134,6 +136,8 @@ public:
     /** Get combined language and script code, separated by '-' if
         non-default script, if default script only language.
 
+        @see hasScript()
+
         Always resolves an empty tag to the system locale.
      */
     rtl::OUString                   getLanguageAndScript() const;
@@ -152,6 +156,10 @@ public:
      */
     rtl::OUString                   getRegion() const;
 
+    /** If language tag has a non-default script specified.
+     */
+    bool                            hasScript() const;
+
     /** If language tag is a locale that can be expressed using only ISO 639
         language codes and ISO 3166 country codes, thus is convertible to a
         conforming Locale struct without using extension mechanisms.
diff --git a/i18npool/source/languagetag/languagetag.cxx b/i18npool/source/languagetag/languagetag.cxx
index bab2443..31b1ae0 100644
--- a/i18npool/source/languagetag/languagetag.cxx
+++ b/i18npool/source/languagetag/languagetag.cxx
@@ -898,6 +898,14 @@ rtl::OUString LanguageTag::getRegion() const
 }
 
 
+bool LanguageTag::hasScript() const
+{
+    if (!mbCachedScript)
+        getScript();
+    return !maCachedScript.isEmpty();
+}
+
+
 bool LanguageTag::cacheSimpleLSC()
 {
     OUString aLanguage, aScript, aCountry;
commit ad8f56fd333dfaf0eb97d6a3c314899a8085782c
Author: Eike Rathke <erack at redhat.com>
Date:   Fri Feb 15 23:05:18 2013 +0100

    added i18n section
    
    Change-Id: I98a22066c711b56494f327ef40f45c37472ec888

diff --git a/sal/inc/sal/log-areas.dox b/sal/inc/sal/log-areas.dox
index 1c821b1..e1422ca 100644
--- a/sal/inc/sal/log-areas.dox
+++ b/sal/inc/sal/log-areas.dox
@@ -103,7 +103,12 @@ certain functionality.
 
 @section i18npool
 
- at li @c i18npool.langtag
+ at li @c i18npool - general i18npool
+ at li @c i18npool.langtag - language tags
+
+ at section i18n
+
+ at li @c i18n - module independent i18n related, e.g. language tag usage
 
 @section jvmfwk
 
commit 60bcda43450fcbc345f2547d457ad201907b0547
Author: Eike Rathke <erack at redhat.com>
Date:   Fri Feb 15 17:13:53 2013 +0100

    localizedsorter::bestname: info for non-ISO locale and comment
    
    Until fontconfig will support language tags.
    
    Change-Id: I831d066e91c00e62651409a0f9e6c8ed52b39150

diff --git a/vcl/generic/fontmanager/fontconfig.cxx b/vcl/generic/fontmanager/fontconfig.cxx
index 67506d8..9c6abe1 100644
--- a/vcl/generic/fontmanager/fontconfig.cxx
+++ b/vcl/generic/fontmanager/fontconfig.cxx
@@ -291,6 +291,9 @@ namespace
     FcChar8* localizedsorter::bestname(const std::vector<lang_and_element> &elements)
     {
         FcChar8* candidate = elements.begin()->second;
+        /* FIXME-BCP47: once fontconfig supports language tags this
+         * language-territory stuff needs to be changed! */
+        SAL_INFO_IF( !maLoc.isIsoLocale(), "i18n", "localizedsorter::bestname - not an ISO locale");
         rtl::OString sLangMatch(rtl::OUStringToOString(maLoc.getLanguage().toAsciiLowerCase(), RTL_TEXTENCODING_UTF8));
         rtl::OString sFullMatch = sLangMatch;
         sFullMatch += OString('-');


More information about the Libreoffice-commits mailing list