# class KLocale

###

Module | kdecore
Namespace |
Class | KLocale
Inherits |

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));

Author Stephan Kulow <coolo@kde.org>, Preston Brown <pbrown@kde.org>, Hans Petter Bieker <bieker@kde.org>, Lukas Tinkl <lukas.tinkl@suse.cz> class for supporting locale settings and national language

### enums

- DateFormat { ShortDate, LongDate, FancyShortDate, FancyLongDate }
- DateTimeFormatOption { TimeZone, Seconds }
  typesafe object: DateTimeFormatOptions
- MeasureSystem { Metric, Imperial }
- ReadDateFlags { NormalFormat, ShortFormat }
- ReadTimeFlags { WithSeconds, WithoutSeconds }
- SignPosition { ParensAround, BeforeQuantityMoney, AfterQuantityMoney, BeforeMoney, AfterMoney }

enum details

### methods

- KLocale (catalog, config)

  returns ctor
  KDE 4.1.0 and later only

  Argument | Type | Default
  --- | --- | ---
  catalog | QString |
  config | KSharedConfig.Ptr | 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.

  catalog - The name of the main language file

  config - The configuration file to use.

- KLocale (catalog, language, country, config)

  returns ctor

  Argument | Type | Default
  --- | --- | ---
  catalog | QString |
  language | QString |
  country | QString | QString()
  config | KConfig | 0

- KLocale (rhs)

  returns ctor
  Not implemented

  Argument | Type | Default
  --- | --- | ---
  rhs | KLocale |

  Copy constructor.

- KLocale (a0, a1)

  returns ctor
  before KDE 4.1.0 only

  Argument | Type | Default
  --- | --- | ---
  a0 | QString |
  a1 | KSharedConfig.Ptr | KSharedConfig.Ptr()

- allCountriesList ( )

  returns QStringList

  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

- allLanguagesList ( )

  returns QStringList

  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

- calendar ( )

  returns KCalendarSystem

  Returns a pointer to the calendar system object.

  Returns the current calendar system instance

- calendarType ( )

  returns QString

  Returns the name of the calendar system that is currently being used by the system.

  Returns the name of the calendar system

- codecForEncoding ( )

  returns QTextCodec

  Returns the user's preferred encoding. Should never be NULL.

  Returns The codec for the preferred encoding

  See also encoding

  See also encodingMib

- copyCatalogsTo (locale)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  locale | KLocale |

  Copies the catalogs of this objct to an other KLocale object.

- country ( )

  returns QString

  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

- countryCodeToName (country)

  returns QString

  Argument | Type | Default
  --- | --- | ---
  country | QString |

  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.

  code - the country code

  Returns the human readable and localized form of the country name

  See also country

  See also allCountriesList

- currencySymbol ( )

  returns QString

  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.

- dateFormat ( )

  returns QString

  Returns the currently selected date format.

  Returns Current date format.

  See also setDateFormat()

- dateFormatShort ( )

  returns QString

  Returns the currently selected short date format.

  Returns Current short date format.

  See also setDateFormatShort()

- dateMonthNamePossessive ( )

  returns bool

  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

- decimalSymbol ( )

  returns QString

  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.

- defaultCountry ( )

  returns QString
  static

  Returns the name of the default country.

  Returns Name of the default country

- defaultLanguage ( )

  returns QString
  static

  Returns the name of the internal language.

  Returns Name of the default language

- encoding ( )

  returns QByteArray

  Returns the user's preferred encoding.

  Returns The name of the preferred encoding

  See also codecForEncoding

  See also encodingMib

- encodingMib ( )

  returns int

  Returns the user's preferred encoding.

  Returns The Mib of the preferred encoding

  See also encoding

  See also codecForEncoding

- fileEncodingMib ( )

  returns int

  Returns the file encoding.

  Returns The Mib of the file encoding

  See also QFile.encodeName

  See also QFile.decodeName

- formatByteSize (size)

  returns QString

  Argument | Type | Default
  --- | --- | ---
  size | double |

  Converts size from bytes to the string representation using the IEC 60027-2 standard

  Example: formatByteSize(1024) returns "1.0 KiB"

  - size size in bytes Returns converted size as a string - e.g. 123.4 KiB , 12.0 MiB

