org.kde.koala

Class KLocale

public class KLocale extends Object implements QtSupport

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.

Author: Stephan Kulow , Preston Brown , Hans Petter Bieker , Lukas Tinkl

UNKNOWN: class for supporting locale settings and national language.

Field Summary
static intAfterMoney
static intAfterQuantityMoney
static intBeforeMoney
static intBeforeQuantityMoney
static intImperial
static intMetric
The Metric system will give you information in mm, while the Imperial system will give you information in inches.
static intNormalFormat
static intParensAround
Various positions for where to place the positive or negative sign when they are related to a monetary value.
static intShortFormat
static intWithoutSeconds
static intWithSeconds
Constructor Summary
protected KLocale(Class dummy)
KLocale(String catalog, KConfig config)
Constructs a KLocale with the given catalog name.
KLocale(String catalog)
KLocale(KLocale rhs)
Copy constructor.
Method Summary
ArrayListallCountriesTwoAlpha()
Returns list of all known country codes.
ArrayListallLanguagesTwoAlpha()
Returns list of all known ISO 639-1 codes.
KCalendarSystemcalendar()
Returns a pointer to the calendar system object.
StringcalendarType()
Returns the name of the calendar system that is currently being used by the system.
QTextCodeccodecForEncoding()
Returns the user's preferred encoding.
Stringcountry()
Returns the country code of the country where the user lives. defaultCountry() is returned by default, if no other available.
StringcurrencySymbol()
Returns what the symbol denoting currency in the current locale as as defined by user settings should look like.
StringdateFormat()
Returns the currently selected date format.
StringdateFormatShort()
Returns the currently selected short date format.
booleandateMonthNamePossessive()
Use this to determine whether in dates a possessive form of month name is preferred ("of January" rather than "January")
StringdecimalSymbol()
Returns what a decimal point should look like ("." or "," etc.) according to the current locale or user settings.
static StringdefaultCountry()
Returns the name of the default country.
static StringdefaultLanguage()
Returns the name of the internal language.
voiddispose()
Delete the wrapped C++ instance ahead of finalize()
Stringencoding()
Returns the user's preferred encoding.
intencodingMib()
Returns the user's preferred encoding.
intfileEncodingMib()
Returns the file encoding.
protected voidfinalize()
Deletes the wrapped C++ instance
StringformatDate(Calendar pDate, boolean shortFormat)
Returns a string formatted to the current locale's conventions regarding dates.
StringformatDate(Calendar pDate)
StringformatDateTime(Calendar pDateTime, boolean shortFormat, boolean includeSecs)
Returns a string formated to the current locale's conventions regarding both date and time.
StringformatDateTime(Calendar pDateTime, boolean shortFormat)
StringformatDateTime(Calendar pDateTime)
StringformatLong(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).
StringformatMoney(double num, String currency, int digits)
Given a double, converts that to a numeric string containing the localized monetary equivalent. e.g. given 123456, return "$ 123,456.00".
StringformatMoney(double num, String currency)
StringformatMoney(double num)
StringformatNumber(double num, int precision)
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).
StringformatNumber(double num)
StringformatNumber(String numStr, boolean round, int precision)
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).
StringformatTime(Date pTime, boolean includeSecs, boolean isDuration)
Returns a string formatted to the current locale's conventions regarding times.
StringformatTime(Date pTime, boolean includeSecs)
Returns a string formatted to the current locale's conventions regarding times.
StringformatTime(Date pTime)
intfracDigits()
The number of fractional digits to include in numeric/monetary values (usually 2).
protected static voidinitInstance()
pointer.
voidinsertCatalogue(String catalog)
Adds another catalog to search for translation lookup.
booleanisDisposed()
Has the wrapped C++ instance been deleted?
static StringlangLookup(String fname, String rtype)
Finds localized resource in resourceDir( rtype ) + \ + fname.
static StringlangLookup(String fname)
Stringlanguage()
Returns the language used by this object.
ArrayListlanguageList()
Returns the languages selected by user.
ArrayListlanguagesTwoAlpha()
Returns the preferred languages as ISO 639-1 codes.
intmeasureSystem()
Returns which measuring system we use.
StringmonetaryDecimalSymbol()
Returns what a decimal point should look like ("." or "," etc.) for monetary values, according to the current locale or user settings.
StringmonetaryThousandsSeparator()
Returns what a thousands separator for monetary values should look like ("," or " " etc.) according to the current locale or user settings.
intnegativeMonetarySignPosition()
Denotes where to place a negative sign in relation to a monetary value.
booleannegativePrefixCurrencySymbol()
If and only if the currency symbol precedes a negative value, this will be true.
StringnegativeSign()
Returns what a negative sign should look like ("-", etc.) according to the current locale or user settings.
booleannounDeclension()
Use this to determine whether nouns are declined in locale's language.
intpageSize()
Returns the preferred page size for printing.
intpositiveMonetarySignPosition()
Returns the position of a positive sign in relation to a monetary value.
booleanpositivePrefixCurrencySymbol()
If and only if the currency symbol precedes a positive value, this will be true.
StringpositiveSign()
Returns what a positive sign should look like ("+", " ", etc.) according to the current locale or user settings.
CalendarreadDate(String str, boolean[] ok)
Converts a localized date string to a Calendar.
CalendarreadDate(String str)
CalendarreadDate(String intstr, String fmt, boolean[] ok)
Converts a localized date string to a Calendar, using the specified format.
CalendarreadDate(String intstr, String fmt)
CalendarreadDate(String str, int flags, boolean[] ok)
Converts a localized date string to a Calendar.
CalendarreadDate(String str, int flags)
doublereadMoney(String numStr, boolean[] ok)
Converts a localized monetary string to a double.
doublereadMoney(String numStr)
doublereadNumber(String numStr, boolean[] ok)
Converts a localized numeric string to a double.
doublereadNumber(String numStr)
DatereadTime(String str, boolean[] ok)
Converts a localized time string to a Date This method will try to parse it with seconds, then without seconds.
DatereadTime(String str)
DatereadTime(String str, int flags, boolean[] ok)
Converts a localized time string to a Date This method is stricter than readTime(str,&ok): it will either accept a time with seconds or a time without seconds.
DatereadTime(String str, int flags)
voidremoveCatalogue(String catalog)
Removes a catalog for translation lookup.
voidsetActiveCatalogue(String catalog)
Sets the active catalog for translation lookup.
voidsetCalendar(String calendarType)
Changes the current calendar system to the calendar specified.
booleansetCountry(String country)
Changes the current country.
voidsetCurrencySymbol(String symbol)
Changes the current currency symbol.
voidsetDateFormat(String format)
Changes the current date format.
voidsetDateFormatShort(String format)
Changes the current short date format.
voidsetDateMonthNamePossessive(boolean possessive)
Changes the form of month name used in dates.
voidsetDecimalSymbol(String symbol)
Changes the symbol used to identify the decimal pointer.
booleansetEncoding(int mibEnum)
Changes the current encoding.
voidsetFracDigits(int digits)
Changes the number of digits used when formating numbers.
booleansetLanguage(String language)
Changes the current language.
booleansetLanguage(String[] languages)
Changes the list of prefed languages for the locale.
static voidsetMainCatalogue(String catalog)
Use this as main catalog for all KLocales, if not the appname will be used.
voidsetMeasureSystem(int value)
Changes the preferred measuring system.
voidsetMonetaryDecimalSymbol(String symbol)
Changes the symbol used to identify the decimal pointer for monetary values.
voidsetMonetaryThousandsSeparator(String separator)
Changes the separator used to group digits when formating monetary values.
voidsetNegativeMonetarySignPosition(int signpos)
Changes the sign position used for negative monetary values.
voidsetNegativePrefixCurrencySymbol(boolean prefix)
Changes the position where the currency symbol should be printed for negative monetary values.
voidsetNegativeSign(String sign)
Changes the sign used to identify a negative number.
voidsetPageSize(int paperFormat)
Changes the preferred page size when printing.
voidsetPositiveMonetarySignPosition(int signpos)
Changes the sign position used for positive monetary values.
voidsetPositivePrefixCurrencySymbol(boolean prefix)
Changes the position where the currency symbol should be printed for positive monetary values.
voidsetPositiveSign(String sign)
Changes the sign used to identify a positive number.
voidsetThousandsSeparator(String separator)
Changes the separator used to group digits when formating numbers.
voidsetTimeFormat(String format)
Changes the current time format.
voidsetWeekStartDay(int day)
Changes how KLocale defines the first day in week.
static voidsplitLocale(String str, StringBuffer language, StringBuffer country, StringBuffer charset)
Returns the parts of the parameter str understood as language setting the format is language_COUNTRY.charset
StringthousandsSeparator()
Returns what the thousands separator should look like ("," or "." etc.) according to the current locale or user settings.
StringtimeFormat()
Returns the currently selected time format.
Stringtranslate(String index)
Translates the string into the corresponding string in the national language, if available.
Stringtranslate(String comment, String fallback)
Translates the string into the corresponding string in the national language, if available.
Stringtranslate(String singular, String plural, long n)
Used to get the correct, translated singular or plural of a word.
StringtranslateQt(String context, String sourceText, String message)
Translates a message as a QTranslator is supposed to.
StringtwoAlphaToCountryName(String code)
Convert a country code to a human readable form.
StringtwoAlphaToLanguageName(String code)
Convert a ISO 639-1 code to a human readable form.
booleanuse12Clock()
Use this to determine if the user wants a 12 hour clock.
intweekStartDay()
Use this to determine which day is the first day of the week.
static String_initLanguage(KConfigBase config)

