ICU-4739 add "no fallback" flag to resource bundles

X-SVN-Rev: 18836
This commit is contained in:
Markus Scherer 2005-11-29 00:10:07 +00:00
parent 7076ab9ce6
commit e08d580655
13 changed files with 96 additions and 22 deletions

View File

@ -412,7 +412,7 @@ $(OUTTMPDIR)/$(COLLATION_TREE)/$(INDEX_NAME).txt: $(SRCLISTDEPS)
@echo "generating $@ (list of installed collation locales)"; \
$(RMV) $@; \
echo "// Warning this file is automatically generated" > $@; \
echo "$(INDEX_NAME) {" >> $@; \
echo "$(INDEX_NAME):table(nofallback) {" >> $@; \
echo " InstalledLocales {" >> $@; \
for file in $(INSTALLED_COL_FILES); do \
echo " $$file {\"\"}" >> $@; \
@ -431,7 +431,7 @@ $(OUTTMPDIR)/$(RBNF_TREE)/$(INDEX_NAME).txt: $(SRCLISTDEPS)
@echo "generating $@ (list of installed RBNF locales)"; \
$(RMV) $@; \
echo "// Warning this file is automatically generated" > $@; \
echo "$(INDEX_NAME) {" >> $@; \
echo "$(INDEX_NAME):table(nofallback) {" >> $@; \
echo " InstalledLocales {" >> $@; \
for file in $(INSTALLED_RBNF_FILES); do \
echo " $$file {\"\"}" >> $@; \
@ -457,7 +457,7 @@ $(OUTTMPDIR)/$(INDEX_NAME).txt: $(SRCLISTDEPS)
@echo "generating $@ (list of installed locales)"; \
$(RMV) $@; \
echo "// Warning this file is automatically generated" > $@; \
echo "$(INDEX_NAME) {" >> $@; \
echo "$(INDEX_NAME):table(nofallback) {" >> $@; \
echo " InstalledLocales {" >> $@; \
for file in $(INSTALLED_RB_FILES); do \
echo " $$file {\"\"}" >> $@; \

View File

@ -25,7 +25,7 @@
# Generated by LDML2ICUConverter, from LDML source files.
# Aliases which do not have a corresponding xx.xml file (see deprecatedList.xml)
COLLATION_SYNTHETIC_ALIAS = de__PHONEBOOK.txt es__TRADITIONAL.txt hi__DIRECT.txt in.txt\
COLLATION_SYNTHETIC_ALIAS = de_.txt es_.txt hi_.txt zh_.txt de__PHONEBOOK.txt es__TRADITIONAL.txt hi__DIRECT.txt in.txt\
in_ID.txt iw.txt iw_IL.txt zh_TW_STROKE.txt zh__PINYIN.txt

View File