- formatDate (date, format)

  returns QString

  Argument | Type | Default
  --- | --- | ---
  date | QDate |
  format | KLocale.DateFormat | KLocale.LongDate

  Returns a string formatted to the current locale's conventions regarding dates.

  date - the date to be formatted.

  format - category of date format to use

  Returns The date as a string

- formatDateTime (dateTime, format, includeSecs)

  returns QString

  Argument | Type | Default
  --- | --- | ---
  dateTime | QDateTime |
  format | KLocale.DateFormat | KLocale.ShortDate
  includeSecs | bool | 0

  Returns a string formatted to the current locale's conventions regarding both date and time.

  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

- formatDateTime (dateTime, format, options)

  returns QString

  Argument | Type | Default
  --- | --- | ---
  dateTime | KDateTime |
  format | KLocale.DateFormat | KLocale.ShortDate
  options | KLocale.DateTimeFormatOptions | 0

  Returns a string formatted to the current locale's conventions regarding both date and time.

  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

- formatDuration (mSec)

  returns QString

  Argument | Type | Default
  --- | --- | ---
  mSec | unsigned long |

  Given a number of milliseconds, converts that to a string containing the localized equivalent

  e.g. given formatDuration(60000), returns "1.0 minutes"

  mSec - Time duration in milliseconds Returns converted duration as a string - e.g. "5.5 seconds" "23.0 minutes"

- formatLong (num)

  returns QString

  Argument | Type | Default
  --- | --- | ---
  num | long |

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

  num - The number to convert

  Returns The number as a localized string

- formatMoney (num, currency, digits)

  returns QString

  Argument | Type | Default
  --- | --- | ---
  num | double |
  currency | QString | QString()
  digits | int | -1

  Given a double, converts that to a numeric string containing the localized monetary equivalent.

  e.g. given 123456, return "$ 123,456.00".

  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()

- formatNumber (num, precision)

  returns QString

  Argument | Type | Default
  --- | --- | ---
  num | double |
  precision | int | -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.

  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)

- formatNumber (numStr, round, precision)

  returns QString

  Argument | Type | Default
  --- | --- | ---
  numStr | QString |
  round | bool | 1
  precision | int | 2

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

  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

- formatTime (pTime, includeSecs, isDuration)

  returns QString

  Argument | Type | Default
  --- | --- | ---
  pTime | QTime |
  includeSecs | bool | 0
  isDuration | bool | 0

  Returns a string formatted to the current locale's conventions regarding times.

  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

- fracDigits ( )

  returns int

  The number of fractional digits to include in numeric/monetary values (usually 2).

  Returns Default number of fractional digits used by locale.

- insertCatalog (catalog)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  catalog | QString |

  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.

  catalog - The catalog to add.

- isApplicationTranslatedInto (language)

  returns bool

  Argument | Type | Default
  --- | --- | ---
  language | QString |

  Checks whether or not the active catalog is found for the given language.

  language - language to check

- langLookup (fname, rtype)

  returns QString
  static

  Argument | Type | Default
  --- | --- | ---
  fname | QString |
  rtype | char | "html"

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

  fname - relative path to find

  rtype - resource type to use

  Returns path to localized resource

  See also localizedFilePath

- language ( )

  returns QString

  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

- languageCodeToName (language)

  returns QString

  Argument | Type | Default
  --- | --- | ---
  language | QString |

  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.

  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

- languageList ( )

  returns QStringList

  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

- localizedFilePath (filePath)

  returns QString
  KDE 4.1.0 and later only

  Argument | Type | Default
  --- | --- | ---
  filePath | QString |

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

  filePath - path to the original file

  Returns path to the localized file if found, original path otherwise

- measureSystem ( )

  returns KLocale.MeasureSystem

  Returns which measuring system we use.

  Returns The preferred measuring system

- monetaryDecimalSymbol ( )

  returns QString

  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.

- monetaryThousandsSeparator ( )

  returns QString

  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.