Field Detail

AfterMoney

public static final int AfterMoney

AfterQuantityMoney

public static final int AfterQuantityMoney

BeforeMoney

public static final int BeforeMoney

BeforeQuantityMoney

public static final int BeforeQuantityMoney

Imperial

public static final int Imperial

Metric

public static final int Metric
The Metric system will give you information in mm, while the Imperial system will give you information in inches.

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

NormalFormat

public static final int NormalFormat

ParensAround

public static final int ParensAround
Various positions for where to place the positive or negative sign when they are related to a monetary value.

UNKNOWN: Various positions for where to place the positive or negative sign when they are related to a monetary value.

ShortFormat

public static final int ShortFormat

WithoutSeconds

public static final int WithoutSeconds

WithSeconds

public static final int WithSeconds

Constructor Detail

KLocale

protected KLocale(Class dummy)

KLocale

public KLocale(String catalog, KConfig config)
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.

UNKNOWN: Constructs a KLocale with the given catalog name.

KLocale

public KLocale(String catalog)

KLocale

public KLocale(KLocale rhs)
Copy constructor.

UNKNOWN: Copy constructor.

Method Detail

allCountriesTwoAlpha

public ArrayList allCountriesTwoAlpha()
Returns list of all known country codes.

Returns: a list of all country codes

