diff options
author | Heiko Tietze <tietze.heiko@gmail.com> | 2019-09-25 17:31:00 +0200 |
---|---|---|
committer | Heiko Tietze <heiko.tietze@documentfoundation.org> | 2019-10-01 10:56:36 +0200 |
commit | 78c6b79f2a05eb92f41037fd20c6579a0a644c47 (patch) | |
tree | 32cecf960719fbb211c244c1255ec93a89a8a54f /cui/source/dialogs | |
parent | 404a3c806ffdf094c2f4a95a722765fea132fad5 (diff) |
Resolves tdf#127756 - Tip of the day not localized
Introduced %LANGUAGENAME token being replaced with
BCP47 for pt, en, zh or ISO otherwise
Change-Id: Iaa7168731e0f6a8e0dd1e906ff0ef646534d9f4b
Reviewed-on: https://gerrit.libreoffice.org/79564
Tested-by: Jenkins
Reviewed-by: Heiko Tietze <heiko.tietze@documentfoundation.org>
Diffstat (limited to 'cui/source/dialogs')
-rw-r--r-- | cui/source/dialogs/tipofthedaydlg.cxx | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/cui/source/dialogs/tipofthedaydlg.cxx b/cui/source/dialogs/tipofthedaydlg.cxx index 55e9b51b9003..9d6630d7e5a7 100644 --- a/cui/source/dialogs/tipofthedaydlg.cxx +++ b/cui/source/dialogs/tipofthedaydlg.cxx @@ -28,6 +28,8 @@ #include <vcl/help.hxx> #include <vcl/virdev.hxx> #include <vcl/svapp.hxx> +#include <i18nlangtag/languagetag.hxx> +#include <unotools/configmgr.hxx> TipOfTheDayDialog::TipOfTheDayDialog(weld::Window* pParent) : GenericDialogController(pParent, "cui/ui/tipofthedaydialog.ui", "TipOfTheDayDialog") @@ -86,7 +88,18 @@ void TipOfTheDayDialog::UpdateTip() } else if (aLink.startsWith("http")) { - m_pLink->set_uri(CuiResId(aLink.toUtf8().getStr())); + aText = CuiResId(aLink.toUtf8().getStr()); + + sal_Int32 aPos = aText.indexOf("%LANGUAGENAME"); + if (aPos != -1) + { + OUString aLang = LanguageTag(utl::ConfigManager::getUILocale()).getLanguage(); + if (aLang == "en" || aLang == "pt" || aLang == "zh") //en-US/GB, pt-BR, zh-CH/TW + aLang = LanguageTag(utl::ConfigManager::getUILocale()).getBcp47(); + aText = aText.replaceAt(aPos, 13, aLang); + } + + m_pLink->set_uri(aText); m_pLink->set_label(CuiResId(STR_MORE_LINK)); m_pLink->set_visible(true); m_pLink->connect_clicked(Link<weld::LinkButton&, void>()); @@ -99,7 +112,6 @@ void TipOfTheDayDialog::UpdateTip() //converts aLink into the proper offline/online hyperlink m_pLink->connect_clicked(LINK(this, TipOfTheDayDialog, OnLinkClick)); } - // image OUString aURL("$BRAND_BASE_DIR/$BRAND_SHARE_SUBDIR/tipoftheday/"); rtl::Bootstrap::expandMacros(aURL); |