|
|
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.
|
Create a KLocale with the given catalogue name. If no catalogue is given, the application name is used. The constructor looks for an entry Locale/Language in the configuration file. If nothing is set there, it looks for the environment variable $LANG. The format for LANG is de:fr:.., if de (german) is your prefered language and fr (french) is your second prefered language. You can add as many languages as you want. If none of them can be find, the default (C) will be used.
Parameters:
catalogue | The name of the language file |
~ |
Destructor.
QString |
[const]
Translate 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.
Parameters:
index | The lookup text and default text, if not found. |
void |
Allows programs such as kcmlocale to choose which translation to use.
Parameters:
_lang | The language you want to use. |
enum |
Various positions for where to place the positive or negative sign when they are related to a monetary value.
QString |
[const]
Retrieve what a decimal point should look like ("." or "," etc.) according to the current locale or user settings.
Returns: The decimal symbol used by locale.
QString |
[const]
Retrieve what the thousands separator should look like ("," or "." etc.) according to the current locale or user settings.
Returns: The thousands separator used by locale.
QString |
[const]
Retrieve what the symbol denoting currency in the current locale as as defined by user settings should look like.
Returns: The default currecy symbol used by locale.
QString |
[const]
Retrieve what a decimal point should look like ("." or "," etc.) for monetary values, according to the current locale or user settings.
Returns: The monetary decimal symbol used by locale.
QString |
[const]
Retrieve what a thousands separator for monetary values should look like ("," or " " etc.) according to the current locale or user settings.
Returns: The monetary thousands separator used by locale.
QString |
[const]
Retrieve what a positive sign should look like ("+", " ", etc.) according to the current locale or user settings.
Returns: The positive sign used by locale.
QString |
[const]
Retrieve what a negative sign should look like ("-", etc.) according to the current locale or user settings.
Returns: The negative sign used by locale.
int |
[const]
The number of fractional digits to include in numeric/monetary values (usually 2).
Returns: Default number of fractional digits used by locale.
bool |
[const]
If and only if the currency symbol precedes a positive value, this will be true.
Returns: Where to print the currency symbol for positive numbers.
bool |
[const]
If and only if the currency symbol precedes a negative value, this will be true.
Returns: Where to print the currecy symbol for negative numbers.
SignPosition |
[const]
Retrieve the position of a positive sign in relation to a monetary value.
Returns: Where/how to print the positive sign.
SignPosition |
[const]
Denotes where to place a negative sign in relation to a monetary value.
Returns: Where/how to print the negative sign.
QString |
[const]
Given an double, convert that to a numeric string containing the localized monetary equivalent.
e.g. given 123456, return "$123,456".
Parameters:
num | The number we want to format |
currency | The currency symbol you want. |
digits | Number of fractional digits. |
Returns: The number of money as a localized string
QString |
[const]
This function differs from the above only in that it can take a QString as the argument for convenience.
Parameters:
numStr | The string you want to reformat. |
Returns: The number of money as a localized string
QString |
[const]
Given an double, convert 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, fracDigits is used.
Parameters:
num | The number to convert |
precision | Number of fractinal digits used. |
Returns: The number as a localized string
QString |
[const]
This function differs from the above only in that it can take a QString as the argument for convenience.
Parameters:
numStr | The string you want to convert. |
Returns: The number as a formated string
QString |
[const]
Return a string formatted to the current locale's conventions regarding dates.
Parameters:
pDate | The date to be formated. |
shotfmt | True for non text dates. |
Returns: The date as a string
QString |
[const]
Return a string formatted to the current locale's conventions regarding times.
Parameters:
pTime | The time to be formated. |
includeSecs | if true, seconds are included in the output, otherwise only hours and minutes are formatted. |
Returns: The time as a string
bool |
Use this to determine if the user wants a 12 clock.
Returns: If the user wants 12h lock
QString |
[const]
Return a string containing the name of the month name.
Parameters:
i | the month number of the year starting at 1/January. |
Returns: The name of the month
QString |
[const]
Return a string containing the name of the week day.
Parameters:
i | the day number of the week starting at 1/Monday. |
Returns: The name of the week
QString |
[const]
Return a string formated to the current locale's conventions regarding both date and time.
Parameters:
pDateTime | The date and time to be formated. |
Returns: The date and time as a string
double |
[const]
Converts a localized monetary string to a double.
Parameters:
numStr | the string we want to convert. |
ok | the boolean that is set to false if it's not a number. |
Returns: The string converted to a double
double |
[const]
Converts a localized numeric string to a double.
Parameters:
numStr | the string we want to convert. |
ok | the boolean that is set to false if it's not a number. |
Returns: The string converted to a double
QDate |
[const]
Converts a localized date string to a QDate. Note: This only works on short dates for the time beeing.
Parameters:
str | the string we want to convert. |
Returns: The string converted to a QDate
void |
Creates an alias for the string text. It will be translated and stored under the integer constant index. This can help you to avoid repeated translation. Be aware, that this is only needed in cases, where you want to translate it in loops or something like that. In every other case, the translate methods is fast enough.
Parameters:
text | The text to alias. |
index | The index key to use. |
QString |
[const]
Returns an alias, that you have set before or 0, if not set. This method uses QIntDict.
Parameters:
The | key of the string to look up. |
Returns: The translated string.
QString |
[const]
Returns the language used by this object. The domain AND the library translation must be available in this language. 'C' is default, if no other available.
Returns: The currently used language.
QString |
[const]
Returns the locale used for money by object.
Returns: The currency use locale for money formating.
QString |
[const]
Returns the locale used for numbers by object.
Returns: The currently used locale for numer formating.
QString |
[const]
Returns the locale used for time by object.
Returns: The currently used locale for time formated.
QString |
[const]
Returns the languages selected by user.
Returns: String containing locale codes separated by colons
QStringList |
[const]
Returns the languages selected by user.
Returns: List of language codes
QString |
[const]
Returns the charset name by selected locale. This will be the charset defined in the config file. NOTE: This is no longer the same as encoding. "iso-8859-1" is default
Returns: Name of the prefered charset for fonts
void |
adds anther catalogue to search for translation lookup. This function is useful for extern libraries and/or code, that provides it's own messages.
If the catalogue does not exist for the chosen language, it will be ignored and C will be used.
Parameters:
catalogue | The catalogue to add. |
void |
[static]
returns the parts of the parameter str understood as language setting the format is language_country.charset
Parameters:
str | The string to split. |
language | This will be set to the language part of the string. |
country | This will be set to the country part of the string. |
charset | This will be set to the charset part of the stirng. |
void |
Init the l10n part of the instance with the config object.
Parameters:
config | The configuration object used for init. |
void |
Init the l18n part of the instance with the given config object. It should be valid and contain the global entries.
Parameters:
config | The configuration object used for init. |
catalogue | The main catalogue to use. |
bool |
[const]
Returns: Returns true if locale is inited.
void |
[static]
Use this to as main catalogue for *all* KLocales, if not the appname will be used.
Parameters:
catalogue | Catalogue to override all other main catalogues. |