Change the catalog loading so it will crawl up the catalogs even if the rt root one is not found. This will allow to load "fr" even if "fr_FR" is not found. This way the preflet in its current state works again.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35787 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -600,33 +600,36 @@ BLocaleRoster::LoadCatalog(const char *signature, const char *language,
|
|||||||
const char *lang;
|
const char *lang;
|
||||||
for (int32 l=0; languages.FindString("language", l, &lang)==B_OK; ++l) {
|
for (int32 l=0; languages.FindString("language", l, &lang)==B_OK; ++l) {
|
||||||
catalog = info->fInstantiateFunc(signature, lang, fingerprint);
|
catalog = info->fInstantiateFunc(signature, lang, fingerprint);
|
||||||
if (catalog) {
|
if (catalog)
|
||||||
info->fLoadedCatalogs.AddItem(catalog);
|
info->fLoadedCatalogs.AddItem(catalog);
|
||||||
// Chain-load catalogs for languages that depend on
|
// Chain-load catalogs for languages that depend on
|
||||||
// other languages.
|
// other languages.
|
||||||
// The current implementation uses the filename in order to
|
// The current implementation uses the filename in order to
|
||||||
// detect dependencies (parenthood) between languages (it
|
// detect dependencies (parenthood) between languages (it
|
||||||
// traverses from "english-british-oxford" to "english-british"
|
// traverses from "english-british-oxford" to "english-british"
|
||||||
// to "english"):
|
// to "english"):
|
||||||
// TODO :use ICU facilities instead, so we can handle more
|
// TODO :use ICU facilities instead, so we can handle more
|
||||||
// complex things such as fr_FR@euro, or whatever, encodings
|
// complex things such as fr_FR@euro, or whatever, encodings
|
||||||
// and so on.
|
// and so on.
|
||||||
int32 pos;
|
int32 pos;
|
||||||
BString langName(lang);
|
BString langName(lang);
|
||||||
BCatalogAddOn *currCatalog=catalog, *nextCatalog;
|
BCatalogAddOn *currCatalog=catalog, *nextCatalog;
|
||||||
while ((pos = langName.FindLast('-')) >= 0) {
|
while ((pos = langName.FindLast('_')) >= 0) {
|
||||||
// language is based on parent, so we load that, too:
|
// language is based on parent, so we load that, too:
|
||||||
langName.Truncate(pos);
|
// (even if the parent catalog was not found)
|
||||||
nextCatalog = info->fInstantiateFunc(signature,
|
langName.Truncate(pos);
|
||||||
langName.String(), fingerprint);
|
nextCatalog = info->fInstantiateFunc(signature,
|
||||||
if (nextCatalog) {
|
langName.String(), fingerprint);
|
||||||
info->fLoadedCatalogs.AddItem(nextCatalog);
|
if (nextCatalog) {
|
||||||
|
info->fLoadedCatalogs.AddItem(nextCatalog);
|
||||||
|
if(currCatalog)
|
||||||
currCatalog->fNext = nextCatalog;
|
currCatalog->fNext = nextCatalog;
|
||||||
currCatalog = nextCatalog;
|
else
|
||||||
}
|
catalog = nextCatalog;
|
||||||
|
currCatalog = nextCatalog;
|
||||||
}
|
}
|
||||||
return catalog;
|
|
||||||
}
|
}
|
||||||
|
return catalog;
|
||||||
}
|
}
|
||||||
info->UnloadIfPossible();
|
info->UnloadIfPossible();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user