- negativeMonetarySignPosition ( )

  returns KLocale.SignPosition

  Denotes where to place a negative sign in relation to a monetary value.

  Returns Where/how to print the negative sign.

  See also SignPosition

- negativePrefixCurrencySymbol ( )

  returns bool

  If and only if the currency symbol precedes a negative value, this will be true.

  Returns True if the currency symbol precedes negative numbers.

- negativeSign ( )

  returns QString

  Returns what a negative sign should look like ("-", etc.) according to the current locale or user settings.

  Returns The negative sign used by locale.

- nounDeclension ( )

  returns bool

  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

- pageSize ( )

  returns int

  Returns the preferred page size for printing.

  Returns The preferred page size, cast it to QPrinter.PageSize

- positiveMonetarySignPosition ( )

  returns KLocale.SignPosition

  Returns the position of a positive sign in relation to a monetary value.

  Returns Where/how to print the positive sign.

  See also SignPosition

- positivePrefixCurrencySymbol ( )

  returns bool

  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.

- positiveSign ( )

  returns QString

  Returns what a positive sign should look like ("+", " ", etc.) according to the current locale or user settings.

  Returns The positive sign used by locale.

- readDate (str)

  returns QDate, bool (ok)

  Argument | Type | Default
  --- | --- | ---
  str | QString |

  Converts a localized date string to a QDate. The bool pointed by ok will be invalid if the date entered was not valid.

  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

- readDate (intstr, fmt)

  returns QDate, bool (ok)

  Argument | Type | Default
  --- | --- | ---
  intstr | QString |
  fmt | QString |

  Converts a localized date string to a QDate, using the specified format. You will usually not want to use this method.

- readDate (str, flags)

  returns QDate, bool (ok)

  Argument | Type | Default
  --- | --- | ---
  str | QString |
  flags | KLocale.ReadDateFlags |

  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.

  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

- readMoney (numStr)

  returns double, bool (ok)

  Argument | Type | Default
  --- | --- | ---
  numStr | QString |

  Converts a localized monetary string to a double.

  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

- readNumber (numStr)

  returns double, bool (ok)

  Argument | Type | Default
  --- | --- | ---
  numStr | QString |

  Converts a localized numeric string to a double.

  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

- readTime (str)

  returns QTime, bool (ok)

  Argument | Type | Default
  --- | --- | ---
  str | QString |

  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.

  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

- readTime (str, flags)

  returns QTime, bool (ok)

  Argument | Type | Default
  --- | --- | ---
  str | QString |
  flags | KLocale.ReadTimeFlags |

  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.

  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 (catalog)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  catalog | QString |

  Removes a catalog for translation lookup.

  catalog - The catalog to remove.

  See also insertCatalog()

- setActiveCatalog (catalog)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  catalog | QString |

  Sets the active catalog for translation lookup.

  catalog - The catalog to activate.

- setCalendar (calendarType)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  calendarType | QString |

  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.

  calendarType - the name of the calendar type

- setCountry (country, config)

  returns bool

  Argument | Type | Default
  --- | --- | ---
  country | QString |
  config | KConfig |

  Changes the current country. The current country will be left unchanged if failed. It will force a reload of the country specific configuration.

  country - The ISO 3166 country code.

  Returns True on success.

- setCurrencySymbol (symbol)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  symbol | QString |

  Changes the current currency symbol.

  symbol - The new currency symbol

- setDateFormat (format)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  format | QString |

  Changes the current date format.

  The format of the date is a string which contains variables that will be replaced:

- %Y with the century (e.g. "19" for "1984")
- %y with the lower 2 digits of the year (e.g. "84" for "1984")
- %n with the month (January="1", December="12")
- %m with the month with two digits (January="01", December="12")
- %e with the day of the month (e.g. "1" on the first of march)
- %d with the day of the month with two digits(e.g. "01" on the first of march)
- %b with the short form of the month (e.g. "Jan" for January)
- %B with the long form of the month (e.g. "January")
- %a with the short form of the weekday (e.g. "Wed" for Wednesday)
- %A with the long form of the weekday (e.g. "Wednesday" for Wednesday)

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

format - The new date format

