[Libreoffice-commits] core.git: 2 commits - i18nutil/source vcl/source
Caolán McNamara
caolanm at redhat.com
Wed Jan 22 05:16:30 PST 2014
i18nutil/source/utility/unicode.cxx | 13 ++++++++++++-
vcl/source/control/field.cxx | 1 +
vcl/source/src/units.src | 1 -
3 files changed, 13 insertions(+), 2 deletions(-)
New commits:
commit f03ce265db73388f3e0de97e4b0c8129cfc85d1f
Author: Caolán McNamara <caolanm at redhat.com>
Date: Wed Jan 22 13:06:52 2014 +0000
drop translation of % now that we use icu to format it
Change-Id: Ia53815018cc5438ffbc2fecf2ec65ce69f1b90c5
diff --git a/vcl/source/control/field.cxx b/vcl/source/control/field.cxx
index b765ded..96bfbdb 100644
--- a/vcl/source/control/field.cxx
+++ b/vcl/source/control/field.cxx
@@ -1440,6 +1440,7 @@ OUString MetricFormatter::CreateFieldText( sal_Int64 nValue ) const
{
if (meUnit != FUNIT_NONE && meUnit != FUNIT_DEGREE)
aStr += " ";
+ assert(meUnit != FUNIT_PERCENT);
aStr += ImplMetricToString( meUnit );
}
return aStr;
diff --git a/vcl/source/src/units.src b/vcl/source/src/units.src
index 2e40585..5de6209 100644
--- a/vcl/source/src/units.src
+++ b/vcl/source/src/units.src
@@ -42,7 +42,6 @@ StringArray SV_FUNIT_STRINGS
< "mile" ; FUNIT_MILE ; > ;
< "ch" ; FUNIT_CHAR ; > ;
< "line" ; FUNIT_LINE ; > ;
- < "%" ; FUNIT_PERCENT ; > ;
< "pixels" ; FUNIT_PIXEL ; > ;
< "pixel" ; FUNIT_PIXEL ; > ;
< "°" ; FUNIT_DEGREE ; > ;
commit 486e318b86943844011ef881556dabb4a3f7ef33
Author: Caolán McNamara <caolanm at redhat.com>
Date: Wed Jan 22 12:57:07 2014 +0000
CLDR Version 24 doesn't know about es and sl using space before %
Change-Id: I1c3e7dc28e389a9580239165d04b171e06f5618e
diff --git a/i18nutil/source/utility/unicode.cxx b/i18nutil/source/utility/unicode.cxx
index 5ef4fb5..ff92805 100644
--- a/i18nutil/source/utility/unicode.cxx
+++ b/i18nutil/source/utility/unicode.cxx
@@ -945,7 +945,18 @@ OUString SAL_CALL unicode::formatPercent(double dNumber,
{
// get a currency formatter for this locale ID
UErrorCode errorCode=U_ZERO_ERROR;
- icu::Locale aLocale = LanguageTagIcu::getIcuLocale(rLangTag);
+
+ LanguageTag aLangTag(rLangTag);
+
+ // As of CLDR Version 24 these languages were not listed as using spacing
+ // between number and % but are reported as such by our l10n groups
+ // http://www.unicode.org/cldr/charts/24/by_type/numbers.number_formatting_patterns.html
+ // so format using French which has the desired rules
+ if (aLangTag.getLanguage() == "es" || aLangTag.getLanguage() == "sl")
+ aLangTag = LanguageTag("fr-FR");
+
+ icu::Locale aLocale = LanguageTagIcu::getIcuLocale(aLangTag);
+
boost::scoped_ptr<NumberFormat> xF(
NumberFormat::createPercentInstance(aLocale, errorCode));
if(U_FAILURE(errorCode))
More information about the Libreoffice-commits
mailing list