haiku/docs/user/locale/Locale.dox
Adrien Destugues 0a4e27c50b * Fixed the main page entry for locale kit
* Also parse the actual code to get the methods shown in the classes, inheritance diagrams, and all that stuff
 * Add some docs on date formatting to BLocale


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37925 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-08-05 12:09:20 +00:00

146 lines
4.3 KiB
Plaintext

/*!
\class BLocale
\ingroup locale
\brief Class for representing a locale and its settings.
A locale is defined by the combination of a country and a language. Using these
two informations, it is possible to determine the format to use for date, time,
and number formatting. The BLocale class also provide collators, which allows
you to sort a list of strings properly depending on a set of rules about
accented chars and other special cases that vary over the different locales.
BLocale is also the class to use when you want to perform formatting or parsing
of dates, times, and numbers, in the natural language of the user.
*/
/*!
\fn const BLocale::BCollator* Collator() const
\brief Returns the collator associated to this locale.
Returns the collator in use for this locale, allowing you to use it to sort a
set of strings.
*/
/*!
\fn const BLocale::BCountry* Country() const
\brief Returns the country associated to this locale.
A locale is defined by the combination of a country and a language. This
method gets the country part of this information, so you can access the
data that is not language-dependant (such as the country flag).
*/
/*!
\fn const BLocale::BLanguage* Language() const
\brief Returns the language associated to this locale.
*/
/*!
\fn const char* BLocale::Code() const
\brief Returns the locale code.
This function returns the locale name (such as en_US for united states english).
*/
/*!
\fn bool Blocale::GetName(BString& name) const
\brief Get the name of the locale.
This function fills the name string with the localized name of this locale.
For example, if the locale us en_US and the user language is french, this function will return "anglais (Etats-Unis)".
*/
/*!
\fn void BLocale::SetCountry(const BCountry& newCountry)
\brief Set the country for this locale.
*/
/*!
\fn void BLocale::SetCollator(const BCollator& newCollator)
\brief Set the collator for this locale.
*/
/*!
\fn void BLocale::SetLanguage(const char* languageCode)
\brief Set the language for this locale.
*/
/*!
\fn status_t BLocale::FormatDate(char* string, size_t maxSize, time_t time, bool longFormat)
\fn status_t BLocale::FormatDate(BString* string, time_t time, bool longFormat)
\brief Format a date.
Fills in the string with a formatted date. The longFormat parameter allows you
to select the short or the full format.
*/
/*!
\fn status_t BLocale::FormatDate(BString* string, int*& fieldPositions, int& fieldCount, time_t time, bool longFormat)
\brief Format a date and get information about the different fields.
This works the same way as the other FormatDatz methods, but also gives you the
offset of the beginning of each field in the date. This is useful if you need to
split the date in different parts for an user-modifiable area (see the Time
preflet for an example).
To identify the content of each field, you can use GetDateFields.
This function allocates the fieldPositions arrays, you have to free it when you
are finished with it.
\sa GetDateFields
*/
/*!
\fn status_t BLocale::GetDateFields(BDateElement*& fields, int& fieldCount, bool longFormat) const
\brief Get the type of each field in this date format
This function is most often used in combination with FormatDate. FormatDate
gives you the offset of each field in a formated string, anf GetDateFields gives
you the type of the field at a given offset. With these informations, you can
handle the formatted date string as a list of fields that you can split and
alter at will.
*/
/*!
\fn status_t BLocale::GetDateFormat(BString& format, bool longFormat) const
\brief Get the date format string
This function returns the string used internally to represent a date format.
*/
/*!
\fn status_t BLocale::SetDateFormat(const char* formatString, bool longFormat)
\brief Set the date format for this locale
Thisfunction allows you to define your own date format for specific purposes.
*/
/*!
\fn int StartOfWeek() const
\brief Returns the day used as start of week in this locale.
*/
/*!
\fn int BLocale::StringCompare(const char* s1, const char* s2) const
\fn int BLocale::StringCompare(const BString* s1, const BString* s2) const
\brief Compares two strings using the locale's collator
These methods are short-hands to Collator()->StringCompare.
*/
/*!
\fn void BLocale::GetSortKey(const char* string, BString* key) const
\brief Computes the sort key of a string
This method is a short-hand to Collator()->GetSortKey.
*/