- setDateFormatShort (format)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  format | QString |

  Changes the current short date format.

  The format of the date is a string which contains variables that will be replaced:

- %Y with the century (e.g. "19" for "1984")
- %y with the lower 2 digits of the year (e.g. "84" for "1984")
- %n with the month (January="1", December="12")
- %m with the month with two digits (January="01", December="12")
- %e with the day of the month (e.g. "1" on the first of march)
- %d with the day of the month with two digits(e.g. "01" on the first of march)
- %b with the short form of the month (e.g. "Jan" for January)
- %B with the long form of the month (e.g. "January")
- %a with the short form of the weekday (e.g. "Wed" for Wednesday)
- %A with the long form of the weekday (e.g. "Wednesday" for Wednesday)

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

format - The new short date format

- setDateMonthNamePossessive (possessive)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  possessive | bool |

  Changes the form of month name used in dates.

  possessive - True if possessive forms should be used

- setDecimalSymbol (symbol)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  symbol | QString |

  Changes the symbol used to identify the decimal pointer.

  symbol - The new decimal symbol.

- setEncoding (mibEnum)

  returns bool

  Argument | Type | Default
  --- | --- | ---
  mibEnum | int |

  Changes the current encoding.

  mibEnum - The mib of the preferred codec

  Returns True on success.

- setFracDigits (digits)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  digits | int |

  Changes the number of digits used when formating numbers.

  digits - The default number of digits to use.

- setLanguage (language, config)

  returns bool

  Argument | Type | Default
  --- | --- | ---
  language | QString |
  config | KConfig |

  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.

  language - the language code

  Returns true on success

- setLanguage (languages)

  returns bool

  Argument | Type | Default
  --- | --- | ---
  languages | QStringList |

  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.

  languages - the list of language codes

  Returns true if one of the specified languages were used

- setMainCatalog (catalog)

  returns Nothing
  static

  Argument | Type | Default
  --- | --- | ---
  catalog | char |

  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.

  catalog - Catalog to override all other main Catalogs.

- setMeasureSystem (value)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  value | KLocale.MeasureSystem |

  Changes the preferred measuring system.

  Returns value The preferred measuring system

- setMonetaryDecimalSymbol (symbol)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  symbol | QString |

  Changes the symbol used to identify the decimal pointer for monetary values.

  symbol - The new decimal symbol.

- setMonetaryThousandsSeparator (separator)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  separator | QString |

  Changes the separator used to group digits when formating monetary values.

  separator - The new thousands separator.

- setNegativeMonetarySignPosition (signpos)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  signpos | KLocale.SignPosition |

  Changes the sign position used for negative monetary values.

  signpos - The new sign position

- setNegativePrefixCurrencySymbol (prefix)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  prefix | bool |

  Changes the position where the currency symbol should be printed for negative monetary values.

  prefix - True if the currency symbol should be prefixed instead of postfixed

- setNegativeSign (sign)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  sign | QString |

  Changes the sign used to identify a negative number.

  sign - Sign used for negative numbers.

- setPageSize (paperFormat)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  paperFormat | int |

  Changes the preferred page size when printing.

  paperFormat - the new preferred page size in the format QPrinter.PageSize

- setPositiveMonetarySignPosition (signpos)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  signpos | KLocale.SignPosition |

  Changes the sign position used for positive monetary values.

  signpos - The new sign position

- setPositivePrefixCurrencySymbol (prefix)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  prefix | bool |

  Changes the position where the currency symbol should be printed for positive monetary values.

  prefix - True if the currency symbol should be prefixed instead of postfixed

- setPositiveSign (sign)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  sign | QString |

  Changes the sign used to identify a positive number. Normally this is left blank.

  sign - Sign used for positive numbers.

- setThousandsSeparator (separator)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  separator | QString |

  Changes the separator used to group digits when formating numbers.

  separator - The new thousands separator.

- setTimeFormat (format)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  format | QString |

  Changes the current time format.

  The format of the time is string a which contains variables that will be replaced:

