本文整理汇总了C++中Locale::getBaseName方法的典型用法代码示例。如果您正苦于以下问题:C++ Locale::getBaseName方法的具体用法?C++ Locale::getBaseName怎么用?C++ Locale::getBaseName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Locale
的用法示例。
在下文中一共展示了Locale::getBaseName方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ustrValue
UnicodeString&
LocaleDisplayNamesImpl::keyValueDisplayName(const char* key,
const char* value,
UnicodeString& result,
UBool skipAdjust) const {
if (uprv_strcmp(key, "currency") == 0) {
// ICU4C does not have ICU4J CurrencyDisplayInfo equivalent for now.
UErrorCode sts = U_ZERO_ERROR;
UnicodeString ustrValue(value, -1, US_INV);
int32_t len;
UBool isChoice = FALSE;
const UChar *currencyName = ucurr_getName(ustrValue.getTerminatedBuffer(),
locale.getBaseName(), UCURR_LONG_NAME, &isChoice, &len, &sts);
if (U_FAILURE(sts)) {
// Return the value as is on failure
result = ustrValue;
return result;
}
result.setTo(currencyName, len);
return skipAdjust? result: adjustForUsageAndContext(kCapContextUsageKeyValue, result);
}
if (nameLength == UDISPCTX_LENGTH_SHORT) {
langData.get("Types%short", key, value, result);
if (!result.isBogus()) {
return skipAdjust? result: adjustForUsageAndContext(kCapContextUsageKeyValue, result);
}
}
langData.get("Types", key, value, result);
return skipAdjust? result: adjustForUsageAndContext(kCapContextUsageKeyValue, result);
}
示例2: localeName
UnicodeString
RuleBasedNumberFormat::getRuleSetDisplayName(int32_t index, const Locale& localeParam) {
if (localizations && index >= 0 && index < localizations->getNumberOfRuleSets()) {
UnicodeString localeName(localeParam.getBaseName(), -1, UnicodeString::kInvariant);
int32_t len = localeName.length();
UChar* localeStr = localeName.getBuffer(len + 1);
while (len >= 0) {
localeStr[len] = 0;
int32_t ix = localizations->indexForLocale(localeStr);
if (ix >= 0) {
UnicodeString name(TRUE, localizations->getDisplayName(ix, index), -1);
return name;
}
// trim trailing portion, skipping over ommitted sections
do { --len;} while (len > 0 && localeStr[len] != 0x005f); // underscore
while (len > 0 && localeStr[len-1] == 0x005F) --len;
}
UnicodeString name(TRUE, localizations->getRuleSetName(index), -1);
return name;
}
UnicodeString bogus;
bogus.setToBogus();
return bogus;
}
示例3: create
GLUE_SYM ( Collator ) :: create (const Locale &loc, const char */*ver*/) {
// TODO: save 'ver' off.
UErrorCode status = U_ZERO_ERROR;
char locBuf[200];
char kwvBuf[200];
int32_t len = loc.getKeywordValue("collation", kwvBuf, 200, status);
strcpy(locBuf,loc.getBaseName());
if(len>0) {
strcat(locBuf,"@collator=");
strcat(locBuf,kwvBuf);
}
UCollator * uc = OICU_ucol_open( locBuf, status);
if(U_FAILURE(status)) return NULL; // TODO: ERR?
Collator *c = new GLUE_SYM( Collator ) ( uc );
#if COLL_FE_DEBUG
fprintf(stderr, "VCF " ICUGLUE_VER_STR " ucol_open=%s ->> %p\n", locBuf, c);
#endif
return c;
}
示例4:
void
RelativeDateFormat::initCapitalizationContextInfo(const Locale& thelocale)
{
#if !UCONFIG_NO_BREAK_ITERATION
const char * localeID = (thelocale != NULL)? thelocale.getBaseName(): NULL;
UErrorCode status = U_ZERO_ERROR;
UResourceBundle *rb = ures_open(NULL, localeID, &status);
rb = ures_getByKeyWithFallback(rb, "contextTransforms", rb, &status);
rb = ures_getByKeyWithFallback(rb, "relative", rb, &status);
if (U_SUCCESS(status) && rb != NULL) {
int32_t len = 0;
const int32_t * intVector = ures_getIntVector(rb, &len, &status);
if (U_SUCCESS(status) && intVector != NULL && len >= 2) {
fCapitalizationOfRelativeUnitsForUIListMenu = intVector[0];
fCapitalizationOfRelativeUnitsForStandAlone = intVector[1];
}
}
ures_close(rb);
#endif
}
示例5: b
SimpleFilteredBreakIteratorBuilder::SimpleFilteredBreakIteratorBuilder(const Locale &fromLocale, UErrorCode &status)
: fSet()
{
if(U_SUCCESS(status)) {
LocalUResourceBundlePointer b(ures_open(U_ICUDATA_BRKITR, fromLocale.getBaseName(), &status));
LocalUResourceBundlePointer exceptions(ures_getByKeyWithFallback(b.getAlias(), "exceptions", NULL, &status));
LocalUResourceBundlePointer breaks(ures_getByKeyWithFallback(exceptions.getAlias(), "SentenceBreak", NULL, &status));
if(U_FAILURE(status)) return; // leaves the builder empty, if you try to use it.
LocalUResourceBundlePointer strs;
UErrorCode subStatus = status;
do {
strs.adoptInstead(ures_getNextResource(breaks.getAlias(), strs.orphan(), &subStatus));
if(strs.isValid() && U_SUCCESS(subStatus)) {
UnicodeString str(ures_getUnicodeString(strs.getAlias(), &status));
suppressBreakAfter(str, status); // load the string
}
} while (strs.isValid() && U_SUCCESS(subStatus));
if(U_FAILURE(subStatus)&&subStatus!=U_INDEX_OUTOFBOUNDS_ERROR&&U_SUCCESS(status)) {
status = subStatus;
}
}
}
示例6:
std::string L10n::GetLocaleBaseName(const std::string& locale) const
{
Locale loc = Locale::createCanonical(locale.c_str());
return loc.getBaseName();
}
示例7: fFillin
CalendarData::CalendarData(const Locale& loc, const char *type, UErrorCode& status)
: fFillin(NULL), fOtherFillin(NULL), fBundle(NULL), fFallback(NULL) {
initData(loc.getBaseName(), type, status);
}