diff options
author | Caolán McNamara <caolanm@redhat.com> | 2018-10-28 20:52:37 +0000 |
---|---|---|
committer | Adolfo Jayme Barrientos <fitojb@ubuntu.com> | 2018-10-30 00:28:35 +0100 |
commit | 7a6e6d027ad41350ae1334d3e60dc1a6ce96c508 (patch) | |
tree | 7841c16e273e0f9d9b398f82bf538ed6aec18951 /vcl | |
parent | cb5584c8a715df8aa68cecefd0bad8d1839124e8 (diff) |
Resolves: tdf#120988 mismatch of in/out locale formatting
Change-Id: I9def43c111adc877aeec9f1990f5dd76fabdbf8f
Reviewed-on: https://gerrit.libreoffice.org/62486
Tested-by: Jenkins
Tested-by: Xisco Faulí <xiscofauli@libreoffice.org>
Reviewed-by: Adolfo Jayme Barrientos <fitojb@ubuntu.com>
Tested-by: Adolfo Jayme Barrientos <fitojb@ubuntu.com>
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/source/window/builder.cxx | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx index 63e459a0becb..efa62401f876 100644 --- a/vcl/source/window/builder.cxx +++ b/vcl/source/window/builder.cxx @@ -216,18 +216,18 @@ namespace weld { OUString aStr; + const LocaleDataWrapper& rLocaleData = Application::GetSettings().GetUILocaleDataWrapper(); + unsigned int nDecimalDigits = m_xSpinButton->get_digits(); //pawn percent off to icu to decide whether percent is separated from its number for this locale if (m_eSrcUnit == FUNIT_PERCENT) { double fValue = nValue; fValue /= SpinButton::Power10(nDecimalDigits); - aStr = unicode::formatPercent(fValue, Application::GetSettings().GetUILanguageTag()); + aStr = unicode::formatPercent(fValue, rLocaleData.getLanguageTag()); } else { - const SvtSysLocale aSysLocale; - const LocaleDataWrapper& rLocaleData = aSysLocale.GetLocaleData(); aStr = rLocaleData.getNum(nValue, nDecimalDigits, true, true); if (m_eSrcUnit != FUNIT_NONE && m_eSrcUnit != FUNIT_DEGREE) aStr += " "; @@ -245,8 +245,7 @@ namespace weld IMPL_LINK(MetricSpinButton, spin_button_input, int*, result, bool) { - const SvtSysLocale aSysLocale; - const LocaleDataWrapper& rLocaleData = aSysLocale.GetLocaleData(); + const LocaleDataWrapper& rLocaleData = Application::GetSettings().GetUILocaleDataWrapper(); double fResult(0.0); bool bRet = MetricFormatter::TextToValue(get_text(), fResult, 0, m_xSpinButton->get_digits(), rLocaleData, m_eSrcUnit); if (bRet) @@ -259,8 +258,7 @@ namespace weld int nStartPos, nEndPos; m_xSpinButton->get_selection_bounds(nStartPos, nEndPos); - const SvtSysLocale aSysLocale; - const LocaleDataWrapper& rLocaleData = aSysLocale.GetLocaleData(); + const LocaleDataWrapper& rLocaleData = Application::GetSettings().GetUILocaleDataWrapper(); const int nTimeArea = TimeFormatter::GetTimeArea(m_eFormat, m_xSpinButton->get_text(), nEndPos, rLocaleData); @@ -294,8 +292,7 @@ namespace weld int nStartPos, nEndPos; m_xSpinButton->get_selection_bounds(nStartPos, nEndPos); - const SvtSysLocale aSysLocale; - const LocaleDataWrapper& rLocaleData = aSysLocale.GetLocaleData(); + const LocaleDataWrapper& rLocaleData = Application::GetSettings().GetUILocaleDataWrapper(); tools::Time aResult(0); bool bRet = TimeFormatter::TextToTime(m_xSpinButton->get_text(), aResult, m_eFormat, true, rLocaleData); if (bRet) @@ -327,8 +324,7 @@ namespace weld OUString TimeSpinButton::format_number(int nValue) const { - const SvtSysLocale aSysLocale; - const LocaleDataWrapper& rLocaleData = aSysLocale.GetLocaleData(); + const LocaleDataWrapper& rLocaleData = Application::GetSettings().GetUILocaleDataWrapper(); return TimeFormatter::FormatTime(ConvertValue(nValue), m_eFormat, TimeFormat::Hour24, true, rLocaleData); } } |