static const UChar u_T=0x54;
static const UChar u_U=0x55;
static const UChar u_Z=0x5A;
-static const UChar u__=0x5F; // '_'
static const UChar u_a=0x61;
static const UChar u_c=0x63;
static const UChar u_d=0x64;
} else if(isSelect(typeIndex)) {
argType=UMSGPAT_ARG_TYPE_SELECT;
}
- } else if(length==9) {
- if(isOrdinal(typeIndex)) {
- argType=UMSGPAT_ARG_TYPE_ORDINAL;
+ } else if(length==13) {
+ if(isSelect(typeIndex) && isOrdinal(typeIndex+6)) {
+ argType=UMSGPAT_ARG_TYPE_SELECTORDINAL;
}
}
// change the ARG_START type from NONE to argType
MessagePattern::isOrdinal(int32_t index) {
UChar c;
return
- ((c=msg.charAt(index++))==u_p || c==u_P) &&
- ((c=msg.charAt(index++))==u_l || c==u_L) &&
((c=msg.charAt(index++))==u_o || c==u_O) &&
((c=msg.charAt(index++))==u_r || c==u_R) &&
((c=msg.charAt(index++))==u_d || c==u_D) &&
* <pre>
* message = messageText (argument messageText)*
* argument = noneArg | simpleArg | complexArg
- * complexArg = choiceArg | pluralArg | ordinalArg | selectArg
+ * complexArg = choiceArg | pluralArg | selectArg | selectordinalArg
*
* noneArg = '{' argNameOrNumber '}'
* simpleArg = '{' argNameOrNumber ',' argType [',' argStyle] '}'
* choiceArg = '{' argNameOrNumber ',' "choice" ',' choiceStyle '}'
* pluralArg = '{' argNameOrNumber ',' "plural" ',' pluralStyle '}'
- * ordinalArg = '{' argNameOrNumber ',' "plordinal" ',' pluralStyle '}'
* selectArg = '{' argNameOrNumber ',' "select" ',' selectStyle '}'
+ * selectordinalArg = '{' argNameOrNumber ',' "selectordinal" ',' pluralStyle '}'
*
* choiceStyle: see {@link ChoiceFormat}
* pluralStyle: see {@link PluralFormat}
TESTCASE_AUTO(TestCompatibleApostrophe);
TESTCASE_AUTO(testCoverage);
TESTCASE_AUTO(TestTrimArgumentName);
- TESTCASE_AUTO(TestOrdinalPlural);
+ TESTCASE_AUTO(TestSelectOrdinal);
TESTCASE_AUTO_END;
}
m.format(&argName, args, 1, result, errorCode));
}
-void TestMessageFormat::TestOrdinalPlural() {
- IcuTestErrorCode errorCode(*this, "TestOrdinalPlural");
+void TestMessageFormat::TestSelectOrdinal() {
+ IcuTestErrorCode errorCode(*this, "TestSelectOrdinal");
// Test plural & ordinal together,
// to make sure that we get the correct cached PluralSelector for each.
MessageFormat m(
"{0,plural,one{1 file}other{# files}}, "
- "{0,plordinal,one{#st file}two{#nd file}few{#rd file}other{#th file}}",
+ "{0,selectordinal,one{#st file}two{#nd file}few{#rd file}other{#th file}}",
Locale::getEnglish(), errorCode);
if (errorCode.logDataIfFailureAndReset("Unable to instantiate MessageFormat")) {
return;
Formattable args[1] = { (int32_t)21 };
FieldPosition ignore(0);
UnicodeString result;
- assertEquals("plural-ordinal format(21) failed", "21 files, 21st file",
+ assertEquals("plural-and-ordinal format(21) failed", "21 files, 21st file",
m.format(args, 1, result, ignore, errorCode));
args[0].setLong(2);
- assertEquals("plural-ordinal format(2) failed", "2 files, 2nd file",
+ assertEquals("plural-and-ordinal format(2) failed", "2 files, 2nd file",
m.format(args, 1, result.remove(), ignore, errorCode));
args[0].setLong(1);
- assertEquals("plural-ordinal format(1) failed", "1 file, 1st file",
+ assertEquals("plural-and-ordinal format(1) failed", "1 file, 1st file",
m.format(args, 1, result.remove(), ignore, errorCode));
args[0].setLong(3);
- assertEquals("plural-ordinal format(3) failed", "3 files, 3rd file",
+ assertEquals("plural-and-ordinal format(3) failed", "3 files, 3rd file",
m.format(args, 1, result.remove(), ignore, errorCode));
}