@ -484,7 +484,7 @@ CLEAN : GODATA
res_index.res:
@echo Generating <<res_index.txt
// Warning this file is automatically generated
res_index {
res_index:table(nofallback) {
InstalledLocales {
$(GENRB_SOURCE:.txt= {""}
)
@ -500,7 +500,7 @@ res_index {
$(ICUCOL)\res_index.res:
@echo Generating <<$(ICUCOL)\res_index.txt
// Warning this file is automatically generated
res_index {
res_index:table(nofallback) {
InstalledLocales {
$(COLLATION_SOURCE:.txt= {""}
)
@ -516,7 +516,7 @@ res_index {
$(ICURBNF)\res_index.res:
@echo Generating <<$(ICURBNF)\res_index.txt
// Warning this file is automatically generated
res_index {
res_index:table(nofallback) {
InstalledLocales {
$(RBNF_SOURCE:.txt= {""}
)

View File

@ -4,7 +4,7 @@
// * Corporation and others. All Rights Reserved.
// *
// ***************************************************************************
CurrencyData{
CurrencyData:table(nofallback){
// Currency metadata. Unlike the "Currencies" element, this is
// NOT true locale data. It exists only in root. The two
// integers are the fraction digits for each currency, and the

View File

@ -11,7 +11,7 @@
// >> !!! >>> DO NOT EDIT <<< !!! <<
//---------------------------------------------------------
zoneinfo {
zoneinfo:table(nofallback) {
Zones:array {
/* ACT */ :int { 310 } //Z#0
, /* AET */ :int { 321 } //Z#1

View File

@ -1,6 +1,6 @@
/********************************************************************
* COPYRIGHT:
* Copyright (c) 1997-2004, International Business Machines Corporation and
* Copyright (c) 1997-2005, International Business Machines Corporation and
* others. All Rights Reserved.
********************************************************************/
/*******************************************************************************
@ -459,7 +459,7 @@ static void TestFallback()
static void
TestOpenDirect(void) {
UResourceBundle *idna_rules, *item;
UResourceBundle *idna_rules, *casing, *te_IN, *ne, *item;
UErrorCode errorCode;
/*
@ -468,7 +468,7 @@ TestOpenDirect(void) {
* from root or similar
*/
errorCode=U_ZERO_ERROR;
idna_rules=ures_openDirect("testdata", "idna_rules", &errorCode);
idna_rules=ures_openDirect(loadTestData(&errorCode), "idna_rules", &errorCode);
if(U_FAILURE(errorCode)) {
log_err("ures_openDirect(\"idna_rules\") failed: %s\n", u_errorName(errorCode));
return;
@ -489,7 +489,7 @@ TestOpenDirect(void) {
}
/* try an item in root, must fail */
item=ures_getByKey(idna_rules, "Languages", NULL, &errorCode);
item=ures_getByKey(idna_rules, "ShortLanguage", NULL, &errorCode);
if(U_FAILURE(errorCode)) {
errorCode=U_ZERO_ERROR;
} else {
@ -527,6 +527,80 @@ TestOpenDirect(void) {
return;
}
ures_close(idna_rules);
/*
* ICU 3.6 has new resource bundle syntax and data for bundles that do not
* participate in locale fallback. Now,
* - ures_open() works like ures_openDirect() on a bundle with a top-level
* type of ":table(nofallback)" _if_ the bundle exists
* - ures_open() will continue to find a root bundle if the requested one
* does not exist, unlike ures_openDirect()
*
* Test with a different bundle than above to avoid confusion in the cache.
*/
/*
* verify that ures_open("casing"), which now has a nofallback declaration,
* does not enable fallbacks
*/
errorCode=U_ZERO_ERROR;
casing=ures_open("testdata", "casing", &errorCode);
if(U_FAILURE(errorCode)) {
log_err("ures_open(\"casing\") failed: %s\n", u_errorName(errorCode));
return;
}
errorCode=U_ZERO_ERROR;
item=ures_getByKey(casing, "Info", NULL, &errorCode);
if(U_FAILURE(errorCode)) {
log_err("casing.getByKey(Info) failed - %s\n", u_errorName(errorCode));
} else {
ures_close(item);
}
errorCode=U_ZERO_ERROR;
item=ures_getByKey(casing, "ShortLanguage", NULL, &errorCode);
if(U_SUCCESS(errorCode)) {
log_err("casing.getByKey(root key) succeeded despite nofallback declaration - %s\n", u_errorName(errorCode));
ures_close(item);
}
ures_close(casing);
/*
* verify that ures_open("ne") finds the root bundle but
* ures_openDirect("ne") does not
*/
errorCode=U_ZERO_ERROR;
ne=ures_open("testdata", "ne", &errorCode);
if(U_FAILURE(errorCode)) {
log_err("ures_open(\"ne\") failed (expected to get root): %s\n", u_errorName(errorCode));
}
if(errorCode!=U_USING_DEFAULT_WARNING || 0!=uprv_strcmp("root", ures_getLocale(ne, &errorCode))) {
log_err("ures_open(\"ne\") found something other than \"root\" - %s\n", u_errorName(errorCode));
}
ures_close(ne);
errorCode=U_ZERO_ERROR;
ne=ures_openDirect("testdata", "ne", &errorCode);
if(U_SUCCESS(errorCode)) {
log_err("ures_openDirect(\"ne\") succeeded unexpectedly\n");
ures_close(ne);
}
/* verify that ures_openDirect("te_IN") does not enable fallbacks */
errorCode=U_ZERO_ERROR;
te_IN=ures_openDirect("testdata", "te_IN", &errorCode);
if(U_FAILURE(errorCode)) {
log_err("ures_open(\"te_IN\") failed: %s\n", u_errorName(errorCode));
return;
}
errorCode=U_ZERO_ERROR;
item=ures_getByKey(te_IN, "ShortLanguage", NULL, &errorCode);
if(U_SUCCESS(errorCode)) {
log_err("te_IN.getByKey(root key) succeeded despite use of ures_openDirect() - %s\n", u_errorName(errorCode));
ures_close(item);
}
ures_close(te_IN);
}
static int32_t

View File

@ -1,6 +1,6 @@
// Copyright (c) 2001-2005 International Business Machines
// Corporation and others. All Rights Reserved.
DataDrivenCollationTest {
DataDrivenCollationTest:table(nofallback) {
Info {
Headers { "sequence" }
Description { "These are the data driven tests" }

View File

@ -5,7 +5,7 @@
//*
//*******************************************************************************
casing {
casing:table(nofallback) {
Info {
Description { "This is test data file for string casing." }

View File

@ -15,7 +15,7 @@
//
//*******************************************************************************
conversion {
conversion:table(nofallback) {
Info {
Description { "Test data for conversion" }
LongDescription {

View File

@ -15,7 +15,7 @@
//
//*****************************************************************************
icuio {
icuio:table(nofallback) {
Info {
Description { "Test data for ICU I/O" }
LongDescription {

View File

@ -1,8 +1,8 @@
// Copyright (C) 2003, International Business Machines
// Copyright (C) 2003-2005, International Business Machines
// WARNING: This file is machine generated by debug\genidn tool. Please DO NOT edit.
idna_rules{
idna_rules:table(nofallback){
UnassignedSet{"[ \\u0221 \\u0234-\\u024F \\u02AE-\\u02AF \\u02EF-\\u02FF \\u0350-\\u035F \\u0370-\\u0373 "
"\\u0376-\\u0379 \\u037B-\\u037D \\u037F-\\u0383 \\u038B \\u038D \\u03A2 \\u03CF "

View File

@ -1,10 +1,10 @@
//*******************************************************************************
//*
//*Copyright(C)1998-2000InternationalBusinessMachines
//*Copyright(C)1998-2005InternationalBusinessMachines
//*Corporationandothers.AllRightsReserved.
//*
//*******************************************************************************
iscii{
iscii:table(nofallback){
str{
" ï4ï3ÍÝï4ï3Æá×è³å .³á .¬³ .¤ÅèÍÍÆ .³á ¤ÆÝ×ÚÏ 1990 ³ ³¢ÈèÍÞ½Ï-ÈèÏÊ¢ÅÛ ×Þ¸ÆÚ"
"ÈèÏÁÚÑÜ .³á .ÍåµÄÚÆ .³á .ÉÑ×èÔÏÞÈ .ÔÛÕèÔ .Ìᢠ.×ÚÑÚÆÚ .2200 ¤ÏÊ ÏÝÈÍá ÌÞÑèÍ"

View File

@ -9,7 +9,7 @@
// Since ICU doesn't follow the traditional fallback model where all keys fallback to root,
// root can't be used to validate the structure.
// This file was generated from en.txt, and all ".*" were replaced with "".
structLocale{
structLocale:table(nofallback){
BreakDictionaryData:bin {00}
Countries{
001{""}