- %H with the hour in 24h format and 2 digits (e.g. 5pm is "17", 5am is "05")
- %k with the hour in 24h format and one digits (e.g. 5pm is "17", 5am is "5")
- %I with the hour in 12h format and 2 digits (e.g. 5pm is "05", 5am is "05")
- %l with the hour in 12h format and one digits (e.g. 5pm is "5", 5am is "5")
- %M with the minute with 2 digits (e.g. the minute of 07:02:09 is "02")
- %S with the seconds with 2 digits (e.g. the minute of 07:02:09 is "09")
- %p with pm or am (e.g. 17.00 is "pm", 05.00 is "am")

Everything else in the format string will be taken as is. For example, 5.23pm with the format "%H:%M" results in "17:23".

format - The new time format

- setWeekStartDay (day)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  day | int |

  Changes how KLocale defines the first day in week.

  day - first day of the week (Monday=1..Sunday=7) as integer

- splitLocale (locale, language, country, modifier, charset)

  returns Nothing
  static

  Argument | Type | Default
  --- | --- | ---
  locale | QString |
  language | QString |
  country | QString |
  modifier | QString |
  charset | QString |

  Parses locale string into distinct parts. The format of locale is language_COUNTRY@modifier.CHARSET

  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

- thousandsSeparator ( )

  returns QString

  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.

- timeFormat ( )

  returns QString

  Returns the currently selected time format.

  Returns Current time format.

  See also setTimeFormat()

- translateQt (context, sourceText, comment)

  returns QString

  Argument | Type | Default
  --- | --- | ---
  context | char |
  sourceText | char |
  comment | char |

  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())

- translateRaw (msg, lang, trans)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  msg | char |
  lang | QString |
  trans | QString |

  Raw translation from message catalogs.

  Never use this directly to get message translations. See i18n* and ki18n* calls related to KLocalizedString.

  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

- translateRaw (ctxt, msg, lang, trans)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  ctxt | char |
  msg | char |
  lang | QString |
  trans | QString |

  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.

  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

- translateRaw (singular, plural, n, lang, trans)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  singular | char |
  plural | char |
  n | unsigned long |
  lang | QString |
  trans | QString |

  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.

  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 (ctxt, singular, plural, n, lang, trans)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  ctxt | char |
  singular | char |
  plural | char |
  n | unsigned long |
  lang | QString |
  trans | QString |

  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.

  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

- use12Clock ( )

  returns bool

  Use this to determine if the user wants a 12 hour clock.

  Returns If the user wants 12h clock

- useTranscript ( )

  returns bool

  Reports whether evaluation of translation scripts is enabled.

  Returns true if script evaluation is enabled, false otherwise.

- weekStartDay ( )

  returns int

  Use this to determine which day is the first day of the week.

  Returns an integer (Monday=1..Sunday=7)

### enums - detail

- DateFormat { ShortDate, LongDate, FancyShortDate, FancyLongDate }

  Format for date string.

  | ShortDate | - | - |
  | LongDate | - | - |
  | FancyShortDate | - | - |
  | FancyLongDate | - | - |

- DateTimeFormatOption { TimeZone, Seconds }

  Options for formatting date-time values.

  typesafe object: DateTimeFormatOptions

TimeZone - 0x01 -
Seconds - 0x02 -

- MeasureSystem { Metric, Imperial }

  The Metric system will give you information in mm, while the Imperial system will give you information in inches.

  | Metric | - | - |
  | Imperial | - | - |

- ReadDateFlags { NormalFormat, ShortFormat }

  Flags for readDate()

  | NormalFormat | - 1 | - |
  | ShortFormat | - 2 | - |

- ReadTimeFlags { WithSeconds, WithoutSeconds }

  Flags for readTime()

  | WithSeconds | - 0 | - |
  | WithoutSeconds | - 1 | - |

- SignPosition { ParensAround, BeforeQuantityMoney, AfterQuantityMoney, BeforeMoney, AfterMoney }

  Put parantheses around the quantity, e.g. "$ (217)"

  | ParensAround | - 0 | - |
  | BeforeQuantityMoney | - 1 | - |
  | AfterQuantityMoney | - 2 | - |
  | BeforeMoney | - 3 | - |
  | AfterMoney | - 4 | - |