UNKNOWN: Returns list of all known country codes.

allLanguagesTwoAlpha

public ArrayList allLanguagesTwoAlpha()
Returns list of all known ISO 639-1 codes.

Returns: a list of all language codes

UNKNOWN: Returns list of all known ISO 639-1 codes.

calendar

public KCalendarSystem calendar()
Returns a pointer to the calendar system object.

Returns: the current calendar system instance

UNKNOWN: Returns a pointer to the calendar system object.

calendarType

public String calendarType()
Returns the name of the calendar system that is currently being used by the system.

Returns: the name of the calendar system

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

codecForEncoding

public QTextCodec codecForEncoding()
Returns the user's preferred encoding. Should never be NULL.

Returns: The codec for the preferred encoding

See Also: KLocale KLocale

UNKNOWN: Returns the user's preferred encoding.

country

public String country()
Returns the country code of the country where the user lives. defaultCountry() is returned by default, if no other available.

Returns: The country code for the user.

UNKNOWN: Returns the country code of the country where the user lives.

currencySymbol

public String currencySymbol()
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.

UNKNOWN: Returns what the symbol denoting currency in the current locale as as defined by user settings should look like.

dateFormat

public String dateFormat()
Returns the currently selected date format.

Returns: Current date format.

See Also: KLocale

