diff options
author | Eike Rathke <erack@redhat.com> | 2013-07-12 01:47:40 +0200 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2013-07-12 01:49:02 +0200 |
commit | cde58731dc2e0da78cf761ff95a5df214296d041 (patch) | |
tree | b4996f12488afe6fffac1b2ccd79f2cfe87f23af | |
parent | restrict to ISO language-country (diff) | |
download | core-cde58731dc2e0da78cf761ff95a5df214296d041.tar.gz core-cde58731dc2e0da78cf761ff95a5df214296d041.zip |
use LanguageTag, and a FIXME-BCP47 comment in loadTranslations()
Change-Id: I9fd4c0a3887dd3d7ac756f0399a8a030d116f68a
-rw-r--r-- | include/vcl/builder.hxx | 2 | ||||
-rw-r--r-- | vcl/source/window/builder.cxx | 16 |
2 files changed, 10 insertions, 8 deletions
diff --git a/include/vcl/builder.hxx b/include/vcl/builder.hxx index 3708a34874ab..bdf0c8218d00 100644 --- a/include/vcl/builder.hxx +++ b/include/vcl/builder.hxx @@ -211,7 +211,7 @@ private: std::vector<MnemonicWidgetMap> m_aMnemonicWidgetMaps; }; - void loadTranslations(const com::sun::star::lang::Locale &rLocale, const OUString &rUri); + void loadTranslations(const LanguageTag &rLanguageTag, const OUString &rUri); OString getTranslation(const OString &rId, const OString &rProperty) const; OString m_sID; diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx index 37d54a08bc5a..d7d384a6e43f 100644 --- a/vcl/source/window/builder.cxx +++ b/vcl/source/window/builder.cxx @@ -81,9 +81,11 @@ namespace } } -void VclBuilder::loadTranslations(const com::sun::star::lang::Locale &rLocale, const OUString& rUri) +void VclBuilder::loadTranslations(const LanguageTag &rLanguageTag, const OUString& rUri) { - for (int i = rLocale.Country.isEmpty() ? 1 : 0; i < 2; ++i) + /* FIXME-BCP47: support language tags with + * LanguageTag::getFallbackStrings() ? */ + for (int i = rLanguageTag.getCountry().isEmpty() ? 1 : 0; i < 2; ++i) { OUStringBuffer aTransBuf; sal_Int32 nLastSlash = rUri.lastIndexOf('/'); @@ -94,11 +96,11 @@ void VclBuilder::loadTranslations(const com::sun::star::lang::Locale &rLocale, c aTransBuf.append('.'); nLastSlash = 0; } - aTransBuf.append("/res/").append(rLocale.Language); + aTransBuf.append("/res/").append(rLanguageTag.getLanguage()); switch (i) { case 0: - aTransBuf.append('-').append(rLocale.Country); + aTransBuf.append('-').append(rLanguageTag.getCountry()); break; default: break; @@ -157,10 +159,10 @@ VclBuilder::VclBuilder(Window *pParent, OUString sUIDir, OUString sUIFile, OStri OUString sUri = sUIDir + sUIFile; - com::sun::star::lang::Locale aLocale = Application::GetSettings().GetUILanguageTag().getLocale(); - bool bEN_US = aLocale.Language == "en" && aLocale.Country == "US" && aLocale.Variant.isEmpty(); + const LanguageTag& rLanguageTag = Application::GetSettings().GetUILanguageTag(); + bool bEN_US = (rLanguageTag.getBcp47() == "en-US"); if (!bEN_US) - loadTranslations(aLocale, sUri); + loadTranslations(rLanguageTag, sUri); try { |