KLocale Class Reference
from PyKDE4.kdecore import *
Detailed Description
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.
Use KGlobal.locale() to get pointer to the global KLocale object, containing the applications current locale settings.
For example, to format the date May 17, 1995 in the current locale, use:
QString date = KGlobal.locale()->formatDate(QDate(1995,5,17));
Hans Petter Bieker <bieker@kde.org>, Lukas Tinkl <lukas.tinkl@suse.cz> class for supporting locale settings and national language
Enumerations | |
DateFormat | { ShortDate, LongDate, FancyShortDate, FancyLongDate } |
DateTimeFormatOption | { TimeZone, Seconds } Typesafe wrapper: DateTimeFormatOptions |
MeasureSystem | { Metric, Imperial } |
ReadDateFlags | { NormalFormat, ShortFormat } |
ReadTimeFlags | { WithSeconds, WithoutSeconds } |
SignPosition | { ParensAround, BeforeQuantityMoney, AfterQuantityMoney, BeforeMoney, AfterMoney } |
Methods | |
__init__ (self, QString catalog, KSharedConfig.Ptr config=KSharedConfig.Ptr()) | |
__init__ (self, QString catalog, QString language, QString country=QString(), KConfig config=0) | |
__init__ (self, KLocale rhs) | |
QStringList | allCountriesList (self) |
QStringList | allLanguagesList (self) |
KCalendarSystem | calendar (self) |
QString | calendarType (self) |
QTextCodec | codecForEncoding (self) |
copyCatalogsTo (self, KLocale locale) | |
QString | country (self) |
QString | countryCodeToName (self, QString country) |
QString | currencySymbol (self) |
QString | dateFormat (self) |
QString | dateFormatShort (self) |
bool | dateMonthNamePossessive (self) |
QString | decimalSymbol (self) |
QByteArray | encoding (self) |
int | encodingMib (self) |
int | fileEncodingMib (self) |
QString | formatByteSize (self, float size) |
QString | formatDate (self, QDate date, KLocale.DateFormat format=KLocale.LongDate) |
QString | formatDateTime (self, QDateTime dateTime, KLocale.DateFormat format=KLocale.ShortDate, bool includeSecs=0) |
QString | formatDateTime (self, KDateTime dateTime, KLocale.DateFormat format=KLocale.ShortDate, KLocale.DateTimeFormatOptions options=0) |
QString | formatDuration (self, long mSec) |
QString | formatLong (self, long num) |
QString | formatMoney (self, float num, QString currency=QString(), int digits=-1) |
QString | formatNumber (self, float num, int precision=-1) |
QString | formatNumber (self, QString numStr, bool round=1, int precision=2) |
QString | formatTime (self, QTime pTime, bool includeSecs=0, bool isDuration=0) |
int | fracDigits (self) |
insertCatalog (self, QString catalog) | |
bool | isApplicationTranslatedInto (self, QString language) |
QString | language (self) |
QString | languageCodeToName (self, QString language) |
QStringList | languageList (self) |
QString | localizedFilePath (self, QString filePath) |
KLocale.MeasureSystem | measureSystem (self) |
QString | monetaryDecimalSymbol (self) |
QString | monetaryThousandsSeparator (self) |
KLocale.SignPosition | negativeMonetarySignPosition (self) |
bool | negativePrefixCurrencySymbol (self) |
QString | negativeSign (self) |
bool | nounDeclension (self) |
int | pageSize (self) |
KLocale.SignPosition | positiveMonetarySignPosition (self) |
bool | positivePrefixCurrencySymbol (self) |
QString | positiveSign (self) |
QDate, bool (ok) | readDate (self, QString str, ) |
QDate, bool (ok) | readDate (self, QString intstr, QString fmt, ) |
QDate, bool (ok) | readDate (self, QString str, KLocale.ReadDateFlags flags, ) |
float, bool (ok) | readMoney (self, QString numStr, ) |
float, bool (ok) | readNumber (self, QString numStr, ) |
QTime, bool (ok) | readTime (self, QString str, ) |
QTime, bool (ok) | readTime (self, QString str, KLocale.ReadTimeFlags flags, ) |
removeCatalog (self, QString catalog) | |
setActiveCatalog (self, QString catalog) | |
setCalendar (self, QString calendarType) | |
bool | setCountry (self, QString country, KConfig config) |
setCurrencySymbol (self, QString symbol) | |
setDateFormat (self, QString format) | |
setDateFormatShort (self, QString format) | |
setDateMonthNamePossessive (self, bool possessive) | |
setDecimalSymbol (self, QString symbol) | |
bool | setEncoding (self, int mibEnum) |
setFracDigits (self, int digits) | |
bool | setLanguage (self, QString language, KConfig config) |
bool | setLanguage (self, QStringList languages) |
setMeasureSystem (self, KLocale.MeasureSystem value) | |
setMonetaryDecimalSymbol (self, QString symbol) | |
setMonetaryThousandsSeparator (self, QString separator) | |
setNegativeMonetarySignPosition (self, KLocale.SignPosition signpos) | |
setNegativePrefixCurrencySymbol (self, bool prefix) | |
setNegativeSign (self, QString sign) | |
setPageSize (self, int paperFormat) | |
setPositiveMonetarySignPosition (self, KLocale.SignPosition signpos) | |
setPositivePrefixCurrencySymbol (self, bool prefix) | |
setPositiveSign (self, QString sign) | |
setThousandsSeparator (self, QString separator) | |
setTimeFormat (self, QString format) | |
setWeekStartDay (self, int day) | |
QString | thousandsSeparator (self) |
QString | timeFormat (self) |
QString | translateQt (self, QString context, QString sourceText, QString comment) |
translateRaw (self, QString msg, QString lang, QString trans) | |
translateRaw (self, QString ctxt, QString msg, QString lang, QString trans) | |
translateRaw (self, QString singular, QString plural, long n, QString lang, QString trans) | |
translateRaw (self, QString ctxt, QString singular, QString plural, long n, QString lang, QString trans) | |
bool | use12Clock (self) |
bool | useTranscript (self) |
int | weekStartDay (self) |
Static Methods | |
QString | defaultCountry () |
QString | defaultLanguage () |
QString | langLookup (QString fname, QString rtype="html") |
setMainCatalog (QString catalog) | |
splitLocale (QString locale, QString language, QString country, QString modifier, QString charset) |
Method Documentation
__init__ | ( | self, | ||
QString | catalog, | |||
KSharedConfig.Ptr | config=KSharedConfig.Ptr() | |||
) |
Constructs a KLocale with the given catalog 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 file. If KLocale is not able to use any 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.
- Parameters:
-
catalog The name of the main language file config The configuration file to use.
__init__ | ( | self, | ||
KLocale | rhs | |||
) |
Copy constructor.
QStringList allCountriesList | ( | self ) |
Provides list of all known country codes.
Use countryCodeToName(country) to get human readable, localized country names.
- Returns:
- a list of all country codes
- See also:
- countryCodeToName
QStringList allLanguagesList | ( | self ) |
Provides list of all known language codes.
Use languageCodeToName(language) to get human readable, localized language names.
- Returns:
- list of all language codes
- See also:
- languageCodeToName
KCalendarSystem calendar | ( | self ) |
Returns a pointer to the calendar system object.
- Returns:
- the current calendar system instance
QString calendarType | ( | self ) |
Returns the name of the calendar system that is currently being used by the system.
- Returns:
- the name of the calendar system
QTextCodec codecForEncoding | ( | self ) |
Returns the user's preferred encoding. Should never be NULL.
- Returns:
- The codec for the preferred encoding
- See also:
- encoding
- See also:
- encodingMib
copyCatalogsTo | ( | self, | ||
KLocale | locale | |||
) |
Copies the catalogs of this objct to an other KLocale object.
QString country | ( | self ) |
Returns the country code of the country where the user lives. defaultCountry() is returned by default, if no other available.
Use countryCodeToName(country) to get human readable, localized country names.
- Returns:
- the country code for the user
- See also:
- countryCodeToName
Convert a known country code to a human readable, localized form. If an unknown country code is supplied, empty string is returned; this will never happen if the code has been obtained by one of the KLocale methods.
- Parameters:
-
code the country code
- Returns:
- the human readable and localized form of the country name
- See also:
- country
- See also:
- allCountriesList
QString currencySymbol | ( | self ) |
Returns what the symbol denoting currency in the current locale as as defined by user settings should look like.
- Returns:
- The default currency symbol used by locale.
QString dateFormat | ( | self ) |
Returns the currently selected date format.
- Returns:
- Current date format.
- See also:
- setDateFormat()
QString dateFormatShort | ( | self ) |
Returns the currently selected short date format.
- Returns:
- Current short date format.
- See also:
- setDateFormatShort()
bool dateMonthNamePossessive | ( | self ) |
Use this to determine whether in dates a possessive form of month name is preferred ("of January" rather than "January")
- Returns:
- If possessive form should be used
QString decimalSymbol | ( | self ) |
Returns 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 defaultCountry | ( | ) |
Returns the name of the default country.
- Returns:
- Name of the default country
QString defaultLanguage | ( | ) |
Returns the name of the internal language.
- Returns:
- Name of the default language
QByteArray encoding | ( | self ) |
Returns the user's preferred encoding.
- Returns:
- The name of the preferred encoding
- See also:
- codecForEncoding
- See also:
- encodingMib
int encodingMib | ( | self ) |
Returns the user's preferred encoding.
- Returns:
- The Mib of the preferred encoding
- See also:
- encoding
- See also:
- codecForEncoding
int fileEncodingMib | ( | self ) |
Returns the file encoding.
- Returns:
- The Mib of the file encoding
- See also:
- QFile.encodeName
- See also:
- QFile.decodeName
QString formatByteSize | ( | self, | ||
float | size | |||
) |
Converts size from bytes to the string representation using the IEC 60027-2 standard
Example: formatByteSize(1024) returns "1.0 KiB"
- Parameters:
-
size size in bytes
- Returns:
- converted size as a string - e.g. 123.4 KiB , 12.0 MiB
Returns a string formatted to the current locale's conventions regarding dates.
- Parameters:
-
date the date to be formatted. format category of date format to use
- Returns:
- The date as a string
QString formatDateTime | ( | self, | ||
QDateTime | dateTime, | |||
KLocale.DateFormat | format=KLocale.ShortDate, | |||
bool | includeSecs=0 | |||
) |
Returns a string formatted to the current locale's conventions regarding both date and time.
- Parameters:
-
dateTime the date and time to be formatted format category of date format to use options additional output options
- Returns:
- The date and time as a string
QString formatDateTime | ( | self, | ||
KDateTime | dateTime, | |||
KLocale.DateFormat | format=KLocale.ShortDate, | |||
KLocale.DateTimeFormatOptions | options=0 | |||
) |
Returns a string formatted to the current locale's conventions regarding both date and time.
- Parameters:
-
dateTime the date and time to be formatted format category of date format to use options additional output options
- Returns:
- The date and time as a string
QString formatDuration | ( | self, | ||
long | mSec | |||
) |
Given a number of milliseconds, converts that to a string containing the localized equivalent
e.g. given formatDuration(60000), returns "1.0 minutes"
- Parameters:
-
mSec Time duration in milliseconds
- Returns:
- converted duration as a string - e.g. "5.5 seconds" "23.0 minutes"
QString formatLong | ( | self, | ||
long | num | |||
) |
Given an integer, converts that to a numeric string containing the localized numeric equivalent.
e.g. given 123456L, return "123,456" (for some European country).
- Parameters:
-
num The number to convert
- Returns:
- The number as a localized string
Given a double, converts that to a numeric string containing the localized monetary equivalent.
e.g. given 123456, return "$ 123,456.00".
- Parameters:
-
num The number we want to format currency The currency symbol you want. digits Number of fractional digits, or -1 for the default value
- Returns:
- The number of money as a localized string
- See also:
- fracDigits()
QString formatNumber | ( | self, | ||
float | num, | |||
int | precision=-1 | |||
) |
Given a double, converts that to a numeric string containing the localized numeric equivalent.
e.g. given 123456.78F, return "123,456.78" (for some European country). If precision isn't specified, 2 is used.
This function is a wrapper that is provided for convenience.
- Parameters:
-
num The number to convert precision Number of fractional digits used.
- Returns:
- The number as a localized string
- See also:
- formatNumber(const QString, bool, int)
Given a string representing a number, converts that to a numeric string containing the localized numeric equivalent.
e.g. given 123456.78F, return "123,456.78" (for some European country).
- Parameters:
-
numStr The number to format, as a string. round Round fractional digits. (default true) precision Number of fractional digits used for rounding. Unused if round=false. (default 2)
- Returns:
- The number as a localized string
Returns a string formatted to the current locale's conventions regarding times.
- Parameters:
-
pTime The time to be formatted. includeSecs if true, seconds are included in the output, otherwise only hours and minutes are formatted. isDuration if true, the given time is a duration, not a clock time. This means "am/pm" shouldn't be displayed.
- Returns:
- The time as a string
int fracDigits | ( | self ) |
The number of fractional digits to include in numeric/monetary values (usually 2).
- Returns:
- Default number of fractional digits used by locale.
insertCatalog | ( | self, | ||
QString | catalog | |||
) |
Adds another catalog to search for translation lookup. This function is useful for extern libraries and/or code, that provide there own messages.
If the catalog does not exist for the chosen language, it will be ignored and en_US will be used.
- Parameters:
-
catalog The catalog to add.
bool isApplicationTranslatedInto | ( | self, | ||
QString | language | |||
) |
Checks whether or not the active catalog is found for the given language.
- Parameters:
-
language language to check
- Deprecated:
Finds localized resource in resourceDir( rtype ) + <lang> + fname.
Since KDE 4.1, this service is provided in a slightly different form, automatically by e.g. KStandardDirs.locate() and other KDE core classes dealing with paths. For manual use, it is replaced by localizedFilePath().
- Parameters:
-
fname relative path to find rtype resource type to use
- Returns:
- path to localized resource
- See also:
- localizedFilePath
QString language | ( | self ) |
Returns the language code used by this object. The domain AND the library translation must be available in this language. defaultLanguage() is returned by default, if no other available.
Use languageCodeToName(language) to get human readable, localized language name.
- Returns:
- the currently used language code
- See also:
- languageCodeToName
Convert a known language code to a human readable, localized form. If an unknown language code is supplied, empty string is returned; this will never happen if the code has been obtained by one of the KLocale methods.
- Parameters:
-
language the language code
- Returns:
- the human readable and localized form if the code is known, empty otherwise
- See also:
- language
- See also:
- languageList
- See also:
- allLanguagesList
QStringList languageList | ( | self ) |
Returns the language codes selected by user, ordered by decreasing priority.
Use languageCodeToName(language) to get human readable, localized language name.
- Returns:
- list of language codes
- See also:
- languageCodeToName
- Since:
- 4.1
Tries to find a path to the localized file for the given original path. This is intended mainly for non-text resources (images, sounds, etc.), whereas text resources should be handled in more specific ways.
The possible localized paths are checked in turn by priority of set languages, in form of dirname/l10n/ll/basename, where dirname and basename are those of the original path, and ll is the language code.
KDE core classes which resolve paths internally (e.g. KStandardDirs) will usually perform this lookup behind the scene. In general, you should pipe resource paths through this method only on explicit translators' request, or when a resource is an obvious candidate for localization (e.g. a splash screen or a custom icon with some text drawn on it).
- Parameters:
-
filePath path to the original file
- Returns:
- path to the localized file if found, original path otherwise
KLocale.MeasureSystem measureSystem | ( | self ) |
Returns which measuring system we use.
- Returns:
- The preferred measuring system
QString monetaryDecimalSymbol | ( | self ) |
Returns 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 monetaryThousandsSeparator | ( | self ) |
Returns 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.
KLocale.SignPosition negativeMonetarySignPosition | ( | self ) |
Denotes where to place a negative sign in relation to a monetary value.
- Returns:
- Where/how to print the negative sign.
- See also:
- SignPosition
bool negativePrefixCurrencySymbol | ( | self ) |
If and only if the currency symbol precedes a negative value, this will be true.
- Returns:
- True if the currency symbol precedes negative numbers.
QString negativeSign | ( | self ) |
Returns what a negative sign should look like ("-", etc.) according to the current locale or user settings.
- Returns:
- The negative sign used by locale.
bool nounDeclension | ( | self ) |
Use this to determine whether nouns are declined in locale's language. This property should remain read-only (no setter function)
- Returns:
- If nouns are declined
int pageSize | ( | self ) |
Returns the preferred page size for printing.
- Returns:
- The preferred page size, cast it to QPrinter.PageSize
KLocale.SignPosition positiveMonetarySignPosition | ( | self ) |
Returns the position of a positive sign in relation to a monetary value.
- Returns:
- Where/how to print the positive sign.
- See also:
- SignPosition
bool positivePrefixCurrencySymbol | ( | self ) |
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.
QString positiveSign | ( | self ) |
Returns what a positive sign should look like ("+", " ", etc.) according to the current locale or user settings.
- Returns:
- The positive sign used by locale.
Converts a localized date string to a QDate. The bool pointed by ok will be invalid if the date entered was not valid.
- Parameters:
-
str the string we want to convert. ok the boolean that is set to false if it's not a valid date. If ok is 0, it will be ignored
- Returns:
- The string converted to a QDate
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. This method is stricter than readDate(str,&ok): it will either accept a date in full format or a date in short format, depending on flags.
- Parameters:
-
str the string we want to convert. flags whether the date string is to be in full format or in short format. ok the boolean that is set to false if it's not a valid date. If ok is 0, it will be ignored
- Returns:
- The string converted to a QDate
float, bool (ok) readMoney | ( | self, | ||
QString | numStr, | |||
) |
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. If ok is 0, it will be ignored
- Returns:
- The string converted to a double
float, bool (ok) readNumber | ( | self, | ||
QString | numStr, | |||
) |
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. If ok is 0, it will be ignored
- Returns:
- The string converted to a double
Converts a localized time string to a QTime. This method will try to parse it with seconds, then without seconds. The bool pointed to by ok will be set to false if the time entered was not valid.
- Parameters:
-
str the string we want to convert. ok the boolean that is set to false if it's not a valid time. If ok is 0, it will be ignored
- Returns:
- The string converted to a QTime
Converts a localized time string to a QTime. This method is stricter than readTime(str,&ok): it will either accept a time with seconds or a time without seconds. Use this method when the format is known by the application.
- Parameters:
-
str the string we want to convert. flags whether the time string is expected to contain seconds or not. ok the boolean that is set to false if it's not a valid time. If ok is 0, it will be ignored
- Returns:
- The string converted to a QTime
removeCatalog | ( | self, | ||
QString | catalog | |||
) |
Removes a catalog for translation lookup.
- Parameters:
-
catalog The catalog to remove.
- See also:
- insertCatalog()
setActiveCatalog | ( | self, | ||
QString | catalog | |||
) |
Sets the active catalog for translation lookup.
- Parameters:
-
catalog The catalog to activate.
setCalendar | ( | self, | ||
QString | calendarType | |||
) |
Changes the current calendar system to the calendar specified. Currently "gregorian" and "hijri" are supported. If the calendar system specified is not found, gregorian will be used.
- Parameters:
-
calendarType the name of the calendar type
Changes the current country. The current country will be left unchanged if failed. It will force a reload of the country specific configuration.
- Parameters:
-
country The ISO 3166 country code.
- Returns:
- True on success.
setCurrencySymbol | ( | self, | ||
QString | symbol | |||
) |
Changes the current currency symbol.
- Parameters:
-
symbol The new currency symbol
setDateFormat | ( | self, | ||
QString | format | |||
) |
Changes the current date format.
The format of the date is a string which contains variables that will be replaced:
Everything else in the format string will be taken as is. For example, March 20th 1989 with the format "%y:%m:%d" results in "89:03:20".
- Parameters:
-
format The new date format
setDateFormatShort | ( | self, | ||
QString | format | |||
) |
Changes the current short date format.
The format of the date is a string which contains variables that will be replaced:
Everything else in the format string will be taken as is. For example, March 20th 1989 with the format "%y:%m:%d" results in "89:03:20".
- Parameters:
-
format The new short date format
setDateMonthNamePossessive | ( | self, | ||
bool | possessive | |||
) |
Changes the form of month name used in dates.
- Parameters:
-
possessive True if possessive forms should be used
setDecimalSymbol | ( | self, | ||
QString | symbol | |||
) |
Changes the symbol used to identify the decimal pointer.
- Parameters:
-
symbol The new decimal symbol.
bool setEncoding | ( | self, | ||
int | mibEnum | |||
) |
Changes the current encoding.
- Parameters:
-
mibEnum The mib of the preferred codec
- Returns:
- True on success.
setFracDigits | ( | self, | ||
int | digits | |||
) |
Changes the number of digits used when formating numbers.
- Parameters:
-
digits The default number of digits to use.
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.
- Parameters:
-
language the language code
- Returns:
- true on success
bool setLanguage | ( | self, | ||
QStringList | languages | |||
) |
Changes the list of preferred languages for the locale. The first valid language in the list will be used, or the default language (en_US) if none of the specified languages were available.
- Parameters:
-
languages the list of language codes
- Returns:
- true if one of the specified languages were used
setMainCatalog | ( | QString | catalog | |
) |
Use this as main catalog 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.
- Parameters:
-
catalog Catalog to override all other main Catalogs.
setMeasureSystem | ( | self, | ||
KLocale.MeasureSystem | value | |||
) |
Changes the preferred measuring system.
- Returns:
- value The preferred measuring system
setMonetaryDecimalSymbol | ( | self, | ||
QString | symbol | |||
) |
Changes the symbol used to identify the decimal pointer for monetary values.
- Parameters:
-
symbol The new decimal symbol.
setMonetaryThousandsSeparator | ( | self, | ||
QString | separator | |||
) |
Changes the separator used to group digits when formating monetary values.
- Parameters:
-
separator The new thousands separator.
setNegativeMonetarySignPosition | ( | self, | ||
KLocale.SignPosition | signpos | |||
) |
Changes the sign position used for negative monetary values.
- Parameters:
-
signpos The new sign position
setNegativePrefixCurrencySymbol | ( | self, | ||
bool | prefix | |||
) |
Changes the position where the currency symbol should be printed for negative monetary values.
- Parameters:
-
prefix True if the currency symbol should be prefixed instead of postfixed
setNegativeSign | ( | self, | ||
QString | sign | |||
) |
Changes the sign used to identify a negative number.
- Parameters:
-
sign Sign used for negative numbers.
setPageSize | ( | self, | ||
int | paperFormat | |||
) |
Changes the preferred page size when printing.
- Parameters:
-
paperFormat the new preferred page size in the format QPrinter.PageSize
setPositiveMonetarySignPosition | ( | self, | ||
KLocale.SignPosition | signpos | |||
) |
Changes the sign position used for positive monetary values.
- Parameters:
-
signpos The new sign position
setPositivePrefixCurrencySymbol | ( | self, | ||
bool | prefix | |||
) |
Changes the position where the currency symbol should be printed for positive monetary values.
- Parameters:
-
prefix True if the currency symbol should be prefixed instead of postfixed
setPositiveSign | ( | self, | ||
QString | sign | |||
) |
Changes the sign used to identify a positive number. Normally this is left blank.
- Parameters:
-
sign Sign used for positive numbers.
setThousandsSeparator | ( | self, | ||
QString | separator | |||
) |
Changes the separator used to group digits when formating numbers.
- Parameters:
-
separator The new thousands separator.
setTimeFormat | ( | self, | ||
QString | format | |||
) |
Changes the current time format.
The format of the time is string a which contains variables that will be replaced:
Everything else in the format string will be taken as is. For example, 5.23pm with the format "%H:%M" results in "17:23".
- Parameters:
-
format The new time format
setWeekStartDay | ( | self, | ||
int | day | |||
) |
Changes how KLocale defines the first day in week.
- Parameters:
-
day first day of the week (Monday=1..Sunday=7) as integer
splitLocale | ( | QString | locale, | |
QString | language, | |||
QString | country, | |||
QString | modifier, | |||
QString | charset | |||
) |
Parses locale string into distinct parts. The format of locale is language_COUNTRY@modifier.CHARSET
- Parameters:
-
locale the locale string to split language set to the language part of the locale country set to the country part of the locale modifier set to the modifer part of the locale charset set to the charset part of the locale
QString thousandsSeparator | ( | self ) |
Returns 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 timeFormat | ( | self ) |
Returns the currently selected time format.
- Returns:
- Current time format.
- See also:
- setTimeFormat()
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())
Raw translation from message catalogs.
Never use this directly to get message translations. See i18n* and ki18n* calls related to KLocalizedString.
- Parameters:
-
msg the message. Must not be null. Must be UTF-8 encoded. lang language in which the translation was found. If no translation was found, KLocale.defaultLanguage() is reported. If null, the language is not reported. trans raw translation, or original if not found. If no translation was found, original message is reported. If null, the translation is not reported.
- See also:
- KLocalizedString
Raw translation from message catalogs, with given context. Context + message are used as the lookup key in catalogs.
Never use this directly to get message translations. See i18n* and ki18n* calls related to KLocalizedString.
- Parameters:
-
ctxt the context. Must not be null. Must be UTF-8 encoded. msg the message. Must not be null. Must be UTF-8 encoded. lang language in which the translation was found. If no translation was found, KLocale.defaultLanguage() is reported. If null, the language is not reported. trans raw translation, or original if not found. If no translation was found, original message is reported. If null, the translation is not reported.
- See also:
- KLocalizedString
Raw translation from message catalogs, with given singular/plural form. Singular form is used as the lookup key in catalogs.
Never use this directly to get message translations. See i18n* and ki18n* calls related to KLocalizedString.
- Parameters:
-
singular the singular form. Must not be null. Must be UTF-8 encoded. plural the plural form. Must not be null. Must be UTF-8 encoded. n number on which the forms are decided. lang language in which the translation was found. If no translation was found, KLocale.defaultLanguage() is reported. If null, the language is not reported. trans raw translation, or original if not found. If no translation was found, original message is reported (either plural or singular, as determined by n ). If null, the translation is not reported.
- See also:
- KLocalizedString
translateRaw | ( | self, | ||
QString | ctxt, | |||
QString | singular, | |||
QString | plural, | |||
long | n, | |||
QString | lang, | |||
QString | trans | |||
) |
Raw translation from message catalogs, with given context and singular/plural form. Context + singular form is used as the lookup key in catalogs.
Never use this directly to get message translations. See i18n* and ki18n* calls related to KLocalizedString.
- Parameters:
-
ctxt the context. Must not be null. Must be UTF-8 encoded. singular the singular form. Must not be null. Must be UTF-8 encoded. plural the plural form. Must not be null. Must be UTF-8 encoded. n number on which the forms are decided. lang language in which the translation was found. If no translation was found, KLocale.defaultLanguage() is reported. If null, the language is not reported. trans raw translation, or original if not found. If no translation was found, original message is reported (either plural or singular, as determined by n ). If null, the translation is not reported.
- See also:
- KLocalizedString
bool use12Clock | ( | self ) |
Use this to determine if the user wants a 12 hour clock.
- Returns:
- If the user wants 12h clock
bool useTranscript | ( | self ) |
Reports whether evaluation of translation scripts is enabled.
- Returns:
- true if script evaluation is enabled, false otherwise.
int weekStartDay | ( | self ) |
Use this to determine which day is the first day of the week.
- Returns:
- an integer (Monday=1..Sunday=7)
Enumeration Documentation
DateFormat |
Format for date string.
- Enumerator:
-
ShortDate LongDate FancyShortDate FancyLongDate
DateTimeFormatOption |
Options for formatting date-time values.
- Note:
- It is necessary to wrap members of this enumeration in a
DateTimeFormatOptions
instance when passing them to a method as group of flags. For example:DateTimeFormatOptions( TimeZone | Seconds)
- Enumerator:
-
TimeZone = 0x01 Seconds = 0x02
MeasureSystem |
The Metric system will give you information in mm, while the Imperial system will give you information in inches.
- Enumerator:
-
Metric Imperial
ReadDateFlags |
Flags for readDate()
- Enumerator:
-
NormalFormat = 1 ShortFormat = 2
ReadTimeFlags |
Flags for readTime()
- Enumerator:
-
WithSeconds = 0 WithoutSeconds = 1
SignPosition |
Put parantheses around the quantity, e.g. "$ (217)"
- Enumerator:
-
ParensAround = 0 BeforeQuantityMoney = 1 AfterQuantityMoney = 2 BeforeMoney = 3 AfterMoney = 4