KDECore
klocale.cpp
Go to the documentation of this file.
59 KLocale::KLocale(const QString& catalog, const QString &language, const QString &country, KConfig *config)
105 void KLocale::splitLocale(const QString &locale, QString &language, QString &country, QString &modifier,
151 void KLocale::translateRawFrom(const char *catname, const char *ctxt, const char *singular, const char *plural,
158 void KLocale::translateRawFrom(const char *catname, const char *msg, QString *lang, QString *trans) const
168 void KLocale::translateRawFrom(const char *catname, const char *ctxt, const char *msg, QString *lang,
174 void KLocale::translateRaw(const char *ctxt, const char *msg, QString *lang, QString *trans) const
185 void KLocale::translateRaw(const char *singular, const char *plural, unsigned long n, QString *lang,
197 QString KLocale::translateQt(const char *context, const char *sourceText, const char *comment) const
450 QString KLocalePrivate::formatDateTime(const KLocale *locale, const QDateTime &dateTime, KLocale::DateFormat format,
456 QString KLocale::formatDateTime(const QDateTime &dateTime, KLocale::DateFormat format, bool includeSeconds) const
461 QString KLocale::formatDateTime(const KDateTime &dateTime, KLocale::DateFormat format, DateTimeFormatOptions options) const
QString periodName(KLocale::DateTimeComponentFormat format=KLocale::ShortName) const
Return translated Period Name in the required format e.g.
Definition: kdayperiod.cpp:138
QString dayPeriodText(const QTime &time, DateTimeComponentFormat format=DefaultComponentFormat) const
Definition: klocale.cpp:434
virtual void setPositiveMonetarySignPosition(KLocale::SignPosition signpos)
Definition: klocale_kde.cpp:2962
void setNegativeSign(const QString &sign)
Changes the sign used to identify a negative number.
Definition: klocale.cpp:545
void setDateFormat(const QString &format)
Changes the current date format.
Definition: klocale.cpp:470
void setDateFormatShort(const QString &format)
Changes the current short date format.
Definition: klocale.cpp:475
virtual QString prettyFormatDuration(unsigned long mSec) const
Definition: klocale_kde.cpp:1810
void setMeasureSystem(MeasureSystem value)
Changes the preferred measuring system.
Definition: klocale.cpp:610
virtual QString formatNumber(double num, int precision=-1) const
Definition: klocale_kde.cpp:1456
static void setMainCatalog(const char *catalog)
Use this as main catalog for all KLocales, if not the appname will be used.
Definition: klocale.cpp:373
QString localizedFilePath(const QString &filePath) const
Definition: klocale.cpp:744
virtual QString thousandsSeparator() const
Definition: klocale_kde.cpp:1222
Date/times with associated time zone.
bool positivePrefixCurrencySymbol() const
If and only if the currency symbol precedes a positive value, this will be true.
Definition: klocale.cpp:297
virtual void setDateTimeDigitSet(KLocale::DigitSet digitSet)
Definition: klocale_kde.cpp:3307
virtual double readNumber(const QString &numStr, bool *ok=0) const
Definition: klocale_kde.cpp:1863
static QString langLookup(const QString &fname, const char *rtype="html")
Definition: klocale.cpp:466
QString prettyFormatDuration(unsigned long mSec) const
Given a number of milliseconds, converts that to a pretty string containing the localized equivalent...
Definition: klocale.cpp:363
virtual void setWorkingWeekStartDay(int day)
Definition: klocale_kde.cpp:2895
virtual void setDateMonthNamePossessive(bool possessive)
Definition: klocale_kde.cpp:2878
void setThousandsSeparator(const QString &separator)
Changes the separator used to group digits when formating numbers.
Definition: klocale.cpp:535
bool use12Clock() const
Use this to determine if the user wants a 12 hour clock.
Definition: klocale.cpp:429
virtual bool dateMonthNamePossessive() const
Definition: klocale_kde.cpp:1187
const QByteArray encoding() const
Returns the user's preferred encoding.
Definition: klocale.cpp:635
QString digitSetToName(DigitSet digitSet, bool withDigits=false) const
Definition: klocale.cpp:207
virtual QString monetaryThousandsSeparator() const
Definition: klocale_kde.cpp:1242
virtual int workingWeekEndDay() const
Definition: klocale_kde.cpp:1202
virtual KLocale::DigitSet monetaryDigitSet() const
Definition: klocale_kde.cpp:3302
virtual KLocale::MeasureSystem measureSystem() const
Definition: klocale_kde.cpp:3019
QString countryDivisionCode() const
Definition: klocale_kde.cpp:790
MeasureSystem
The Metric system will give you information in mm, while the Imperial system will give you informatio...
Definition: klocale.h:1780
virtual QString monetaryDecimalSymbol() const
Definition: klocale_kde.cpp:1237
bool setCountryDivisionCode(const QString &countryDivision)
Definition: klocale_kde.cpp:629
KLocale(const QString &catalog, KSharedConfig::Ptr config=KSharedConfig::Ptr())
Constructs a KLocale with the given catalog name.
Definition: klocale.cpp:48
void removeCatalog(const QString &catalog)
Removes a catalog for translation lookup.
Definition: klocale.cpp:141
QString formatLong(long num) const
Given an integer, converts that to a numeric string containing the localized numeric equivalent...
Definition: klocale.cpp:327
QString formatLocaleTime(const QTime &pTime, TimeFormatOptions options=KLocale::TimeDefault) const
Definition: klocale.cpp:424
virtual QString localizedFilePath(const QString &filePath) const
Definition: klocale_kde.cpp:3249
static void splitLocale(const QString &locale, QString &language, QString &country, QString &modifier, QString &charset)
Definition: klocale_kde.cpp:742
virtual QList< KLocale::DigitSet > allDigitSetsList() const
Definition: klocale_kde.cpp:1034
static QString langLookup(const QString &fname, const char *rtype="html")
Definition: klocale_kde.cpp:2589
QString formatTime(const QTime &pTime, bool includeSecs=false, bool isDuration=false) const
Definition: klocale.cpp:419
void setWeekDayOfPray(int day)
Changes how KLocale defines the day reserved for religious observance.
Definition: klocale.cpp:505
QString countryCodeToName(const QString &country) const
Convert a known country code to a human readable, localized form.
Definition: klocale.cpp:680
QDate readDate(const QString &str, bool *ok=0) const
Converts a localized date string to a QDate.
Definition: klocale.cpp:388
virtual void removeCatalog(const QString &catalog)
Definition: klocale_kde.cpp:861
virtual QString convertDigits(const QString &str, KLocale::DigitSet digitSet, bool ignoreContext=false) const
Definition: klocale_kde.cpp:1145
BinarySizeUnits
These binary units are used in KDE by the formatByteSize() functions.
Definition: klocale.h:621
bool useTranscript() const
Reports whether evaluation of translation scripts is enabled.
Definition: klocale.cpp:630
virtual QString dateFormatShort() const
Definition: klocale_kde.cpp:2921
virtual void setWorkingWeekEndDay(int day)
Definition: klocale_kde.cpp:2902
QString decimalSymbol() const
Returns what a decimal point should look like ("." or "," etc.) according to the current locale or us...
Definition: klocale.cpp:252
QString languageCodeToName(const QString &language) const
Convert a known language code to a human readable, localized form.
Definition: klocale.cpp:670
QString formatDuration(unsigned long mSec) const
Given a number of milliseconds, converts that to a string containing the localized equivalent...
Definition: klocale.cpp:358
virtual QString digitSetToName(KLocale::DigitSet digitSet, bool withDigits=false) const
Definition: klocale_kde.cpp:1089
bool isApplicationTranslatedInto(const QString &language)
Checks whether or not the active catalog is found for the given language.
Definition: klocale.cpp:100
void setDateMonthNamePossessive(bool possessive)
Changes the form of month name used in dates.
Definition: klocale.cpp:480
KCalendarSystem abstract base class, provides support for local Calendar Systems in KDE...
Definition: kcalendarsystem.h:40
virtual void setPositivePrefixCurrencySymbol(bool prefix)
Definition: klocale_kde.cpp:2972
void translateRaw(const char *msg, QString *lang, QString *trans) const
Like translateRawFrom, with implicit lookup through all loaded catalogs.
Definition: klocale.cpp:163
QString monetaryThousandsSeparator() const
Returns what a thousands separator for monetary values should look like ("," or " " etc...
Definition: klocale.cpp:272
void setActiveCatalog(const QString &catalog)
Sets the active catalog for translation lookup.
Definition: klocale.cpp:146
virtual QStringList installedLanguages()
Definition: klocale_kde.cpp:3091
static QString defaultCountry()
Returns the code of the default country, i.e.
Definition: klocale.cpp:620
virtual void setCalendarSystem(KLocale::CalendarSystem)
Definition: klocale_kde.cpp:3206
QString convertDigits(const QString &str, DigitSet digitSet, bool ignoreContext=false) const
Definition: klocale.cpp:212
virtual QString formatByteSize(double size)
Definition: klocale_kde.cpp:1758
void setCalendarSystem(KLocale::CalendarSystem calendarSystem)
Definition: klocale.cpp:690
QString dateFormatShort() const
Returns the currently selected short date format.
Definition: klocale.cpp:515
Definition: kcurrencycode.h:45
QString translateQt(const char *context, const char *sourceText, const char *comment) const
Translates a message as a QTranslator is supposed to.
Definition: klocale.cpp:197
const KCalendarSystem * calendar() const
Returns a pointer to the calendar system object.
Definition: klocale.cpp:705
static void setMainCatalog(const char *catalog)
Definition: klocale_kde.cpp:1857
virtual void setCalendar(const QString &calendarType)
Definition: klocale_kde.cpp:3201
virtual void setMonetaryDecimalPlaces(int digits)
Definition: klocale_kde.cpp:2982
virtual QString translateQt(const char *context, const char *sourceText, const char *comment) const
Definition: klocale_kde.cpp:973
void setPositiveSign(const QString &sign)
Changes the sign used to identify a positive number.
Definition: klocale.cpp:540
QTextCodec * codecForEncoding() const
Returns the user's preferred encoding.
Definition: klocale.cpp:650
double readNumber(const QString &numStr, bool *ok=0) const
Converts a localized numeric string to a double.
Definition: klocale.cpp:378
bool setLanguage(const QString &language, KConfig *config)
Changes the current language.
Definition: klocale.cpp:85
virtual QString formatLong(long num) const
Definition: klocale_kde.cpp:1465
virtual QStringList currencyCodeList() const
Definition: klocale_kde.cpp:2499
virtual void setMonetaryDigitSet(KLocale::DigitSet digitSet)
Definition: klocale_kde.cpp:3297
virtual void setActiveCatalog(const QString &catalog)
Sets the active catalog for translation lookup.
Definition: klocale_kde.cpp:878
SignPosition negativeMonetarySignPosition() const
Denotes where to place a negative sign in relation to a monetary value.
Definition: klocale.cpp:312
void setNegativePrefixCurrencySymbol(bool prefix)
Changes the position where the currency symbol should be printed for negative monetary values...
Definition: klocale.cpp:565
void setMonetaryDecimalSymbol(const QString &symbol)
Changes the symbol used to identify the decimal pointer for monetary values.
Definition: klocale.cpp:585
virtual void setNegativeSign(const QString &sign)
Definition: klocale_kde.cpp:2957
virtual QStringList allLanguagesList()
Definition: klocale_kde.cpp:3083
virtual QTime readTime(const QString &str, bool *ok=0) const
Definition: klocale_kde.cpp:2108
bool negativePrefixCurrencySymbol() const
If and only if the currency symbol precedes a negative value, this will be true.
Definition: klocale.cpp:302
virtual bool setCountry(const QString &country, KConfig *config)
Definition: klocale_kde.cpp:593
QString formatByteSize(double size) const
Converts size from bytes to the string representation using the user's default binary unit dialect...
Definition: klocale.cpp:343
Definition: klocale_win_p.h:27
bool setCountry(const QString &country, KConfig *config)
Changes the current country.
Definition: klocale.cpp:75
virtual double readMoney(const QString &numStr, bool *ok=0) const
Definition: klocale_kde.cpp:1950
virtual void setTimeFormat(const QString &format)
Definition: klocale_kde.cpp:2883
void setWeekNumberSystem(KLocale::WeekNumberSystem weekNumberSystem)
Definition: klocale_kde.cpp:3232
QString country() const
Returns the country code of the country where the user lives.
Definition: klocale.cpp:116
Definition: kaboutdata.h:33
virtual QTime readLocaleTime(const QString &str, bool *ok=0, KLocale::TimeFormatOptions options=KLocale::TimeDefault, KLocale::TimeProcessingOptions processing=KLocale::ProcessNonStrict) const
Definition: klocale_kde.cpp:2192
virtual QString formatTime(const QTime &pTime, bool includeSecs=false, bool isDuration=false) const
Definition: klocale_kde.cpp:2329
void setTimeFormat(const QString &format)
Changes the current time format.
Definition: klocale.cpp:485
QTime readLocaleTime(const QString &str, bool *ok=0, TimeFormatOptions options=KLocale::TimeDefault, TimeProcessingOptions processing=ProcessNonStrict) const
Definition: klocale.cpp:413
void setPositivePrefixCurrencySymbol(bool prefix)
Changes the position where the currency symbol should be printed for positive monetary values...
Definition: klocale.cpp:560
virtual void setDecimalSymbol(const QString &symbol)
Definition: klocale_kde.cpp:2936
virtual void copyCatalogsTo(KLocale *locale)
Definition: klocale_kde.cpp:3242
void translateRawFrom(const char *catname, const char *msg, QString *lang, QString *trans) const
Definition: klocale.cpp:158
Definition: klocale_unix_p.h:25
virtual void setMeasureSystem(KLocale::MeasureSystem value)
Definition: klocale_kde.cpp:3024
int weekDayOfPray() const
Use this to determine which day is reserved for religious observance.
Definition: klocale.cpp:242
virtual KLocale::SignPosition positiveMonetarySignPosition() const
Definition: klocale_kde.cpp:1284
QTime readTime(const QString &str, bool *ok=0) const
Converts a localized time string to a QTime.
Definition: klocale.cpp:403
QStringList allLanguagesList() const
Provides list of all known language codes.
Definition: klocale.cpp:660
virtual KLocale::SignPosition negativeMonetarySignPosition() const
Definition: klocale_kde.cpp:1289
void insertCatalog(const QString &catalog)
Adds another catalog to search for translation lookup.
Definition: klocale.cpp:136
virtual QString formatLocaleTime(const QTime &pTime, KLocale::TimeFormatOptions options=KLocale::TimeDefault) const
Definition: klocale_kde.cpp:2341
void setMonetaryDecimalPlaces(int digits)
Definition: klocale.cpp:575
virtual QString languageCodeToName(const QString &language)
Definition: klocale_kde.cpp:3103
virtual bool setLanguage(const QString &language, KConfig *config)
Definition: klocale_kde.cpp:635
virtual QDate readDate(const QString &str, bool *ok=0)
Definition: klocale_kde.cpp:2093
A class representing a date and time with an associated time zone.
Definition: kdatetime.h:171
QString currencySymbol() const
Returns what the symbol denoting currency in the current locale as as defined by user settings should...
Definition: klocale.cpp:262
void setCurrencySymbol(const QString &symbol)
Changes the current currency symbol.
Definition: klocale.cpp:590
QString formatDateTime(const QDateTime &dateTime, DateFormat format=ShortDate, bool includeSecs=false) const
Returns a string formatted to the current locale's conventions regarding both date and time...
Definition: klocale.cpp:456
void setBinaryUnitDialect(BinaryUnitDialect newDialect)
Sets newDialect to be the default dialect for this locale (and only this locale). ...
Definition: klocale.cpp:353
bool dateMonthNamePossessive() const
Use this to determine whether in dates a possessive form of month name is preferred ("of January" rat...
Definition: klocale.cpp:222
void setMonetaryThousandsSeparator(const QString &separator)
Changes the separator used to group digits when formating monetary values.
Definition: klocale.cpp:580
QString removeAcceleratorMarker(const QString &label) const
Definition: klocale.cpp:749
Definition: klocale_mac_p.h:27
virtual void setDigitSet(KLocale::DigitSet digitSet)
Definition: klocale_kde.cpp:3287
void setPageSize(int paperFormat)
Changes the preferred page size when printing.
Definition: klocale.cpp:600
virtual void setCurrencyCode(const QString &newCurrencyCode)
Definition: klocale_kde.cpp:711
virtual void setCurrencySymbol(const QString &symbol)
Definition: klocale_kde.cpp:3003
QStringList languageList() const
Returns the language codes selected by user, ordered by decreasing priority.
Definition: klocale.cpp:439
int workingWeekStartDay() const
Use this to determine which day is the first working day of the week.
Definition: klocale.cpp:232
void setWorkingWeekStartDay(int day)
Changes how KLocale defines the first working day in week.
Definition: klocale.cpp:495
virtual void setMonetaryThousandsSeparator(const QString &separator)
Definition: klocale_kde.cpp:2987
virtual bool negativePrefixCurrencySymbol() const
Definition: klocale_kde.cpp:1279
MeasureSystem measureSystem() const
Returns which measuring system we use.
Definition: klocale.cpp:605
KLocale provides support for country specific stuff like the national language.
Definition: klocale.h:69
static QString defaultCurrencyCode()
Definition: klocale_kde.cpp:3040
void setPositiveMonetarySignPosition(SignPosition signpos)
Changes the sign position used for positive monetary values.
Definition: klocale.cpp:550
virtual QString formatDuration(unsigned long mSec) const
Definition: klocale_kde.cpp:1777
QStringList allCountriesList() const
Provides list of all known country codes.
Definition: klocale.cpp:675
BinaryUnitDialect binaryUnitDialect() const
Returns the user's configured binary unit dialect.
Definition: klocale.cpp:348
virtual void setDateFormat(const QString &format)
Definition: klocale_kde.cpp:2868
SignPosition
Various positions for where to place the positive or negative sign when they are related to a monetar...
Definition: klocale.h:281
virtual void insertCatalog(const QString &catalog)
Definition: klocale_kde.cpp:812
QString positiveSign() const
Returns what a positive sign should look like ("+", " ", etc.) according to the current locale or use...
Definition: klocale.cpp:277
virtual void translateRawFrom(const char *catname, const char *msgctxt, const char *msgid, const char *msgid_plural=0, unsigned long n=0, QString *language=0, QString *translation=0) const
Definition: klocale_kde.cpp:890
QString negativeSign() const
Returns what a negative sign should look like ("-", etc.) according to the current locale or user set...
Definition: klocale.cpp:282
virtual void setNegativeMonetarySignPosition(KLocale::SignPosition signpos)
Definition: klocale_kde.cpp:2967
virtual void setPageSize(int paperFormat)
Definition: klocale_kde.cpp:3013
void setDecimalSymbol(const QString &symbol)
Changes the symbol used to identify the decimal pointer.
Definition: klocale.cpp:530
SignPosition positiveMonetarySignPosition() const
Returns the position of a positive sign in relation to a monetary value.
Definition: klocale.cpp:307
virtual void setThousandsSeparator(const QString &separator)
Definition: klocale_kde.cpp:2941
static QString formatDateTime(const KLocale *locale, const QDateTime &dateTime, KLocale::DateFormat, bool includeSeconds, int daysToNow, int secsToNow)
Definition: klocale_kde.cpp:2504
int weekStartDay() const
Use this to determine which day is the first day of the week.
Definition: klocale.cpp:227
void setCurrencyCode(const QString &newCurrencyCode)
Definition: klocale.cpp:95
virtual void setDecimalPlaces(int digits)
Definition: klocale_kde.cpp:2931
QString formatDate(const QDate &date, DateFormat format=LongDate) const
Returns a string formatted to the current locale's conventions regarding dates.
Definition: klocale.cpp:368
virtual void setPositiveSign(const QString &sign)
Definition: klocale_kde.cpp:2952
KLocale::CalendarSystem calendarSystem() const
Definition: klocale_kde.cpp:3218
virtual KLocale::BinaryUnitDialect binaryUnitDialect() const
Definition: klocale_kde.cpp:1763
virtual QStringList allCountriesList() const
Definition: klocale_kde.cpp:3113
void setWeekStartDay(int day)
Changes how KLocale defines the first day in week.
Definition: klocale.cpp:490
void copyCatalogsTo(KLocale *locale)
Copies the catalogs of this object to an other KLocale object.
Definition: klocale.cpp:739
virtual QString countryCodeToName(const QString &country) const
Definition: klocale_kde.cpp:3126
virtual KDayPeriod dayPeriodForTime(const QTime &time) const
Definition: klocale_kde.cpp:2482
QString formatNumber(double num, int precision=-1) const
Given a double, converts that to a numeric string containing the localized numeric equivalent...
Definition: klocale.cpp:322
virtual QString formatDate(const QDate &date, KLocale::DateFormat format=KLocale::LongDate)
Definition: klocale_kde.cpp:1852
virtual void setMonetaryDecimalSymbol(const QString &symbol)
Definition: klocale_kde.cpp:2998
static void splitLocale(const QString &locale, QString &language, QString &country, QString &modifier, QString &charset)
Parses locale string into distinct parts.
Definition: klocale.cpp:105
void setWeekNumberSystem(KLocale::WeekNumberSystem weekNumberSystem)
Definition: klocale.cpp:710
Definition: klocale_p.h:34
virtual QString formatMoney(double num, const QString ¤cy=QString(), int precision=-1) const
Definition: klocale_kde.cpp:1392
int workingWeekEndDay() const
Use this to determine which day is the last working day of the week.
Definition: klocale.cpp:237
void setNegativeMonetarySignPosition(SignPosition signpos)
Changes the sign position used for negative monetary values.
Definition: klocale.cpp:555
QString formatMoney(double num, const QString ¤cy=QString(), int precision=-1) const
Given a double, converts that to a numeric string containing the localized monetary equivalent...
Definition: klocale.cpp:317
virtual int workingWeekStartDay() const
Definition: klocale_kde.cpp:1197
virtual int monetaryDecimalPlaces() const
Definition: klocale_kde.cpp:1269
virtual void setWeekDayOfPray(int day)
Definition: klocale_kde.cpp:2909
virtual void setNegativePrefixCurrencySymbol(bool prefix)
Definition: klocale_kde.cpp:2977
virtual bool positivePrefixCurrencySymbol() const
Definition: klocale_kde.cpp:1274
virtual QStringList languageList() const
Definition: klocale_kde.cpp:2494
virtual QString currencySymbol() const
Definition: klocale_kde.cpp:1232
virtual void setDateFormatShort(const QString &format)
Definition: klocale_kde.cpp:2873
virtual void setWeekStartDay(int day)
Definition: klocale_kde.cpp:2888
bool setCountryDivisionCode(const QString &countryDivision)
Definition: klocale.cpp:80
virtual KLocale::DigitSet dateTimeDigitSet() const
Definition: klocale_kde.cpp:3312
virtual bool isApplicationTranslatedInto(const QString &language)
Definition: klocale_kde.cpp:720
static QString defaultLanguage()
Returns the name of the internal language.
Definition: klocale.cpp:615
virtual QTextCodec * codecForEncoding() const
Definition: klocale_kde.cpp:3068
void setWorkingWeekEndDay(int day)
Changes how KLocale defines the last working day in week.
Definition: klocale.cpp:500
double readMoney(const QString &numStr, bool *ok=0) const
Converts a localized monetary string to a double.
Definition: klocale.cpp:383
virtual QString removeAcceleratorMarker(const QString &label) const
Definition: klocale_kde.cpp:3282
QString monetaryDecimalSymbol() const
Returns what a decimal point should look like ("." or "," etc.) for monetary values, according to the current locale or user settings.
Definition: klocale.cpp:267
KLocale::WeekNumberSystem weekNumberSystem()
Definition: klocale_kde.cpp:3237
QString thousandsSeparator() const
Returns what the thousands separator should look like ("," or "." etc.) according to the current loca...
Definition: klocale.cpp:257
virtual void setBinaryUnitDialect(KLocale::BinaryUnitDialect newDialect)
Definition: klocale_kde.cpp:1768
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:22:11 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:22:11 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.