From b588e644eefae6512f148f79d2e932b3ab204e69 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Fri, 7 May 2010 18:57:51 +0000 Subject: [PATCH] * Changed AboutSystem to only show the translated language names. * Added the same hack to ReadOnlyBootPrompt that I put into Locale to work-around the missing font overlays in the app_server; IOW we use some heuristics to decide which language to show. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36730 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/apps/aboutsystem/AboutSystem.cpp | 6 ++--- .../readonlybootprompt/BootPromptWindow.cpp | 23 +++++++++++++++---- 2 files changed, 21 insertions(+), 8 deletions(-) diff --git a/src/apps/aboutsystem/AboutSystem.cpp b/src/apps/aboutsystem/AboutSystem.cpp index a245b44baa..14e6a708ce 100644 --- a/src/apps/aboutsystem/AboutSystem.cpp +++ b/src/apps/aboutsystem/AboutSystem.cpp @@ -169,12 +169,12 @@ TranslationComparator(const void* left, const void* right) BLanguage* language; be_locale_roster->GetLanguage(leftTranslation->languageCode, &language); BString leftName; - language->GetName(leftName); + language->GetTranslatedName(leftName); delete language; be_locale_roster->GetLanguage(rightTranslation->languageCode, &language); BString rightName; - language->GetName(rightName); + language->GetTranslatedName(rightName); delete language; return be_locale->Collator()->Compare(leftName.String(), @@ -1067,7 +1067,7 @@ AboutView::_CreateCreditsView() be_locale_roster->GetLanguage(translation.languageCode, &lang); langName.Truncate(0); - lang->GetName(langName); + lang->GetTranslatedName(langName); delete lang; fCreditsView->SetFontAndColor(&font, B_FONT_ALL, &kHaikuGreen); diff --git a/src/apps/readonlybootprompt/BootPromptWindow.cpp b/src/apps/readonlybootprompt/BootPromptWindow.cpp index 391142e35e..0f3d51478d 100644 --- a/src/apps/readonlybootprompt/BootPromptWindow.cpp +++ b/src/apps/readonlybootprompt/BootPromptWindow.cpp @@ -3,6 +3,7 @@ * All rights reserved. Distributed under the terms of the MIT License. */ + #include "BootPromptWindow.h" #include @@ -24,6 +25,7 @@ #include #include #include +#include #include "BootPrompt.h" #include "Keymap.h" @@ -279,14 +281,23 @@ BootPromptWindow::_PopulateLanguages() // limited to catalogs written for this application, which is on purpose! const char* languageString; - for (int32 i = 0; - installedCatalogs.FindString("langs", i, &languageString) == B_OK; - i++) { + for (int32 i = 0; installedCatalogs.FindString("langs", i, &languageString) + == B_OK; i++) { BLanguage* language; - if (be_locale_roster->GetLanguage(languageString, - &language) == B_OK) { + if (be_locale_roster->GetLanguage(languageString, &language) == B_OK) { BString name; language->GetName(name); + + // TODO: as long as the app_server doesn't support font overlays, + // use the translated name if problematic characters are used... + const char* string = name.String(); + while (uint32 code = BUnicodeChar::FromUTF8(&string)) { + if (code > 1424) { + language->GetTranslatedName(name); + break; + } + } + LanguageItem* item = new LanguageItem(name.String(), languageString); fLanguagesListView->AddItem(item); @@ -295,6 +306,8 @@ BootPromptWindow::_PopulateLanguages() fLanguagesListView->Select( fLanguagesListView->CountItems() - 1); } + + delete language; } else printf("failed to get BLanguage for %s\n", languageString); }