Main class for accessing the Locale Kit data. More...
Public Member Functions | |
~BLocaleRoster () | |
Destructor. Does nothing. | |
status_t | GetAvailableCatalogs (BMessage *message, const char *sigPattern=NULL, const char *langPattern=NULL, int32 fingerprint=0) const |
Get the available locales and catalogs. | |
status_t | GetAvailableCountries (BMessage *timeZones) const |
Fills in the passed in message with one or more 'country' string fields, containing the (ISO-639) code of each country. | |
status_t | GetAvailableLanguages (BMessage *message) const |
Fills message with 'language'-fields containing the language ID(s) of all available languages. | |
status_t | GetAvailableTimeZones (BMessage *timeZones) const |
Fills in the passed in timeZones message with all time zone strings for the locale. | |
status_t | GetAvailableTimeZonesForCountry (BMessage *message, const char *countryCode) const |
Fills in the passed in timeZones message with one or more time zone strings containing the time zones for the country specified by countryCode for the locale. | |
status_t | GetDefaultTimeZone (BTimeZone *timezone) const |
Get the default timezone. | |
status_t | GetFlagIconForCountry (BBitmap *flagIcon, const char *countryCode) |
Sets flagIcon to the flag for the passed in countryCode. | |
status_t | GetFlagIconForLanguage (BBitmap *flagIcon, const char *languageCode) |
Sets flagIcon to the flag for the passed in languageCode. | |
status_t | GetLanguage (const char *languageCode, BLanguage **_language) const |
Instantiate a language from its code. | |
status_t | GetLocalizedFileName (BString &localizedFileName, const entry_ref &ref, bool traverse=false) |
Looks up a localized filename from a catalog. | |
status_t | GetPreferredLanguages (BMessage *message) const |
Return the list of user preferred languages. | |
bool | IsFilesystemTranslationPreferred () const |
Returns whether or not filesystem translation is preferred. | |
status_t | Refresh () |
Refreshes the BLocalRoster. | |
Static Public Member Functions | |
static BLocaleRoster * | Default () |
Returns default BLocalRoster. | |
Protected Member Functions | |
BLocaleRoster () | |
Constructor. Does nothing. | |
Main class for accessing the Locale Kit data.
The Locale Roster is the central part of the locale kit. It is a global object (be_locale_roster
) storing all the useful locale data. Other classes from the Locale Kit can be constructed on their own, but only the Locale Roster allows you to do so while taking account of the user's locale settings.
BLocaleRoster::~BLocaleRoster | ( | ) |
Destructor. Does nothing.
|
protected |
Constructor. Does nothing.
|
static |
Returns default BLocalRoster.
status_t BLocaleRoster::GetAvailableCatalogs | ( | BMessage * | languageList, |
const char * | sigPattern = NULL , |
||
const char * | langPattern = NULL , |
||
int32 | fingerprint = 0 |
||
) | const |
Get the available locales and catalogs.
Fills the passed languageList message with one or more 'locale' string fields containing the locale names.
The optional parameters can be used to filter the list and only get the locales for which a catalog is available for the given app (sigPattern, fingerprint), or the locales with a given language.
B_OK | Everything went well. |
B_BAD_VALUE | A NULL languageList message was passed in. |
B_ERROR | Error locking the default RosterData. |
Fills in the passed in message with one or more 'country' string fields, containing the (ISO-639) code of each country.
Fills message
with 'language'-fields containing the language ID(s) of all available languages.
Fills in the passed in timeZones message with all time zone strings for the locale.
B_OK | Everything went well. |
B_BAD_VALUE | A NULL timeZones message was passed in. |
B_ERROR | An error occurred trying to retrieve the localized time zone strings. |
status_t BLocaleRoster::GetAvailableTimeZonesForCountry | ( | BMessage * | timeZones, |
const char * | countryCode | ||
) | const |
Fills in the passed in timeZones message with one or more time zone strings containing the time zones for the country specified by countryCode for the locale.
B_OK | Everything went well. |
B_BAD_VALUE | A NULL timeZones message was passed in. |
B_ERROR | An error occurred trying to retrieve the localized time zones most likely due to an invalid countryCode. |
Get the default timezone.
Sets flagIcon to the flag for the passed in countryCode.
B_OK | Everything went well. |
B_BAD_VALUE | A NULL or invalid countryCode was passed in. |
B_ERROR | Error locking the default RosterData. |
B_NAME_NOT_FOUND | The flag could not be found for the countryCode. |
Sets flagIcon to the flag for the passed in languageCode.
If a flag could not be located for the passed in languageCode then GetFlagIconForLanguage() attempts to locate the default country's flag for the languageCode instead. The default country flag for a language is usually set to the country of the languages origin such as Germany for German or Spain for Spanish.
B_OK | Everything went well. |
B_BAD_VALUE | A NULL or invalid languageCode was passed in. |
B_ERROR | Error locking the default RosterData. |
B_NAME_NOT_FOUND | The flag could not be found for the default country's flag for the languageCode. |
status_t BLocaleRoster::GetLanguage | ( | const char * | languagecode, |
BLanguage ** | _language | ||
) | const |
Instantiate a language from its code.
status_t BLocaleRoster::GetLocalizedFileName | ( | BString & | localizedFileName, |
const entry_ref & | ref, | ||
bool | traverse = false |
||
) |
Looks up a localized filename from a catalog.
Attribute format: "signature:context:string" (no colon in any of signature, context and string)
Lookup is done for the top preferred language only. Lookup fails if a comment is present in the catalog entry.
localizedFileName | A pre-allocated BString object for the result of the lookup. |
ref | An entry_ref with an attribute holding data for catalog lookup. |
traverse | Determines if symlinks should be traversed. |
B_OK | success |
B_ENTRY_NOT_FOUND | failure. Attribute not found, entry not found in catalog, etc. |
Return the list of user preferred languages.
This function fills in the given message with one or more language string fields. They constitute the ordered list of user-selected languages to use for string translation.
bool BLocaleRoster::IsFilesystemTranslationPreferred | ( | ) | const |
Returns whether or not filesystem translation is preferred.
B_ERROR
if there was an error locking the default RosterData.status_t BLocaleRoster::Refresh | ( | ) |
Refreshes the BLocalRoster.