org.kde.koala
public class KLocale extends Object implements QtSupport
UNKNOWN: class for supporting locale settings and national language.
Field Summary | |
---|---|
static int | AfterMoney |
static int | AfterQuantityMoney |
static int | BeforeMoney |
static int | BeforeQuantityMoney |
static int | Imperial |
static int | Metric
The Metric system will give you information in mm, while the
Imperial system will give you information in inches. |
static int | NormalFormat |
static int | ParensAround
Various positions for where to place the positive or negative
sign when they are related to a monetary value. |
static int | ShortFormat |
static int | WithoutSeconds |
static int | WithSeconds |
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 | |
---|---|
ArrayList | allCountriesTwoAlpha()
Returns list of all known country codes. |
ArrayList | allLanguagesTwoAlpha()
Returns list of all known ISO 639-1 codes. |
KCalendarSystem | calendar()
Returns a pointer to the calendar system object. |
String | calendarType()
Returns the name of the calendar system that is currently being
used by the system. |
QTextCodec | codecForEncoding()
Returns the user's preferred encoding. |
String | country()
Returns the country code of the country where the user lives.
defaultCountry() is returned by default, if no other available. |
String | currencySymbol()
Returns what the symbol denoting currency in the current locale
as as defined by user settings should look like. |
String | dateFormat()
Returns the currently selected date format. |
String | dateFormatShort()
Returns the currently selected short date format. |
boolean | dateMonthNamePossessive()
Use this to determine whether in dates a possessive form of month
name is preferred ("of January" rather than "January") |
String | decimalSymbol()
Returns what a decimal point should look like ("." or "," etc.)
according to the current locale or user settings. |
static String | defaultCountry()
Returns the name of the default country. |
static String | defaultLanguage()
Returns the name of the internal language. |
void | dispose() Delete the wrapped C++ instance ahead of finalize() |
String | encoding()
Returns the user's preferred encoding. |
int | encodingMib()
Returns the user's preferred encoding. |
int | fileEncodingMib()
Returns the file encoding. |
protected void | finalize() Deletes the wrapped C++ instance |
String | formatDate(Calendar pDate, boolean shortFormat)
Returns a string formatted to the current locale's conventions
regarding dates. |
String | formatDate(Calendar pDate) |
String | formatDateTime(Calendar pDateTime, boolean shortFormat, boolean includeSecs)
Returns a string formated to the current locale's conventions
regarding both date and time. |
String | formatDateTime(Calendar pDateTime, boolean shortFormat) |
String | formatDateTime(Calendar pDateTime) |
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). |
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". |
String | formatMoney(double num, String currency) |
String | formatMoney(double num) |
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).
|
String | formatNumber(double num) |
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). |
String | formatTime(Date pTime, boolean includeSecs, boolean isDuration)
Returns a string formatted to the current locale's conventions
regarding times. |
String | formatTime(Date pTime, boolean includeSecs)
Returns a string formatted to the current locale's conventions
regarding times. |
String | formatTime(Date pTime) |
int | fracDigits()
The number of fractional digits to include in numeric/monetary
values (usually 2). |
protected static void | initInstance()
pointer. |
void | insertCatalogue(String catalog)
Adds another catalog to search for translation lookup.
|
boolean | isDisposed() Has the wrapped C++ instance been deleted? |
static String | langLookup(String fname, String rtype)
Finds localized resource in resourceDir( rtype ) + \ |
static String | langLookup(String fname) |
String | language()
Returns the language used by this object. |
ArrayList | languageList()
Returns the languages selected by user. |
ArrayList | languagesTwoAlpha()
Returns the preferred languages as ISO 639-1 codes. |
int | measureSystem()
Returns which measuring system we use. |
String | monetaryDecimalSymbol()
Returns what a decimal point should look like ("." or "," etc.)
for monetary values, according to the current locale or user
settings. |
String | monetaryThousandsSeparator()
Returns what a thousands separator for monetary values should
look like ("," or " " etc.) according to the current locale or
user settings. |
int | negativeMonetarySignPosition()
Denotes where to place a negative sign in relation to a
monetary value. |
boolean | negativePrefixCurrencySymbol()
If and only if the currency symbol precedes a negative value,
this will be true. |
String | negativeSign()
Returns what a negative sign should look like ("-", etc.)
according to the current locale or user settings. |
boolean | nounDeclension()
Use this to determine whether nouns are declined in
locale's language. |
int | pageSize()
Returns the preferred page size for printing. |
int | positiveMonetarySignPosition()
Returns the position of a positive sign in relation to a
monetary value. |
boolean | positivePrefixCurrencySymbol()
If and only if the currency symbol precedes a positive value,
this will be true. |
String | positiveSign()
Returns what a positive sign should look like ("+", " ", etc.)
according to the current locale or user settings. |
Calendar | readDate(String str, boolean[] ok)
Converts a localized date string to a Calendar.
|
Calendar | readDate(String str) |
Calendar | readDate(String intstr, String fmt, boolean[] ok)
Converts a localized date string to a Calendar, using the specified format.
|
Calendar | readDate(String intstr, String fmt) |
Calendar | readDate(String str, int flags, boolean[] ok)
Converts a localized date string to a Calendar.
|
Calendar | readDate(String str, int flags) |
double | readMoney(String numStr, boolean[] ok)
Converts a localized monetary string to a double. |
double | readMoney(String numStr) |
double | readNumber(String numStr, boolean[] ok)
Converts a localized numeric string to a double. |
double | readNumber(String numStr) |
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.
|
Date | readTime(String str) |
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.
|
Date | readTime(String str, int flags) |
void | removeCatalogue(String catalog)
Removes a catalog for translation lookup. |
void | setActiveCatalogue(String catalog)
Sets the active catalog for translation lookup. |
void | setCalendar(String calendarType)
Changes the current calendar system to the calendar specified.
|
boolean | setCountry(String country)
Changes the current country. |
void | setCurrencySymbol(String symbol)
Changes the current currency symbol. |
void | setDateFormat(String format)
Changes the current date format.
|
void | setDateFormatShort(String format)
Changes the current short date format.
|
void | setDateMonthNamePossessive(boolean possessive)
Changes the form of month name used in dates. |
void | setDecimalSymbol(String symbol)
Changes the symbol used to identify the decimal pointer. |
boolean | setEncoding(int mibEnum)
Changes the current encoding. |
void | setFracDigits(int digits)
Changes the number of digits used when formating numbers. |
boolean | setLanguage(String language)
Changes the current language. |
boolean | setLanguage(String[] languages)
Changes the list of prefed languages for the locale. |
static void | setMainCatalogue(String catalog)
Use this as main catalog for all KLocales, if not the appname
will be used. |
void | setMeasureSystem(int value)
Changes the preferred measuring system. |
void | setMonetaryDecimalSymbol(String symbol)
Changes the symbol used to identify the decimal pointer for monetary
values. |
void | setMonetaryThousandsSeparator(String separator)
Changes the separator used to group digits when formating monetary values. |
void | setNegativeMonetarySignPosition(int signpos)
Changes the sign position used for negative monetary values. |
void | setNegativePrefixCurrencySymbol(boolean prefix)
Changes the position where the currency symbol should be printed for
negative monetary values. |
void | setNegativeSign(String sign)
Changes the sign used to identify a negative number. |
void | setPageSize(int paperFormat)
Changes the preferred page size when printing. |
void | setPositiveMonetarySignPosition(int signpos)
Changes the sign position used for positive monetary values. |
void | setPositivePrefixCurrencySymbol(boolean prefix)
Changes the position where the currency symbol should be printed for
positive monetary values. |
void | setPositiveSign(String sign)
Changes the sign used to identify a positive number. |
void | setThousandsSeparator(String separator)
Changes the separator used to group digits when formating numbers. |
void | setTimeFormat(String format)
Changes the current time format.
|
void | setWeekStartDay(int day)
Changes how KLocale defines the first day in week. |
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 |
String | thousandsSeparator()
Returns what the thousands separator should look
like ("," or "." etc.)
according to the current locale or user settings. |
String | timeFormat()
Returns the currently selected time format. |
String | translate(String index)
Translates the string into the corresponding string in
the national language, if available. |
String | translate(String comment, String fallback)
Translates the string into the corresponding string in the
national language, if available.
|
String | translate(String singular, String plural, long n)
Used to get the correct, translated singular or plural of a
word. |
String | translateQt(String context, String sourceText, String message)
Translates a message as a QTranslator is supposed to.
|
String | twoAlphaToCountryName(String code)
Convert a country code to a human readable form. |
String | twoAlphaToLanguageName(String code)
Convert a ISO 639-1 code to a human readable form. |
boolean | use12Clock()
Use this to determine if the user wants a 12 hour clock. |
int | weekStartDay()
Use this to determine which day is the first day of the week. |
static String | _initLanguage(KConfigBase config) |
UNKNOWN: The Metric system will give you information in mm, while the Imperial system will give you information in inches.
UNKNOWN: Various positions for where to place the positive or negative sign when they are related to a monetary value.
Parameters: catalog The name of the main language file config The configuration file to use.
UNKNOWN: Constructs a KLocale with the given catalog name.
UNKNOWN: Copy constructor.
Returns: a list of all country codes
UNKNOWN: Returns list of all known country codes.
Returns: a list of all language codes
UNKNOWN: Returns list of all known ISO 639-1 codes.
Returns: the current calendar system instance
UNKNOWN: Returns a pointer to the calendar system object.
Returns: the name of the calendar system
UNKNOWN: Returns the name of the calendar system that is currently being used by the system.
Returns: The codec for the preferred encoding
UNKNOWN: Returns the user's preferred encoding.
Returns: The country code for the user.
UNKNOWN: Returns the country code of the country where the user lives.
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.
Returns: Current date format.
See Also: KLocale
UNKNOWN: Returns the currently selected date format.
Returns: Current short date format.
See Also: KLocale
UNKNOWN: Returns the currently selected short date format.
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")
Returns: The decimal symbol used by locale.
UNKNOWN: Returns what a decimal point should look like (".
Returns: Name of the default country
UNKNOWN: Returns the name of the default country.
Returns: Name of the default language
UNKNOWN: Returns the name of the internal language.
Returns: The name of the preferred encoding
UNKNOWN: Returns the user's preferred encoding.
Returns: The Mib of the preferred encoding
UNKNOWN: Returns the user's preferred 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.
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.
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.
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.
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.
Parameters: num The number to convert precision Number of fractional digits used.
Returns: The number as a localized string
UNKNOWN: Given a double, converts that to a numeric string containing the localized numeric equivalent.
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.
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.
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.
Returns: Default number of fractional digits used by locale.
UNKNOWN: The number of fractional digits to include in numeric/monetary values (usually 2).
UNKNOWN:
Parameters: catalog The catalog to add.
UNKNOWN: Adds another catalog to search for translation lookup.
Parameters: fname relative path to find rtype resource type to use
UNKNOWN: Finds localized resource in resourceDir( rtype ) + \
Returns: The currently used language.
UNKNOWN: Returns the language used by this object.
Returns: List of language codes
See Also: KLocale
UNKNOWN: Returns the languages selected by user.
Returns: List of language codes
See Also: KLocale
UNKNOWN: Returns the preferred languages as ISO 639-1 codes.
Returns: The preferred measuring system
UNKNOWN: Returns which measuring system we use.
Returns: The monetary decimal symbol used by locale.
UNKNOWN: Returns what a decimal point should look like (".
Returns: The monetary thousands separator used by locale.
UNKNOWN: Returns what a thousands separator for monetary values should look like ("," or " " etc.
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.
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.
Returns: The negative sign used by locale.
UNKNOWN: Returns what a negative sign should look like ("-", etc.
Returns: If nouns are declined
UNKNOWN: Use this to determine whether nouns are declined in locale's language.
Returns: The preferred page size, cast it to QPrinter.PageSize
UNKNOWN: Returns the preferred page size for printing.
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.
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.
Returns: The positive sign used by locale.
UNKNOWN: Returns what a positive sign should look like ("+", " ", etc.
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.
UNKNOWN: Converts a localized date string to a QDate, using the specified format.
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.
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.
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.
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.
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.
Parameters: catalog The catalog to remove.
See Also: KLocale
UNKNOWN: Removes a catalog for translation lookup.
Parameters: catalog The catalog to activate.
UNKNOWN: Sets the active catalog for translation lookup.
Parameters: calendarType the name of the calendar type
UNKNOWN: Changes the current calendar system to the calendar specified.
Parameters: country The ISO 3166 country code.
Returns: True on success.
UNKNOWN: Changes the current country.
Parameters: symbol The new currency symbol
UNKNOWN: Changes the current currency symbol.
Parameters: format The new date format
UNKNOWN: Changes the current date format.
Parameters: format The new short date format
UNKNOWN: Changes the current short date format.
Parameters: possessive True if possessive forms should be used
UNKNOWN: Changes the form of month name used in dates.
Parameters: symbol The new decimal symbol.
UNKNOWN: Changes the symbol used to identify the decimal pointer.
Parameters: mibEnum The mib of the preferred codec
Returns: True on success.
UNKNOWN: Changes the current encoding.
Parameters: digits The default number of digits to use.
UNKNOWN: Changes the number of digits used when formating numbers.
Parameters: language The language code.
Returns: True on success.
UNKNOWN: Changes the current language.
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.
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.
Returns: value The preferred measuring system
UNKNOWN: Changes the preferred measuring system.
Parameters: symbol The new decimal symbol.
UNKNOWN: Changes the symbol used to identify the decimal pointer for monetary values.
Parameters: separator The new thousands separator.
UNKNOWN: Changes the separator used to group digits when formating monetary values.
Parameters: signpos The new sign position
UNKNOWN: Changes the sign position used 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.
Parameters: sign Sign used for negative numbers.
UNKNOWN: Changes the sign used to identify a negative number.
Parameters: paperFormat the new preferred page size in the format QPrinter.PageSize
UNKNOWN: Changes the preferred page size when printing.
Parameters: signpos The new sign position
UNKNOWN: Changes the sign position used 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.
Parameters: sign Sign used for positive numbers.
UNKNOWN: Changes the sign used to identify a positive number.
Parameters: separator The new thousands separator.
UNKNOWN: Changes the separator used to group digits when formating numbers.
Parameters: format The new time format
UNKNOWN: Changes the current time format.
Parameters: day first day of the week (Monday=1..Sunday=7) as integer
UNKNOWN: Changes how KLocale defines the first day in week.
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.
Returns: The thousands separator used by locale.
UNKNOWN: Returns what the thousands separator should look like ("," or ".
Returns: Current time format.
See Also: KLocale
UNKNOWN: Returns the currently selected time format.
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.
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.
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.
UNKNOWN: Translates a message as a QTranslator is supposed to.
Parameters: code the country code
Returns: the human readable form of the country name
UNKNOWN: Convert a country 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.
Returns: If the user wants 12h clock
UNKNOWN: Use this to determine if the user wants a 12 hour clock.
Returns: an integer (Monday=1..Sunday=7)
UNKNOWN: Use this to determine which day is the first day of the week.
UNKNOWN: