summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2018-02-02 15:28:07 +0100
committerEike Rathke <erack@redhat.com>2018-02-02 15:30:33 +0100
commit329d39c9f42b4f388b3c418fee60c29308e579d7 (patch)
tree79ef567be0c7f797ded40058a09480ea1b78831a
parent427c0804cd4aecde1cadb7cb3c4f3487991bd573 (diff)
Use the {...} notation for configuration provided language tags without name
As is done for all other on-the-fly tags as well so they group nicely on top of the list. Change-Id: Ib4b759af189386dac98397888ba0bfb8b4bc3bc6
-rw-r--r--svtools/source/misc/langtab.cxx31
1 files changed, 16 insertions, 15 deletions
diff --git a/svtools/source/misc/langtab.cxx b/svtools/source/misc/langtab.cxx
index e65f23246e5a..1432c8162e3e 100644
--- a/svtools/source/misc/langtab.cxx
+++ b/svtools/source/misc/langtab.cxx
@@ -150,6 +150,18 @@ const OUString ApplyLreOrRleEmbedding( const OUString &rText )
return aRes;
}
+static OUString lcl_getDescription( const OUString& rBcp47 )
+{
+ // Place in curly brackets, so all on-the-fly tags are grouped together at
+ // the top of a listbox (but behind the "[None]" entry), and not sprinkled
+ // all over, which alphabetically might make sense in an English UI only
+ // anyway. Also a visual indicator that it is a programmatical name, IMHO.
+ /* TODO: pulling descriptive names (language, script, country, subtags)
+ * from liblangtag or ISO databases might be nice, but those are English
+ * only. Maybe ICU, that has translations for language and country. */
+ return "{" + rBcp47 + "}";
+}
+
SvtLanguageTableImpl::SvtLanguageTableImpl()
{
for (size_t i = 0; i < SAL_N_ELEMENTS(STR_ARR_SVT_LANGUAGE_TABLE); ++i)
@@ -162,21 +174,22 @@ SvtLanguageTableImpl::SvtLanguageTableImpl()
sal_Int32 nLen = rElementNames.getLength();
for (sal_Int32 i = 0; i < nLen; ++i)
{
+ const OUString& rBcp47 = rElementNames[i];
OUString aName;
sal_Int32 nType = 0;
uno::Reference <container::XNameAccess> xNB;
- xNA->getByName(rElementNames[i]) >>= xNB;
+ xNA->getByName(rBcp47) >>= xNB;
bool bSuccess = (xNB->getByName("Name") >>= aName) &&
(xNB->getByName("ScriptType") >>= nType);
if (bSuccess)
{
- LanguageTag aLang(rElementNames[i]);
+ LanguageTag aLang(rBcp47);
LanguageType nLangType = aLang.getLanguageType();
if (nType <= LanguageTag::ScriptType::RTL && nType > LanguageTag::ScriptType::UNKNOWN)
aLang.setScriptType(LanguageTag::ScriptType(nType));
sal_uInt32 nPos = FindIndex(nLangType);
if (nPos == RESARRAY_INDEX_NOTFOUND)
- AddItem((aName.isEmpty() ? rElementNames[i] : aName), nLangType);
+ AddItem((aName.isEmpty() ? lcl_getDescription(rBcp47) : aName), nLangType);
}
}
}
@@ -194,18 +207,6 @@ bool SvtLanguageTable::HasLanguageType( const LanguageType eType )
return theLanguageTable::get().HasType( eType );
}
-OUString lcl_getDescription( const OUString& rBcp47 )
-{
- // Place in curly brackets, so all on-the-fly tags are grouped together at
- // the top of a listbox (but behind the "[None]" entry), and not sprinkled
- // all over, which alphabetically might make sense in an English UI only
- // anyway. Also a visual indicator that it is a programmatical name, IMHO.
- /* TODO: pulling descriptive names (language, script, country, subtags)
- * from liblangtag or ISO databases might be nice, but those are English
- * only. Maybe ICU, that has translations for language and country. */
- return "{" + rBcp47 + "}";
-}
-
const OUString SvtLanguageTableImpl::GetString( const LanguageType eType ) const
{
LanguageType eLang = MsLangId::getReplacementForObsoleteLanguage( eType );