diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2018-04-02 08:48:09 +0100 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2018-04-02 10:45:35 +0200 |
commit | 3abd8b51cd855cf55dbc0f3cfeb8390a783372fc (patch) | |
tree | 2cc2980ee8feaece22d70a46679aad3ba8f22556 /vcl | |
parent | 5c573a2f7473bae7bb965ca36557cd1b0bf7b9c9 (diff) |
Also use GetLanguageTag() for formatting percents
Reading MetricFormatter value (in MetricFormatter::GetValueFromStringUnit)
uses ImplGetLocaleDataWrapper() to convert the string using current locale
(including decimal and thousands separator), which calls GetLanguageTag().
On the other hand, in case of percent value, setting the control text (in
MetricFormatter::CreateFieldText) uses Application::GetSettings().GetUILanguageTag().
This gives wrong results e.g. when UI language is different from locale.
For instance, if UI language is English (US), and locale is Russian, then
increasing from "999 %" would give "1,000 %" (using English (US) locale),
and then reading back, it would be processed as 1 % (using Russian locale,
where comma is decimal separator).
This change unifies setting percent text to also use GetLanguageTag().
Change-Id: I9b8a2ee5d3be709a8db3807ea81e105d6475b6a4
Reviewed-on: https://gerrit.libreoffice.org/52251
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Tested-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/source/control/field.cxx | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/vcl/source/control/field.cxx b/vcl/source/control/field.cxx index 8d5fec70ec8a..a59557dcbb9b 100644 --- a/vcl/source/control/field.cxx +++ b/vcl/source/control/field.cxx @@ -1381,7 +1381,7 @@ OUString MetricFormatter::CreateFieldText( sal_Int64 nValue ) const { double dValue = nValue; dValue /= ImplPower10(GetDecimalDigits()); - return unicode::formatPercent(dValue, Application::GetSettings().GetUILanguageTag()); + return unicode::formatPercent(dValue, GetLanguageTag()); } OUString aStr = NumericFormatter::CreateFieldText( nValue ); |