From b24d71cf9017bf19e2a66581c24e9bae50e50485 Mon Sep 17 00:00:00 2001 From: Markus Scherer Date: Wed, 16 Dec 2015 22:29:21 +0000 Subject: [PATCH] ICU-12041 check that per-unit patterns have one placeholder, fix patterns X-SVN-Rev: 38139 --- icu4c/source/data/unit/ar.txt | 2 +- icu4c/source/data/unit/de.txt | 2 +- icu4c/source/data/unit/dsb.txt | 4 ++-- icu4c/source/data/unit/hsb.txt | 4 ++-- icu4c/source/data/unit/lv.txt | 10 +++++----- icu4c/source/data/unit/my.txt | 4 ++-- icu4c/source/data/unit/pt_PT.txt | 2 +- icu4c/source/data/unit/ro.txt | 2 +- icu4c/source/data/unit/si.txt | 2 +- icu4c/source/data/unit/sr.txt | 2 +- icu4c/source/data/unit/sr_Latn.txt | 2 +- icu4c/source/data/unit/tr.txt | 6 +++--- icu4c/source/i18n/measfmt.cpp | 14 +++++++++----- 13 files changed, 30 insertions(+), 26 deletions(-) diff --git a/icu4c/source/data/unit/ar.txt b/icu4c/source/data/unit/ar.txt index 883e97c8e39..d6a1d3fb88e 100755 --- a/icu4c/source/data/unit/ar.txt +++ b/icu4c/source/data/unit/ar.txt @@ -400,7 +400,7 @@ ar{ many{"{0} سنة"} one{"سنة"} other{"{0} سنة"} - per{"في السنة"} + per{"{0} في السنة"} two{"سنتان"} zero{"{0} سنة"} } diff --git a/icu4c/source/data/unit/de.txt b/icu4c/source/data/unit/de.txt index 9ec6e5d8c14..eab9dc16736 100755 --- a/icu4c/source/data/unit/de.txt +++ b/icu4c/source/data/unit/de.txt @@ -467,7 +467,7 @@ de{ dnam{"Unzen"} one{"{0} Unze"} other{"{0} Unzen"} - per{"pro Unze"} + per{"{0} pro Unze"} } ounce-troy{ dnam{"Feinunzen"} diff --git a/icu4c/source/data/unit/dsb.txt b/icu4c/source/data/unit/dsb.txt index fbdfc9f8092..d972a0d0170 100755 --- a/icu4c/source/data/unit/dsb.txt +++ b/icu4c/source/data/unit/dsb.txt @@ -226,7 +226,7 @@ dsb{ few{"{0} góźiny"} one{"{0} góźina"} other{"{0} góźinow"} - per{"na góźinu"} + per{"{0} na góźinu"} two{"{0} góźinje"} } microsecond{ @@ -269,7 +269,7 @@ dsb{ few{"{0} sekundy"} one{"{0} sekunda"} other{"{0} sekundow"} - per{"na sekundu"} + per{"{0} na sekundu"} two{"{0} sekunźe"} } week{ diff --git a/icu4c/source/data/unit/hsb.txt b/icu4c/source/data/unit/hsb.txt index 747481ea437..bdf51126566 100755 --- a/icu4c/source/data/unit/hsb.txt +++ b/icu4c/source/data/unit/hsb.txt @@ -226,7 +226,7 @@ hsb{ few{"{0} hodźiny"} one{"{0} hodźina"} other{"{0} hodźinow"} - per{"na hodźinu"} + per{"{0} na hodźinu"} two{"{0} hodźinje"} } microsecond{ @@ -269,7 +269,7 @@ hsb{ few{"{0} sekundy"} one{"{0} sekunda"} other{"{0} sekundow"} - per{"na sekundu"} + per{"{0} na sekundu"} two{"{0} sekundźe"} } week{ diff --git a/icu4c/source/data/unit/lv.txt b/icu4c/source/data/unit/lv.txt index 81e8a2345b6..1536fca1e1b 100755 --- a/icu4c/source/data/unit/lv.txt +++ b/icu4c/source/data/unit/lv.txt @@ -77,7 +77,7 @@ lv{ dnam{"kvadrātcentimetri"} one{"{0} kvadrātcentimetrs"} other{"{0} kvadrātcentimetri"} - per{"uz kvadrātcentimetru"} + per{"{0} uz kvadrātcentimetru"} zero{"{0} kvadrātcentimetri"} } square-foot{ @@ -103,7 +103,7 @@ lv{ dnam{"kvadrātmetri"} one{"{0} kvadrātmetrs"} other{"{0} kvadrātmetri"} - per{"uz kvadrātmetru"} + per{"{0} uz kvadrātmetru"} zero{"{0} kvadrātmetri"} } square-mile{ @@ -704,7 +704,7 @@ lv{ dnam{"kubikcentimetri"} one{"{0} kubikcentimetrs"} other{"{0} kubikcentimetri"} - per{"uz kubikcentimetru"} + per{"{0} uz kubikcentimetru"} zero{"{0} kubikcentimetri"} } cubic-foot{ @@ -729,7 +729,7 @@ lv{ dnam{"kubikmetri"} one{"{0} kubikmetrs"} other{"{0} kubikmetri"} - per{"uz kubikmetru"} + per{"{0} uz kubikmetru"} zero{"{0} kubikmetri"} } cubic-mile{ @@ -779,7 +779,7 @@ lv{ dnam{"litri"} one{"{0} litrs"} other{"{0} litri"} - per{"uz litru"} + per{"{0} uz litru"} zero{"{0} litri"} } megaliter{ diff --git a/icu4c/source/data/unit/my.txt b/icu4c/source/data/unit/my.txt index 0a24ab4e0c7..07b5dccb9f8 100755 --- a/icu4c/source/data/unit/my.txt +++ b/icu4c/source/data/unit/my.txt @@ -386,7 +386,7 @@ my{ pound{ dnam{"ပေါင်"} other{"{0}ပေါင်"} - per{"တစ်ပေါင်လျှင်"} + per{"{0}တစ်ပေါင်လျှင်"} } ton{ dnam{"တန်"} @@ -512,7 +512,7 @@ my{ cubic-meter{ dnam{"ကုဗမီတာ"} other{"{0}ကုဗမီတာ"} - per{"တစ်ကုဗစင်တီမီတာလျှင်"} + per{"{0}တစ်ကုဗမီတာလျှင်"} } cubic-mile{ dnam{"ကုဗမိုင်"} diff --git a/icu4c/source/data/unit/pt_PT.txt b/icu4c/source/data/unit/pt_PT.txt index a3b82c77a22..3108255e3ce 100755 --- a/icu4c/source/data/unit/pt_PT.txt +++ b/icu4c/source/data/unit/pt_PT.txt @@ -110,7 +110,7 @@ pt_PT{ } volume{ cubic-centimeter{ - per{"por centímetro cúbico"} + per{"{0} por centímetro cúbico"} } cubic-kilometer{ dnam{"quilómetros cúbicos"} diff --git a/icu4c/source/data/unit/ro.txt b/icu4c/source/data/unit/ro.txt index a31e161fac1..e74eaa88bda 100755 --- a/icu4c/source/data/unit/ro.txt +++ b/icu4c/source/data/unit/ro.txt @@ -504,7 +504,7 @@ ro{ few{"{0} grame"} one{"{0} gram"} other{"{0} de grame"} - per{"per gram"} + per{"{0} per gram"} } kilogram{ dnam{"kilograme"} diff --git a/icu4c/source/data/unit/si.txt b/icu4c/source/data/unit/si.txt index 1f4da6b8237..47fae311ddb 100755 --- a/icu4c/source/data/unit/si.txt +++ b/icu4c/source/data/unit/si.txt @@ -230,7 +230,7 @@ si{ dnam{"තත්පර"} one{"තත්පර {0}"} other{"තත්පර {0}"} - per{"තත්පරයට"} + per{"තත්පරයට {0}"} } week{ dnam{"සති"} diff --git a/icu4c/source/data/unit/sr.txt b/icu4c/source/data/unit/sr.txt index a00f8aa95ce..2d099605658 100755 --- a/icu4c/source/data/unit/sr.txt +++ b/icu4c/source/data/unit/sr.txt @@ -772,7 +772,7 @@ sr{ few{"{0} литра"} one{"{0} литар"} other{"{0} литара"} - per{"по литри"} + per{"{0} по литри"} } megaliter{ dnam{"мегалитри"} diff --git a/icu4c/source/data/unit/sr_Latn.txt b/icu4c/source/data/unit/sr_Latn.txt index 82830ae527f..0fe7b9e1fc6 100755 --- a/icu4c/source/data/unit/sr_Latn.txt +++ b/icu4c/source/data/unit/sr_Latn.txt @@ -773,7 +773,7 @@ sr_Latn{ few{"{0} litra"} one{"{0} litar"} other{"{0} litara"} - per{"po litri"} + per{"{0} po litri"} } megaliter{ dnam{"megalitri"} diff --git a/icu4c/source/data/unit/tr.txt b/icu4c/source/data/unit/tr.txt index 8f5c1f05273..39411a9a819 100755 --- a/icu4c/source/data/unit/tr.txt +++ b/icu4c/source/data/unit/tr.txt @@ -68,7 +68,7 @@ tr{ dnam{"santimetrekare"} one{"{0} santimetrekare"} other{"{0} santimetrekare"} - per{"/santimetrekare"} + per{"{0}/santimetrekare"} } square-foot{ dnam{"fit kare"} @@ -90,7 +90,7 @@ tr{ dnam{"metrekare"} one{"{0} metrekare"} other{"{0} metrekare"} - per{"/metrekare"} + per{"{0}/metrekare"} } square-mile{ dnam{"mil kare"} @@ -642,7 +642,7 @@ tr{ dnam{"metreküp"} one{"{0} metreküp"} other{"{0} metreküp"} - per{"/metreküp"} + per{"{0}/metreküp"} } cubic-mile{ dnam{"mil küp"} diff --git a/icu4c/source/i18n/measfmt.cpp b/icu4c/source/i18n/measfmt.cpp index a73ff6eaf79..b37bc19d279 100644 --- a/icu4c/source/i18n/measfmt.cpp +++ b/icu4c/source/i18n/measfmt.cpp @@ -241,9 +241,7 @@ struct UnitDataSink : public ResourceTableSink { // Skip the unit display name for now. } else if (uprv_strcmp(key, "per") == 0) { // For example, "{0}/h". - // TODO: Set minPlaceholders=1 - // after http://unicode.org/cldr/trac/ticket/9129 is fixed. - setFormatterIfAbsent(MeasureFormatCacheData::PER_UNIT_INDEX, value, 0, errorCode); + setFormatterIfAbsent(MeasureFormatCacheData::PER_UNIT_INDEX, value, 1, errorCode); } else { // The key must be one of the plural form strings. For example: // one{"{0} hr"} @@ -606,7 +604,9 @@ MeasureFormat::MeasureFormat(const MeasureFormat &other) : cache->addRef(); numberFormat->addRef(); pluralRules->addRef(); - listFormatter = new ListFormatter(*other.listFormatter); + if (other.listFormatter != NULL) { + listFormatter = new ListFormatter(*other.listFormatter); + } } MeasureFormat &MeasureFormat::operator=(const MeasureFormat &other) { @@ -619,7 +619,11 @@ MeasureFormat &MeasureFormat::operator=(const MeasureFormat &other) { SharedObject::copyPtr(other.pluralRules, pluralRules); width = other.width; delete listFormatter; - listFormatter = new ListFormatter(*other.listFormatter); + if (other.listFormatter != NULL) { + listFormatter = new ListFormatter(*other.listFormatter); + } else { + listFormatter = NULL; + } return *this; } -- 2.40.0