All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
BLocaleRoster Class Reference

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 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.

Since
Haiku R1

Constructor & Destructor Documentation

◆ ~BLocaleRoster()

BLocaleRoster::~BLocaleRoster ( )

Destructor. Does nothing.

Since
Haiku R1

◆ BLocaleRoster()

BLocaleRoster::BLocaleRoster ( )
protected

Constructor. Does nothing.

Since
Haiku R1

Member Function Documentation

◆ Default()

BLocaleRoster * BLocaleRoster::Default ( )
static

Returns default BLocalRoster.

Since
Haiku R1

◆ GetAvailableCatalogs()

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.
Since
Haiku R1

◆ GetAvailableCountries()

status_t BLocaleRoster::GetAvailableCountries ( BMessage message) const

Fills in the passed in message with one or more 'country' string fields, containing the (ISO-639) code of each country.

Since
Haiku R1

◆ GetAvailableLanguages()

status_t BLocaleRoster::GetAvailableLanguages ( BMessage message) const

Fills message with 'language'-fields containing the language ID(s) of all available languages.

Since
Haiku R1

◆ GetAvailableTimeZones()

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.
Since
Haiku R1

◆ GetAvailableTimeZonesForCountry()

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.
Since
Haiku R1

◆ GetDefaultTimeZone()

status_t BLocaleRoster::GetDefaultTimeZone ( BTimeZone timezone) const

Get the default timezone.

Since
Haiku R1

◆ GetFlagIconForCountry()

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.
Since
Haiku R1

◆ GetFlagIconForLanguage()

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.
Since
Haiku R1

◆ GetLanguage()

status_t BLocaleRoster::GetLanguage ( const char *  languagecode,
BLanguage **  _language 
) const

Instantiate a language from its code.

Since
Haiku R1

◆ GetLocalizedFileName()

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_OKsuccess
B_ENTRY_NOT_FOUNDfailure. Attribute not found, entry not found in catalog, etc.
Since
Haiku R1

◆ GetPreferredLanguages()

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.

Since
Haiku R1

◆ IsFilesystemTranslationPreferred()

bool BLocaleRoster::IsFilesystemTranslationPreferred ( ) const

Returns whether or not filesystem translation is preferred.

Returns
B_ERROR if there was an error locking the default RosterData.
Since
Haiku R1

◆ Refresh()

status_t BLocaleRoster::Refresh ( )

Refreshes the BLocalRoster.

Since
Haiku R1