summaryrefslogtreecommitdiff
path: root/svtools/source/misc
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2017-03-14 11:52:52 +0100
committerEike Rathke <erack@redhat.com>2017-03-14 12:48:22 +0100
commitbde834ee6b0cb43cebece47cac55cc9b80aadc24 (patch)
treeef3f5ebe8340d0e0392905ec3cfab033953a6425 /svtools/source/misc
parentbf63e5a3a6ae458ffe10061c1bcf969a534760c5 (diff)
display raw language tags in curly brackets
Place raw language tags in curly brackets {}, so all on-the-fly tags are grouped together at the top of a listbox (but behind the "[None]" entry). Change-Id: I01d388150241a8482a1f39f8eda26cdd5bb1d832
Diffstat (limited to 'svtools/source/misc')
-rw-r--r--svtools/source/misc/langtab.cxx15
1 files changed, 13 insertions, 2 deletions
diff --git a/svtools/source/misc/langtab.cxx b/svtools/source/misc/langtab.cxx
index 1c303f9fb72b..9214780ca1ef 100644
--- a/svtools/source/misc/langtab.cxx
+++ b/svtools/source/misc/langtab.cxx
@@ -175,6 +175,17 @@ 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, bool bUserInterfaceSelection ) const
{
@@ -185,7 +196,7 @@ const OUString SvtLanguageTableImpl::GetString( const LanguageType eType, bool b
return ResStringArray::GetString( nPos );
//Rather than return a fairly useless "Unknown" name, return a geeky but usable-in-a-pinch lang-tag
- OUString sLangTag(LanguageTag::convertToBcp47(eType));
+ OUString sLangTag( lcl_getDescription( LanguageTag::convertToBcp47(eType)));
SAL_WARN("svtools.misc", "Language: 0x"
<< std::hex << eType
<< " with unknown name, so returning lang-tag of: "
@@ -259,7 +270,7 @@ LanguageType SvtLanguageTable::GetLanguageTypeAtIndex( sal_uInt32 nIndex )
sal_uInt32 SvtLanguageTable::AddLanguageTag( const LanguageTag& rLanguageTag, const OUString& rString )
{
- return theLanguageTable::get().AddItem( (rString.isEmpty() ? rLanguageTag.getBcp47() : rString),
+ return theLanguageTable::get().AddItem( (rString.isEmpty() ? lcl_getDescription(rLanguageTag.getBcp47()) : rString),
rLanguageTag.getLanguageType());
}