diff options
author | Eike Rathke <erack@redhat.com> | 2013-07-11 18:35:28 +0200 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2013-07-11 19:15:51 +0200 |
commit | f758c53e87a2e29ccd4d8e11f1426e1d805b2032 (patch) | |
tree | 8879c88191dee6ae5558b47cd8debe5799368bf6 /sfx2 | |
parent | b49892872ef2c73c3f2b745c00baa1c735837ec1 (diff) |
use LanguageTag to convert
Change-Id: I9209b659eb88df5610882a476dc12ac45527e568
Diffstat (limited to 'sfx2')
-rw-r--r-- | sfx2/source/doc/SfxDocumentMetaData.cxx | 16 |
1 files changed, 3 insertions, 13 deletions
diff --git a/sfx2/source/doc/SfxDocumentMetaData.cxx b/sfx2/source/doc/SfxDocumentMetaData.cxx index f410703ed421..f1e96c6645d0 100644 --- a/sfx2/source/doc/SfxDocumentMetaData.cxx +++ b/sfx2/source/doc/SfxDocumentMetaData.cxx @@ -70,6 +70,7 @@ #include "sot/storage.hxx" #include "sfx2/docfile.hxx" #include "sax/tools/converter.hxx" +#include "i18nlangtag/languagetag.hxx" #include <utility> #include <vector> @@ -1515,15 +1516,7 @@ css::lang::Locale SAL_CALL SfxDocumentMetaData::getLanguage() throw (css::uno::RuntimeException) { ::osl::MutexGuard g(m_aMutex); - css::lang::Locale loc; - OUString text = getMetaText("dc:language"); - sal_Int32 ix = text.indexOf(static_cast<sal_Unicode> ('-')); - if (ix == -1) { - loc.Language = text; - } else { - loc.Language = text.copy(0, ix); - loc.Country = text.copy(ix+1); - } + css::lang::Locale loc( LanguageTag( getMetaText("dc:language")).getLocale( false)); return loc; } @@ -1531,10 +1524,7 @@ void SAL_CALL SfxDocumentMetaData::setLanguage(const css::lang::Locale & the_value) throw (css::uno::RuntimeException) { - OUString text = the_value.Language; - if (!the_value.Country.isEmpty()) { - text += OUString("-").concat(the_value.Country); - } + OUString text( LanguageTag( the_value).getBcp47( false)); setMetaTextAndNotify("dc:language", text); } |