UNKNOWN: Returns the currently selected date format.

dateFormatShort

public String dateFormatShort()
Returns the currently selected short date format.

Returns: Current short date format.

See Also: KLocale

UNKNOWN: Returns the currently selected short date format.

dateMonthNamePossessive

public boolean dateMonthNamePossessive()
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

UNKNOWN: Use this to determine whether in dates a possessive form of month name is preferred ("of January" rather than "January")

decimalSymbol

public String decimalSymbol()
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.

UNKNOWN: Returns what a decimal point should look like (".

defaultCountry

public static String defaultCountry()
Returns the name of the default country.

Returns: Name of the default country

UNKNOWN: Returns the name of the default country.

defaultLanguage

public static String defaultLanguage()
Returns the name of the internal language.

Returns: Name of the default language

UNKNOWN: Returns the name of the internal language.

dispose

public void dispose()
Delete the wrapped C++ instance ahead of finalize()

encoding

public String encoding()
Returns the user's preferred encoding.

Returns: The name of the preferred encoding

See Also: KLocale KLocale

UNKNOWN: Returns the user's preferred encoding.

encodingMib

public int encodingMib()
Returns the user's preferred encoding.

Returns: The Mib of the preferred encoding

See Also: KLocale KLocale

UNKNOWN: Returns the user's preferred encoding.

fileEncodingMib

public int fileEncodingMib()
Returns the file encoding.

Returns: The Mib of the file encoding

See Also: org.kde.qt.QFile#encodeName org.kde.qt.QFile#decodeName

UNKNOWN: Returns the file encoding.

finalize

protected void finalize()
Deletes the wrapped C++ instance

formatDate

public String formatDate(Calendar pDate, boolean shortFormat)
Returns a string formatted to the current locale's conventions regarding dates.

Parameters: pDate The date to be formated. shortFormat True for non text dates.

Returns: The date as a string

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

formatDate

public String formatDate(Calendar pDate)

formatDateTime

public String formatDateTime(Calendar pDateTime, boolean shortFormat, boolean includeSecs)
Returns a string formated to the current locale's conventions regarding both date and time.

Parameters: pDateTime The date and time to be formated. shortFormat using the short date format. includeSecs using the short date format.

Returns: The date and time as a string

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

formatDateTime

public String formatDateTime(Calendar pDateTime, boolean shortFormat)

formatDateTime

public String formatDateTime(Calendar pDateTime)

formatLong

public String formatLong(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

UNKNOWN: Given an integer, converts that to a numeric string containing the localized numeric equivalent.

formatMoney

public String formatMoney(double num, String currency, int digits)
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: KLocale

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

formatMoney

public String formatMoney(double num, String currency)

formatMoney

public String formatMoney(double num)

formatNumber

public String formatNumber(double num, int precision)
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: (const KLocale )

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

formatNumber

public String formatNumber(double num)

formatNumber

public String formatNumber(String numStr, boolean round, int precision)
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 convert round Round fractional digits. precision Number of fractional digits used.

Returns: The number as a localized string

UNKNOWN: Given a string representing a number, converts that to a numeric string containing the localized numeric equivalent.

formatTime

public String formatTime(Date pTime, boolean includeSecs, boolean isDuration)
Returns 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. 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

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

formatTime

public String formatTime(Date pTime, boolean includeSecs)
Returns 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

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

formatTime

public String formatTime(Date pTime)

fracDigits

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

Returns: Default number of fractional digits used by locale.

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

initInstance

protected static void initInstance()
pointer.

UNKNOWN:

insertCatalogue

public void insertCatalogue(String 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.

UNKNOWN: Adds another catalog to search for translation lookup.

isDisposed

public boolean isDisposed()
Has the wrapped C++ instance been deleted?

langLookup

public static String langLookup(String fname, String rtype)
Finds localized resource in resourceDir( rtype ) + \ + fname.

Parameters: fname relative path to find rtype resource type to use

UNKNOWN: Finds localized resource in resourceDir( rtype ) + \ + fname.

langLookup

public static String langLookup(String fname)

language

public String language()
Returns the language 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.

Returns: The currently used language.

UNKNOWN: Returns the language used by this object.

languageList

public ArrayList languageList()
Returns the languages selected by user. The codes returned here is the internal language codes.

Returns: List of language codes

See Also: KLocale

UNKNOWN: Returns the languages selected by user.

languagesTwoAlpha

public ArrayList languagesTwoAlpha()
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, nb, pt".

Returns: List of language codes

See Also: KLocale

UNKNOWN: Returns the preferred languages as ISO 639-1 codes.

measureSystem

public int measureSystem()
Returns which measuring system we use.

Returns: The preferred measuring system

UNKNOWN: Returns which measuring system we use.

monetaryDecimalSymbol

public String monetaryDecimalSymbol()
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.

UNKNOWN: Returns what a decimal point should look like (".

monetaryThousandsSeparator

public String monetaryThousandsSeparator()
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.

UNKNOWN: Returns what a thousands separator for monetary values should look like ("," or " " etc.

negativeMonetarySignPosition

public int negativeMonetarySignPosition()
Denotes where to place a negative sign in relation to a monetary value.

Returns: Where/how to print the negative sign.

See Also: SignPosition

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

negativePrefixCurrencySymbol

public boolean negativePrefixCurrencySymbol()
If and only if the currency symbol precedes a negative value, this will be true.

Returns: True if the currency symbol precedes negative numbers.

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

negativeSign

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

Returns: The negative sign used by locale.

UNKNOWN: Returns what a negative sign should look like ("-", etc.

nounDeclension

public boolean nounDeclension()
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

UNKNOWN: Use this to determine whether nouns are declined in locale's language.

pageSize

public int pageSize()
Returns the preferred page size for printing.

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

UNKNOWN: Returns the preferred page size for printing.

positiveMonetarySignPosition

public int positiveMonetarySignPosition()
Returns the position of a positive sign in relation to a monetary value.

Returns: Where/how to print the positive sign.

See Also: SignPosition

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

positivePrefixCurrencySymbol

public boolean positivePrefixCurrencySymbol()
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.

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

positiveSign

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

Returns: The positive sign used by locale.

UNKNOWN: Returns what a positive sign should look like ("+", " ", etc.

readDate

public Calendar readDate(String str, boolean[] ok)
Converts a localized date string to a Calendar. The boolean pointed by ok will be invalid if the date entered was not valid.

Parameters: str the string we want to convert. ok the booleanean 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

UNKNOWN: Converts a localized date string to a QDate.

readDate

public Calendar readDate(String str)

readDate

public Calendar readDate(String intstr, String fmt, boolean[] ok)
Converts a localized date string to a Calendar, using the specified format. You will usually not want to use this method.

UNKNOWN: Converts a localized date string to a QDate, using the specified format.

readDate

public Calendar readDate(String intstr, String fmt)

readDate

public Calendar readDate(String str, int flags, boolean[] ok)
Converts a localized date string to a Calendar. 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 booleanean 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

UNKNOWN: Converts a localized date string to a QDate.

readDate

public Calendar readDate(String str, int flags)

readMoney

public double readMoney(String numStr, boolean[] ok)
Converts a localized monetary string to a double.

Parameters: numStr the string we want to convert. ok the booleanean 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

UNKNOWN: Converts a localized monetary string to a double.

readMoney

public double readMoney(String numStr)

readNumber

public double readNumber(String numStr, boolean[] ok)
Converts a localized numeric string to a double.

Parameters: numStr the string we want to convert. ok the booleanean 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

UNKNOWN: Converts a localized numeric string to a double.

readNumber

public double readNumber(String numStr)

readTime

public Date readTime(String str, boolean[] ok)
Converts a localized time string to a Date This method will try to parse it with seconds, then without seconds. The boolean 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 booleanean 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

UNKNOWN: Converts a localized time string to a QTime.

readTime

public Date readTime(String str)

readTime

public Date readTime(String str, int flags, boolean[] ok)
Converts a localized time string to a Date 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 booleanean 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

UNKNOWN: Converts a localized time string to a QTime.

readTime

public Date readTime(String str, int flags)

removeCatalogue

public void removeCatalogue(String catalog)
Removes a catalog for translation lookup.

Parameters: catalog The catalog to remove.

See Also: KLocale

UNKNOWN: Removes a catalog for translation lookup.

setActiveCatalogue

public void setActiveCatalogue(String catalog)
Sets the active catalog for translation lookup.

Parameters: catalog The catalog to activate.

UNKNOWN: Sets the active catalog for translation lookup.

setCalendar

public void setCalendar(String 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

UNKNOWN: Changes the current calendar system to the calendar specified.

setCountry

public boolean setCountry(String country)
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.

UNKNOWN: Changes the current country.

setCurrencySymbol

public void setCurrencySymbol(String symbol)
Changes the current currency symbol.

Parameters: symbol The new currency symbol

UNKNOWN: Changes the current currency symbol.

setDateFormat

public void setDateFormat(String format)
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".
  • Parameters: format The new date format

    UNKNOWN: Changes the current date format.

    setDateFormatShort

    public void setDateFormatShort(String format)
    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".
  • Parameters: format The new short date format

    UNKNOWN: Changes the current short date format.

    setDateMonthNamePossessive

    public void setDateMonthNamePossessive(boolean possessive)
    Changes the form of month name used in dates.

    Parameters: possessive True if possessive forms should be used

    UNKNOWN: Changes the form of month name used in dates.

    setDecimalSymbol

    public void setDecimalSymbol(String symbol)
    Changes the symbol used to identify the decimal pointer.

    Parameters: symbol The new decimal symbol.

    UNKNOWN: Changes the symbol used to identify the decimal pointer.

    setEncoding

    public boolean setEncoding(int mibEnum)
    Changes the current encoding.

    Parameters: mibEnum The mib of the preferred codec

    Returns: True on success.

    UNKNOWN: Changes the current encoding.

    setFracDigits

    public void setFracDigits(int digits)
    Changes the number of digits used when formating numbers.

    Parameters: digits The default number of digits to use.

    UNKNOWN: Changes the number of digits used when formating numbers.

    setLanguage

    public boolean setLanguage(String language)
    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.

    UNKNOWN: Changes the current language.

    setLanguage

    public boolean setLanguage(String[] languages)
    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.

    Parameters: languages The list of language codes.

    Returns: True if one of the specified languages were used.

    UNKNOWN: Changes the list of prefed languages for the locale.

    setMainCatalogue

    public static void setMainCatalogue(String 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 Catalogue to override all other main catalogues.

    UNKNOWN: Use this as main catalog for all KLocales, if not the appname will be used.

    setMeasureSystem

    public void setMeasureSystem(int value)
    Changes the preferred measuring system.

    Returns: value The preferred measuring system

    UNKNOWN: Changes the preferred measuring system.

    setMonetaryDecimalSymbol

    public void setMonetaryDecimalSymbol(String symbol)
    Changes the symbol used to identify the decimal pointer for monetary values.

    Parameters: symbol The new decimal symbol.

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

    setMonetaryThousandsSeparator

    public void setMonetaryThousandsSeparator(String separator)
    Changes the separator used to group digits when formating monetary values.

    Parameters: separator The new thousands separator.

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

    setNegativeMonetarySignPosition

    public void setNegativeMonetarySignPosition(int signpos)
    Changes the sign position used for negative monetary values.

    Parameters: signpos The new sign position

    UNKNOWN: Changes the sign position used for negative monetary values.

    setNegativePrefixCurrencySymbol

    public void setNegativePrefixCurrencySymbol(boolean 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

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

    setNegativeSign

    public void setNegativeSign(String sign)
    Changes the sign used to identify a negative number.

    Parameters: sign Sign used for negative numbers.

    UNKNOWN: Changes the sign used to identify a negative number.

    setPageSize

    public void setPageSize(int paperFormat)
    Changes the preferred page size when printing.

    Parameters: paperFormat the new preferred page size in the format QPrinter.PageSize

    UNKNOWN: Changes the preferred page size when printing.

    setPositiveMonetarySignPosition

    public void setPositiveMonetarySignPosition(int signpos)
    Changes the sign position used for positive monetary values.

    Parameters: signpos The new sign position

    UNKNOWN: Changes the sign position used for positive monetary values.

    setPositivePrefixCurrencySymbol

    public void setPositivePrefixCurrencySymbol(boolean 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

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

    setPositiveSign

    public void setPositiveSign(String sign)
    Changes the sign used to identify a positive number. Normally this is left blank.

    Parameters: sign Sign used for positive numbers.

    UNKNOWN: Changes the sign used to identify a positive number.

    setThousandsSeparator

    public void setThousandsSeparator(String separator)
    Changes the separator used to group digits when formating numbers.

    Parameters: separator The new thousands separator.

    UNKNOWN: Changes the separator used to group digits when formating numbers.

    setTimeFormat

    public void setTimeFormat(String format)
    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".
  • Parameters: format The new time format

    UNKNOWN: Changes the current time format.

    setWeekStartDay

    public void setWeekStartDay(int day)
    Changes how KLocale defines the first day in week.

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

    UNKNOWN: Changes how KLocale defines the first day in week.

    splitLocale

    public static void splitLocale(String str, StringBuffer language, StringBuffer country, StringBuffer charset)
    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 string.

    UNKNOWN: Returns the parts of the parameter str understood as language setting the format is language_COUNTRY.

    thousandsSeparator

    public String thousandsSeparator()
    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.

    UNKNOWN: Returns what the thousands separator should look like ("," or ".

    timeFormat

    public String timeFormat()
    Returns the currently selected time format.

    Returns: Current time format.

    See Also: KLocale

    UNKNOWN: Returns the currently selected time format.

    translate

    public String translate(String index)
    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 catalog 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)

    Parameters: index The lookup text and default text, if not found.

    UNKNOWN: Translates the string into the corresponding string in the national language, if available.

    translate

    public String translate(String comment, String fallback)
    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()

    Parameters: comment the comment. The lookup text is made out of comment + fallback fallback the default text, if not found

    Returns: translation

    UNKNOWN: Translates the string into the corresponding string in the national language, if available.

    translate

    public String translate(String singular, String plural, long n)
    Used to get the correct, translated singular or plural of a word.

    Parameters: singular the singular form of the word, for example "file". plural the plural form of the word. Must contain a "%n" that will be replaced by the number n, for example "%n files" n the number

    Returns: the correct singular or plural for the selected language, depending on n

    UNKNOWN: Used to get the correct, translated singular or plural of a word.

    translateQt

    public String translateQt(String context, String sourceText, String message)
    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 null)

    UNKNOWN: Translates a message as a QTranslator is supposed to.

    twoAlphaToCountryName

    public String twoAlphaToCountryName(String code)
    Convert a country code to a human readable form.

    Parameters: code the country code

    Returns: the human readable form of the country name

    UNKNOWN: Convert a country code to a human readable form.

    twoAlphaToLanguageName

    public String twoAlphaToLanguageName(String code)
    Convert a ISO 639-1 code to a human readable form.

    Parameters: code the language ISO 639-1 code

    Returns: the human readable form

    UNKNOWN: Convert a ISO 639-1 code to a human readable form.

    use12Clock

    public boolean use12Clock()
    Use this to determine if the user wants a 12 hour clock.

    Returns: If the user wants 12h clock

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

    weekStartDay

    public int weekStartDay()
    Use this to determine which day is the first day of the week.

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

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

    _initLanguage

    public static String _initLanguage(KConfigBase config)

    UNKNOWN: