Sort languages alphabetically using collators.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35969 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -156,6 +156,28 @@ static const Translation gTranslations[] =
|
|||||||
#define kNumberOfTranslations (sizeof(gTranslations) / sizeof(Translation))
|
#define kNumberOfTranslations (sizeof(gTranslations) / sizeof(Translation))
|
||||||
|
|
||||||
|
|
||||||
|
static int
|
||||||
|
TranslationComparator(const void* left, const void* right)
|
||||||
|
{
|
||||||
|
const Translation* leftTranslation = *(const Translation**)left;
|
||||||
|
const Translation* rightTranslation = *(const Translation**)right;
|
||||||
|
|
||||||
|
BLanguage* language;
|
||||||
|
be_locale_roster->GetLanguage(&language, leftTranslation->languageCode);
|
||||||
|
BString leftName;
|
||||||
|
language->GetName(&leftName);
|
||||||
|
delete language;
|
||||||
|
|
||||||
|
be_locale_roster->GetLanguage(&language, rightTranslation->languageCode);
|
||||||
|
BString rightName;
|
||||||
|
language->GetName(&rightName);
|
||||||
|
delete language;
|
||||||
|
|
||||||
|
return be_locale->Collator()->Compare(leftName.String(),
|
||||||
|
rightName.String());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
class AboutApp : public BApplication {
|
class AboutApp : public BApplication {
|
||||||
public:
|
public:
|
||||||
AboutApp();
|
AboutApp();
|
||||||
@@ -1014,12 +1036,19 @@ AboutView::_CreateCreditsView()
|
|||||||
fCreditsView->SetFontAndColor(&font, B_FONT_ALL, &kHaikuOrange);
|
fCreditsView->SetFontAndColor(&font, B_FONT_ALL, &kHaikuOrange);
|
||||||
fCreditsView->Insert(TR("Translations:\n"));
|
fCreditsView->Insert(TR("Translations:\n"));
|
||||||
|
|
||||||
// TODO : sort languages alphabetically using collators
|
|
||||||
BLanguage* lang;
|
BLanguage* lang;
|
||||||
BString langName;
|
BString langName;
|
||||||
|
|
||||||
|
BList sortedTranslations;
|
||||||
for (uint32 i = 0; i < kNumberOfTranslations; i ++) {
|
for (uint32 i = 0; i < kNumberOfTranslations; i ++) {
|
||||||
const Translation& translation = gTranslations[i];
|
const Translation* translation = &gTranslations[i];
|
||||||
|
sortedTranslations.AddItem((void*)translation);
|
||||||
|
}
|
||||||
|
sortedTranslations.SortItems(TranslationComparator);
|
||||||
|
|
||||||
|
for (uint32 i = 0; i < kNumberOfTranslations; i ++) {
|
||||||
|
const Translation& translation =
|
||||||
|
*(const Translation*)sortedTranslations.ItemAt(i);
|
||||||
|
|
||||||
be_locale_roster->GetLanguage(&lang, translation.languageCode);
|
be_locale_roster->GetLanguage(&lang, translation.languageCode);
|
||||||
langName.Truncate(0);
|
langName.Truncate(0);
|
||||||
|
|||||||
Reference in New Issue
Block a user