ICU-142 In rb_parse(), detect the "%%ALIAS" tag. If found,
use the alias locale name and parse that locale instead. In parseIfUnparsed(), made sure to check for that and reparse the new file. X-SVN-Rev: 463
This commit is contained in:
parent
80bd3a9090
commit
9cc25e5df9
@ -301,6 +301,11 @@ rb_parse(FileStream *f,
|
||||
switch(itemtype) {
|
||||
case sSTRINGLIST:
|
||||
strlist = read_strlist(f, listname, status);
|
||||
if (listname == "%%ALIAS") {
|
||||
localename = strlist->fStrings[0];
|
||||
uhash_close(retval);
|
||||
return 0;
|
||||
}
|
||||
uhash_putKey(retval, listname.hashCode() & 0x7FFFFFFF,
|
||||
strlist, &status);
|
||||
if(U_FAILURE(status)) {
|
||||
|
@ -442,7 +442,7 @@ ResourceBundle::getHashtableForLocale(const UnicodeString& desiredLocale,
|
||||
if(parseIfUnparsed(fPath, iterator.getLocale(),
|
||||
fgCache, fgVisitedFiles, error)) {
|
||||
if(U_FAILURE(error))
|
||||
return 0;
|
||||
return 0;
|
||||
|
||||
error = U_ZERO_ERROR;
|
||||
h = getFromCacheWithFallback(fPath, desiredLocale,
|
||||
@ -1076,7 +1076,7 @@ ResourceBundle::parse(const PathInfo& path,
|
||||
UErrorCode& status)
|
||||
{
|
||||
FileStream *f;
|
||||
UnicodeString localeName;
|
||||
UnicodeString localeName, realLocale;
|
||||
UHashtable *data;
|
||||
|
||||
if (U_FAILURE(status)) return;
|
||||
@ -1087,6 +1087,7 @@ ResourceBundle::parse(const PathInfo& path,
|
||||
return;
|
||||
}
|
||||
|
||||
realLocale = locale;
|
||||
/* Get the data from the compiled resource bundle file */
|
||||
data = rb_parse(f, localeName, status);
|
||||
|
||||
@ -1096,6 +1097,21 @@ ResourceBundle::parse(const PathInfo& path,
|
||||
if(U_FAILURE(status)) {
|
||||
return;
|
||||
}
|
||||
/* If an alias file is encountered, parse the new locale file. */
|
||||
if (data == 0) {
|
||||
f = path.openFile(localeName);
|
||||
if(f == 0) {
|
||||
status = U_FILE_ACCESS_ERROR;
|
||||
return;
|
||||
}
|
||||
data = rb_parse(f, localeName, status);
|
||||
T_FileStream_close(f);
|
||||
|
||||
if(U_FAILURE(status)) {
|
||||
return;
|
||||
}
|
||||
localeName = realLocale;
|
||||
}
|
||||
|
||||
/* Invoke the handler function */
|
||||
handler(localeName, data, context, fgCache);
|
||||
|
Loading…
Reference in New Issue
Block a user