return emptyStr;
}
int32_t resLen=0;
- const char *curLocaleName=locale.getName();
+ const char *curLocaleName=locale.getBaseName();
const UChar* s = ures_getStringByKey(locRes.getAlias(), curLocaleName, &resLen, &errCode);
if (s == nullptr) {
// Check parent locales.
UErrorCode status = U_ZERO_ERROR;
char parentLocaleName[ULOC_FULLNAME_CAPACITY];
- const char *curLocaleName2=locale.getName();
+ const char *curLocaleName2=locale.getBaseName();
uprv_strcpy(parentLocaleName, curLocaleName2);
while (uloc_getParent(parentLocaleName, parentLocaleName,
TESTCASE_AUTO(testParseErrors);
TESTCASE_AUTO(testFixedDecimal);
TESTCASE_AUTO(testSelectTrailingZeros);
+ TESTCASE_AUTO(testLocaleExtension);
TESTCASE_AUTO_END;
}
}
}
-
+void PluralRulesTest::testLocaleExtension() {
+ IcuTestErrorCode errorCode(*this, "testLocaleExtension");
+ LocalPointer<PluralRules> rules(PluralRules::forLocale("pt@calendar=gregorian", errorCode));
+ if (errorCode.errIfFailureAndReset("PluralRules::forLocale()")) { return; }
+ UnicodeString key = rules->select(1);
+ assertEquals("pt@calendar=gregorian select(1)", u"one", key);
+}
#endif /* #if !UCONFIG_NO_FORMATTING */
void testParseErrors();
void testFixedDecimal();
void testSelectTrailingZeros();
+ void testLocaleExtension();
void assertRuleValue(const UnicodeString& rule, double expected);
void assertRuleKeyValue(const UnicodeString& rule, const UnicodeString& key,
}
}
+ @Test
+ public void testLocaleExtension() {
+ PluralRules rules = PluralRules.forLocale(new ULocale("pt@calendar=gregorian"));
+ String key = rules.select(1);
+ assertEquals("pt@calendar=gregorian select(1)", "one", key);
+ }
+
@Test
public void testFunctionalEquivalent() {
// spot check