Public Member Functions | Static Public Member Functions | Protected Member Functions
BLocaleRoster Class Reference

Main class for accessing the Locale Kit data. More...

List of all members.

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 BLocaleRosterDefault ()
 Returns default BLocalRoster.

Protected Member Functions

 BLocaleRoster ()
 Constructor. Does nothing.

Detailed Description

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.


Member Function Documentation

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.

Returns:
A status code.
Return values:
B_OKEverything went well.
B_BAD_VALUEA NULL languageList message was passed in.
B_ERRORError locking the default RosterData.
status_t BLocaleRoster::GetAvailableTimeZones ( BMessage timeZones) const

Fills in the passed in timeZones message with all time zone strings for the locale.

Returns:
A status code.
Return values:
B_OKEverything went well.
B_BAD_VALUEA NULL timeZones message was passed in.
B_ERRORAn 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.

Returns:
A status code.
Return values:
B_OKEverything went well.
B_BAD_VALUEA NULL timeZones message was passed in.
B_ERRORAn error occurred trying to retrieve the localized time zones most likely due to an invalid countryCode.
status_t BLocaleRoster::GetFlagIconForCountry ( BBitmap flagIcon,
const char *  countryCode 
)

Sets flagIcon to the flag for the passed in countryCode.

Returns:
A status code.
Return values:
B_OKEverything went well.
B_BAD_VALUEA NULL or invalid countryCode was passed in.
B_ERRORError locking the default RosterData.
B_NAME_NOT_FOUNDThe flag could not be found for the countryCode.
status_t BLocaleRoster::GetFlagIconForLanguage ( BBitmap flagIcon,
const char *  languageCode 
)

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.

Returns:
A status code.
Return values:
B_OKEverything went well.
B_BAD_VALUEA NULL or invalid languageCode was passed in.
B_ERRORError locking the default RosterData.
B_NAME_NOT_FOUNDThe flag could not be found for the default country's flag for the languageCode.
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.

Parameters:
localizedFileNameA pre-allocated BString object for the result of the lookup.
refAn entry_ref with an attribute holding data for catalog lookup.
traverseDetermines if symlinks should be traversed.
Returns:
A status code.
Return values:
B_OK,:success
B_ENTRY_NOT_FOUND,:failure. Attribute not found, entry not found in catalog, etc.
status_t BLocaleRoster::GetPreferredLanguages ( BMessage message) const

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.

Returns:
B_ERROR if there was an error locking the default RosterData.

The Haiku Book pre-R1 - BLocaleRoster Class Reference
Generated on Fri May 24 2013 by Doxygen 1.7.5.1