Kaydet (Commit) 3abd8b51 authored tarafından Mike Kaganski's avatar Mike Kaganski

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/52251Reviewed-by: 's avatarMike Kaganski <mike.kaganski@collabora.com>
Tested-by: 's avatarMike Kaganski <mike.kaganski@collabora.com>
üst 5c573a2f
......@@ -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 );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment