Locale prefs: skip script-specific entries
Avoids showing the same language multiple times in the list, for example when there are cyrillic and latin variants. It is still possible to pick one of the variants, as they are also added as country-specific entries. Fixes #9144.
This commit is contained in:
parent
006a34e40e
commit
975ec13e71
@ -113,9 +113,10 @@ LocaleWindow::LocaleWindow()
|
||||
|
||||
// TODO: the following block fails to detect a couple of language
|
||||
// names as containing glyphs we can't render. Why's that?
|
||||
bool hasGlyphs[name.CountChars()];
|
||||
font.GetHasGlyphs(name.String(), name.CountChars(), hasGlyphs);
|
||||
for (int32 i = 0; i < name.CountChars(); ++i) {
|
||||
int nameLength = name.CountChars();
|
||||
bool hasGlyphs[nameLength];
|
||||
font.GetHasGlyphs(name.String(), nameLength, hasGlyphs);
|
||||
for (int32 i = 0; i < nameLength; ++i) {
|
||||
if (!hasGlyphs[i]) {
|
||||
// replace by name translated to current language
|
||||
currentLanguage.GetName(name);
|
||||
@ -131,10 +132,17 @@ LocaleWindow::LocaleWindow()
|
||||
item = new LanguageListItem(name, currentID.String(),
|
||||
currentLanguage.Code());
|
||||
}
|
||||
|
||||
if (currentLanguage.IsCountrySpecific()
|
||||
&& currentToplevelItem != NULL
|
||||
&& currentToplevelItem->Code() == item->Code()) {
|
||||
fLanguageListView->AddUnder(item, currentToplevelItem);
|
||||
} else if (currentLanguage.ScriptCode() != NULL
|
||||
&& currentToplevelItem != NULL
|
||||
&& currentToplevelItem->Code() == item->Code()) {
|
||||
// This is a script for some language, skip it and add the
|
||||
// country-specific variants to the parent directly
|
||||
delete item;
|
||||
} else {
|
||||
// This is a generic language, add it at top-level
|
||||
fLanguageListView->AddItem(item);
|
||||
|
Loading…
Reference in New Issue
Block a user