diff options
author | Caolán McNamara <caolanm@redhat.com> | 2012-10-03 20:56:17 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2012-10-04 12:49:27 +0100 |
commit | 96e353491215fd2b703f2cd48959176f3e401043 (patch) | |
tree | d5df3c6ab188363d25a00da97e38bcc7384cfe20 /svtools/source/misc | |
parent | ddd0e56cd787c2f86e9a154cbb0b4ad09ee40f80 (diff) |
Show lang-tag instead of Unknown for languages without unknown name
Change-Id: I8e7bb96ecdc6d6edf38401394209b62b01af6784
Diffstat (limited to 'svtools/source/misc')
-rw-r--r-- | svtools/source/misc/langtab.cxx | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/svtools/source/misc/langtab.cxx b/svtools/source/misc/langtab.cxx index 92c91a6c7229..f66ea6ce2e05 100644 --- a/svtools/source/misc/langtab.cxx +++ b/svtools/source/misc/langtab.cxx @@ -34,6 +34,7 @@ #include <i18npool/lang.h> #include <i18npool/mslangid.hxx> +#include <i18npool/languagetag.hxx> #include <svtools/svtools.hrc> #include <svtools/svtresid.hxx> @@ -149,19 +150,14 @@ const rtl::OUString SvtLanguageTable::GetString( const LanguageType eType, bool if ( RESARRAY_INDEX_NOTFOUND != nPos && nPos < Count() ) return ResStringArray::GetString( nPos ); - else - { - // If we knew what a simple "en" should alias to (en_US?) we could - // generally raise an error. - OSL_ENSURE( - eLang == LANGUAGE_ENGLISH, "language entry not found in resource" ); - - nPos = FindIndex( LANGUAGE_DONTKNOW ); - if ( RESARRAY_INDEX_NOTFOUND != nPos && nPos < Count() ) - return ResStringArray::GetString( nPos ); - } - return rtl::OUString(); + //Rather than return a fairly useless "Unknown" name, return a geeky but usable-in-a-pinch lang-tag + OUString sLangTag(LanguageTag(eType).getBcp47()); + SAL_WARN("svtools", "Language: 0x" + << std::hex << eType + << " with unknown name, so returning lang-tag of: " + << sLangTag); + return sLangTag; } String SvtLanguageTable::GetLanguageString( const LanguageType eType ) |