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

Eike Rathke erack at redhat.com
Tue Sep 17 13:20:27 PDT 2013


 i18nlangtag/source/languagetag/languagetag.cxx |   30 +++++++++++++++++++++++++
 1 file changed, 30 insertions(+)

New commits:
commit 19863a06d71996f82b2d7d32408b2b1830890a3a
Author: Eike Rathke <erack at redhat.com>
Date:   Tue Sep 17 22:19:17 2013 +0200

    added getNextOnTheFlyLanguage()
    
    Change-Id: I58eeab0076b5b77b533bf855d3879228fe653658

diff --git a/i18nlangtag/source/languagetag/languagetag.cxx b/i18nlangtag/source/languagetag/languagetag.cxx
index 5987ffe..93f9823 100644
--- a/i18nlangtag/source/languagetag/languagetag.cxx
+++ b/i18nlangtag/source/languagetag/languagetag.cxx
@@ -86,6 +86,36 @@ static const KnownTagSet & getKnowns()
 }
 
 
+/* TODO: this is how on-the-fly LangID assignment will work, now implement
+ * usage and registration. */
+#if 0
+static LanguageType getNextOnTheFlyLanguage()
+{
+    static LanguageType nOnTheFlyLanguage = 0;
+    osl::MutexGuard aGuard( theMutex::get());
+    if (!nOnTheFlyLanguage)
+        nOnTheFlyLanguage = MsLangId::makeLangID( LANGUAGE_ON_THE_FLY_SUB_START, LANGUAGE_ON_THE_FLY_START);
+    else
+    {
+        if (MsLangId::getPrimaryLanguage( nOnTheFlyLanguage) != LANGUAGE_ON_THE_FLY_END)
+            ++nOnTheFlyLanguage;
+        else
+        {
+            LanguageType nSub = MsLangId::getSubLanguage( nOnTheFlyLanguage);
+            if (nSub != LANGUAGE_ON_THE_FLY_SUB_END)
+                nOnTheFlyLanguage = MsLangId::makeLangID( ++nSub, LANGUAGE_ON_THE_FLY_START);
+            else
+                SAL_WARN( "i18nlangtag", "getNextOnTheFlyLanguage: none left! ("
+                        << ((LANGUAGE_ON_THE_FLY_END - LANGUAGE_ON_THE_FLY_START + 1)
+                            * (LANGUAGE_ON_THE_FLY_SUB_END - LANGUAGE_ON_THE_FLY_SUB_START + 1))
+                        << " consumed?!?)");
+        }
+    }
+    return nOnTheFlyLanguage;
+}
+#endif
+
+
 /** A reference holder for liblangtag data de/initialization, one static
     instance. Currently implemented such that the first "ref" inits and dtor
     (our library deinitialized) tears down.


More information about the Libreoffice-commits mailing list