This should have been part of previous commit :
Add Language->IsCountry to tell if a language holds a country specifier (like fr_FR) or not (fr alone). This allows separating them in the preflet. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35366 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -6,6 +6,8 @@
|
|||||||
|
|
||||||
#include <Language.h>
|
#include <Language.h>
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
#include <Path.h>
|
#include <Path.h>
|
||||||
#include <String.h>
|
#include <String.h>
|
||||||
#include <FindDirectory.h>
|
#include <FindDirectory.h>
|
||||||
@@ -135,7 +137,7 @@ BLanguage::GetName(BString* name)
|
|||||||
// TODO: This will return the language not in the current be_app_catalog,
|
// TODO: This will return the language not in the current be_app_catalog,
|
||||||
// but in the current system wide language! Don't know the exact reason.
|
// but in the current system wide language! Don't know the exact reason.
|
||||||
UnicodeString s;
|
UnicodeString s;
|
||||||
fICULocale->getDisplayLanguage(s);
|
fICULocale->getDisplayName(s);
|
||||||
BStringByteSink converter(name);
|
BStringByteSink converter(name);
|
||||||
s.toUTF8(converter);
|
s.toUTF8(converter);
|
||||||
return B_OK;
|
return B_OK;
|
||||||
@@ -146,3 +148,10 @@ BLanguage::Code()
|
|||||||
{
|
{
|
||||||
return fICULocale->getLanguage();
|
return fICULocale->getLanguage();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool
|
||||||
|
BLanguage::IsCountry()
|
||||||
|
{
|
||||||
|
return *(fICULocale->getCountry()) != '\0';
|
||||||
|
}
|
||||||
|
|||||||
@@ -509,31 +509,14 @@ BLocaleRoster::GetInstalledLanguages(BMessage *languages) const
|
|||||||
int32 i;
|
int32 i;
|
||||||
UnicodeString icuLanguageName;
|
UnicodeString icuLanguageName;
|
||||||
BString languageName;
|
BString languageName;
|
||||||
std::set<BString> languageSet;
|
|
||||||
|
|
||||||
#undef REALLY_ALL_LANGUAGES
|
|
||||||
#ifdef REALLY_ALL_LANGUAGES
|
|
||||||
const char* const* icuLocaleList = Locale::getISOLanguages();
|
|
||||||
|
|
||||||
// Loop over the strings and add them to an std::set to remove duplicates
|
|
||||||
for (i = 0; icuLocaleList[i]; i++) {
|
|
||||||
languageSet.insert(BString(icuLocaleList[i]));
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
int32_t localeCount;
|
int32_t localeCount;
|
||||||
const Locale* icuLocaleList
|
const Locale* icuLocaleList
|
||||||
= Locale::getAvailableLocales(localeCount);
|
= Locale::getAvailableLocales(localeCount);
|
||||||
|
|
||||||
// Loop over the strings and add them to an std::set to remove duplicates
|
// Loop over the strings and add them to an std::set to remove duplicates
|
||||||
for (i = 0; i < localeCount; i++) {
|
for (i = 0; i < localeCount; i++) {
|
||||||
languageSet.insert(icuLocaleList[i].getLanguage());
|
languages->AddString("langs", icuLocaleList[i].getName());
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
std::set<BString>::const_iterator lastLang = languageSet.end();
|
|
||||||
for (std::set<BString>::const_iterator setIterator = languageSet.begin();
|
|
||||||
setIterator != lastLang; setIterator++) {
|
|
||||||
languages->AddString("langs", *setIterator);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return B_OK;
|
return B_OK;
|
||||||
|
|||||||
Reference in New Issue
Block a user