#include <klocale.h>
Public Types | |
| enum | SignPosition |
| enum | MeasureSystem |
Public Methods | |
| KLocale (const QString &catalogue, KConfig *config=0) | |
| KLocale (const KLocale &rhs) | |
| KLocale & | operator= (const KLocale &rhs) |
| ~KLocale () | |
| QString | translate (const char *index) const |
| QString | translate (const char *index, const char *fallback) const |
| QString | translate (const char *singular, const char *plural, unsigned long n) const |
| bool | setCharset (const QString &charset) |
| bool | setEncoding (int mibEnum) |
| bool | setLanguage (const QString &language) |
| bool | setLanguage (const QStringList &languages) |
| bool | setCountry (const QString &country) |
| QString | decimalSymbol () const |
| QString | thousandsSeparator () const |
| QString | currencySymbol () const |
| QString | monetaryDecimalSymbol () const |
| QString | monetaryThousandsSeparator () const |
| QString | positiveSign () const |
| QString | negativeSign () const |
| int | fracDigits () const |
| bool | positivePrefixCurrencySymbol () const |
| bool | negativePrefixCurrencySymbol () const |
| SignPosition | positiveMonetarySignPosition () const |
| SignPosition | negativeMonetarySignPosition () const |
| QString | formatMoney (double num, const QString ¤cy=QString::null, int digits=-1) const |
| QString | formatMoney (const QString &numStr) const |
| QString | formatNumber (double num, int precision=-1) const |
| QString | formatNumber (const QString &numStr) const |
| bool | nounDeclension () const |
| QString | formatDate (const QDate &pDate, bool shortFormat=false) const |
| bool | dateMonthNamePossessive () const |
| QString | formatTime (const QTime &pTime, bool includeSecs=false) const |
| bool | use12Clock () const |
| bool | weekStartsMonday () const |
| int | weekStartDay () const |
| QString | monthName (int i, bool shortName=false) const |
| QString | monthNamePossessive (int i, bool shortName=false) const |
| QString | weekDayName (int i, bool shortName=false) const |
| QString | formatDateTime (const QDateTime &pDateTime, bool shortFormat=true, bool includeSecs=false) const |
| double | readMoney (const QString &numStr, bool *ok=0) const |
| double | readNumber (const QString &numStr, bool *ok=0) const |
| QDate | readDate (const QString &str, bool *ok=0) const |
| QDate | readDate (const QString &intstr, const QString &fmt, bool *ok=0) const |
| QTime | readTime (const QString &str, bool *ok=0) const |
| QString | language () const |
| QString | country () const |
| QString | languages () const |
| QStringList | languagesTwoAlpha () const |
| QStringList | languageList () const |
| QString | charset () const |
| const char * | encoding () const |
| int | encodingMib () const |
| QTextCodec * | codecForEncoding () const |
| void | setDateFormat (const QString &format) |
| void | setDateFormatShort (const QString &format) |
| void | setDateMonthNamePossessive (bool possessive) |
| void | setTimeFormat (const QString &format) |
| void | setWeekStartsMonday (bool start) |
| void | setWeekStartDay (int day) |
| QString | dateFormat () const |
| QString | dateFormatShort () const |
| QString | timeFormat () const |
| void | setDecimalSymbol (const QString &symbol) |
| void | setThousandsSeparator (const QString &separator) |
| void | setPositiveSign (const QString &sign) |
| void | setNegativeSign (const QString &sign) |
| void | setPositiveMonetarySignPosition (SignPosition signpos) |
| void | setNegativeMonetarySignPosition (SignPosition signpos) |
| void | setPositivePrefixCurrencySymbol (bool prefix) |
| void | setNegativePrefixCurrencySymbol (bool prefix) |
| void | setFracDigits (int digits) |
| void | setMonetaryThousandsSeparator (const QString &separator) |
| void | setMonetaryDecimalSymbol (const QString &symbol) |
| void | setCurrencySymbol (const QString &symbol) |
| int | pageSize () const |
| void | setPageSize (int paperFormat) |
| MeasureSystem | measureSystem () const |
| void | setMeasureSystem (MeasureSystem value) |
| void | insertCatalogue (const QString &catalogue) |
| void | removeCatalogue (const QString &catalogue) |
| void | setActiveCatalogue (const QString &catalogue) |
| QString | translateQt (const char *context, const char *sourceText, const char *message) const |
| QStringList | allLanguagesTwoAlpha () const |
| QString | twoAlphaToLanguageName (const QString &code) const |
| QStringList | allCountriesTwoAlpha () const |
| QString | twoAlphaToCountryName (const QString &code) const |
Static Public Methods | |
| void | splitLocale (const QString &str, QString &language, QString &country, QString &charset) |
| void | setMainCatalogue (const char *catalogue) |
| QString | langLookup (const QString &fname, const char *rtype="html") |
| QString | defaultLanguage () |
| QString | defaultCountry () |
KLocale provides support for country specific stuff like the national language.
KLocale supports translating, as well as specifying the format for numbers, currency, time, and date.
Definition at line 92 of file klocale.h.
|
|
The Metric system will give you information in mm, while the Imperial system will give you information in inches. |
|
|
Various positions for where to place the positive or negative sign when they are related to a monetary value. |
|
||||||||||||
|
Constructs a KLocale with the given catalogue name. The constructor looks for an entry Locale/Language in the configuration file. If no config file is specified, it will also look for languages using the environment variables (KDE_LANG, LC_MESSAGES, LC_ALL, LANG), as well as the global configuration fie. If we were not able to use non of the specified languages, the default language (en_US) will be used. If you specify a configuration file, it has to be valid until the KLocale object is destroyed.
|
|
|
Copy constructor. |
|
|
Destructor. |
|
|
Returns list of all known country codes.
|
|
|
Returns list of all known ISO 639-1 codes.
|
|
|
|
|
|
Returns the user's preferred encoding. Should never be NULL.
|
|
|
Returns the country code of the country where the user lives. "C" is default, if no other available
|
|
|
Returns what the symbol denoting currency in the current locale as as defined by user settings should look like.
|
|
|
Returns the currently selected date format.
|
|
|
Returns the currently selected short date format.
|
|
|
Use this to determine whether in dates a possessive form of month name is preferred ("of January" rather than "January")
|
|
|
Returns what a decimal point should look like ("." or "," etc.) according to the current locale or user settings.
|
|
|
Returns the name of the default country.
|
|
|
Returns the name of the internal language.
|
|
|
Returns the user's preferred encoding.
|
|
|
Returns the user's preferred encoding.
|
|
||||||||||||
|
Returns a string formatted to the current locale's conventions regarding dates.
|
|
||||||||||||||||
|
Returns a string formated to the current locale's conventions regarding both date and time.
|
|
|
|
|
||||||||||||||||
|
Given a double, converts that to a numeric string containing the localized monetary equivalent. e.g. given 123456, return "$ 123,456.00".
|
|
|
|
|
||||||||||||
|
Given a double, converts that to a numeric string containing the localized numeric equivalent. e.g. given 123456.78, return "123,456.78" (for some European country). If precision isn't specified, 2 is used.
|
|
||||||||||||
|
Returns a string formatted to the current locale's conventions regarding times.
|
|
|
The number of fractional digits to include in numeric/monetary values (usually 2).
|
|
|
Adds another catalogue to search for translation lookup. This function is useful for extern libraries and/or code, that provides its own messages. If the catalogue does not exist for the chosen language, it will be ignored and en_US will be used.
|
|
||||||||||||
|
Finds localized resource in resourceDir( rtype ) + <lang> + fname.
|
|
|
Returns the language used by this object. The domain AND the library translation must be available in this language. "en_US" is default, if no other available.
|
|
|
Returns the languages selected by user. The codes returned here is the internal language codes.
|
|
|
|
|
|
Returns the preferred languages as ISO 639-1 codes. This means that information about country is removed. If the internal language code might be represented by more than one 639-1 code, they will all be listed (but only once). If the selected languages are "nn, nb, pt_BR", you will get: "nn, no, nb, pt".
|
|
|
Returns which measuring system we use.
|
|
|
Returns what a decimal point should look like ("." or "," etc.) for monetary values, according to the current locale or user settings.
|
|
|
Returns what a thousands separator for monetary values should look like ("," or " " etc.) according to the current locale or user settings.
|
|
||||||||||||
|
Returns a string containing the name of the month name.
|
|
||||||||||||
|
Returns a string containing the possessive form of the month name. ("of January", "of February", etc.) It's needed in long format dates in some languages.
|
|
|
Denotes where to place a negative sign in relation to a monetary value.
|
|
|
If and only if the currency symbol precedes a negative value, this will be true.
|
|
|
Returns what a negative sign should look like ("-", etc.) according to the current locale or user settings.
|
|
|
Use this to determine whether nouns are declined in locale's language. This property should remain read-only (no setter function)
|
|
|
Assignment operator. |
|
|
Returns the preferred page size for printing.
|
|
|
Returns the position of a positive sign in relation to a monetary value.
|
|
|
If and only if the currency symbol precedes a positive value, this will be true.
|
|
|
Returns what a positive sign should look like ("+", " ", etc.) according to the current locale or user settings.
|
|
||||||||||||||||
|
Converts a localized date string to a QDate, using the specified format. You will usually not want to use this method. |
|
||||||||||||
|
Converts a localized date string to a QDate. The bool pointed by ok will be invalid if the date entered was not valid.
|
|
||||||||||||
|
Converts a localized monetary string to a double.
|
|
||||||||||||
|
Converts a localized numeric string to a double.
|
|
||||||||||||
|
Converts a localized time string to a QTime. The bool pointed by ok will be false if the time entered was not valid.
|
|
|
Removes a catalog for translation lookup.
|
|
|
Sets the active catalog for translation lookup.
|
|
|
|
|
|
Changes the current country. The current country will be left unchanged if failed. It will force a reload of the country specific configuration.
|
|
|
Changes the current currency symbol.
|
|
|
Changes the current date format. The format of the date is a string which contains variables that will be replaced:
|
|
|
Changes the current short date format. The format of the date is a string which contains variables that will be replaced:
|
|
|
Changes the form of month name used in dates.
|
|
|
Changes the symbol used to identify the decimal pointer.
|
|
|
Changes the current encoding.
|
|
|
Changes the number of digits used when formating numbers.
|
|
|
Changes the list of prefed languages for the locale. The first valid language in the list will be used, or the default (en_US) language will be used if non of the specified languages were available.
|
|
|
Changes the current language. The current language will be left unchanged if failed. It will force a reload of the country specific configuration as well.
|
|
|
Use this to as main catalogue for *all* KLocales, if not the appname will be used. This function is best to be the very first instruction in your program's main function as it only has an effect before the first KLocale object is created (and this is in common KDE applications quite early).
|
|
|
Changes the preferred measuring system.
|
|
|
Changes the symbol used to identify the decimal pointer for monetary values.
|
|
|
Changes the separator used to group digits when formating monetary values.
|
|
|
Changes the sign position used for negative monetary values.
|
|
|
Changes the position where the currency symbol should be printed for negative monetary values.
|
|
|
Changes the sign used to identify a negative number.
|
|
|
Changes the preferred page size when printing.
|
|
|
Changes the sign position used for positive monetary values.
|
|
|
Changes the position where the currency symbol should be printed for positive monetary values.
|
|
|
Changes the sign used to identify a positive number. Normally this is left blank.
|
|
|
Changes the separator used to group digits when formating numbers.
|
|
|
Changes the current time format. The format of the time is string a which contains variables that will be replaced:
|
|
|
Changes how KLocale defines the first day in week.
|
|
|
Please use setWeekStartDay instead. Changes how KLocale defines the first day in week.
|
|
||||||||||||||||||||
|
Returns the parts of the parameter str understood as language setting the format is language_COUNTRY.charset
|
|
|
Returns what the thousands separator should look like ("," or "." etc.) according to the current locale or user settings.
|
|
|
Returns the currently selected time format.
|
|
||||||||||||||||
|
Used to get the correct, translated singular or plural of a word.
|
|
||||||||||||
|
Translates the string into the corresponding string in the national language, if available. The real contents of the string is in the argument fallback, but the meaning of it is coded into the argument index. In some cases you'll need this function, when english is too ambiguous to express it. Most of the times the translators will tell you if it can't be translated as it, but think of cases as "New", where the translations differs depending on what is New. Or simple cases as "Open", that can be used to express something is open or it can be used to express that you want something to open... There are tons of such examples. If translate("Open") is not enough to translate it well, use translate("To Open", "Open") or translate("Is Open", "Open"). The english user will see "Open" in both cases, but the translated version may vary. Of course you can also use i18n()
|
|
|
Translates the string into the corresponding string in the national language, if available. If not, returns the string itself. There is a KDE wide message file that contains the most often used phrases, so we can avoid duplicating the translation of these phrases. If a phrase is not found in the catalogue given to the constructor, it will search in the system catalog. This makes it possible to override some phrases for your needs. The argument must be an UTF-8 encoded string (If you only use characters that are in US-ASCII you're on the safe side. But for e.g. german umlauts or french accents should be recoded to UTF-8)
|
|
||||||||||||||||
|
Translates a message as a QTranslator is supposed to. The parameters are similar to i18n(), but the result value has other semantics (it can be QString::null)
|
|
|
Convert a country code to a human readable form.
|
|
|
Convert a ISO 639-1 code to a human readable form.
|
|
|
Use this to determine if the user wants a 12 hour clock.
|
|
||||||||||||
|
Returns a string containing the name of the week day.
|
|
|
Use this to determine which day is the first day of the week.
|
|
|
Please use the weekStartDay method instead. Use this to determine if the user wants the week to start on Monday.
|
1.2.18