KDELibs4Support

klocale.cpp
1 /* This file is part of the KDE libraries
2  Copyright (c) 1997,2001 Stephan Kulow <[email protected]>
3  Copyright (c) 1999 Preston Brown <[email protected]>
4  Copyright (c) 1999-2002 Hans Petter Bieker <[email protected]>
5  Copyright (c) 2002 Lukas Tinkl <[email protected]>
6  Copyright (C) 2007 Bernhard Loos <[email protected]>
7  Copyright (C) 2009, 2010 John Layt <[email protected]>
8 
9  This library is free software; you can redistribute it and/or
10  modify it under the terms of the GNU Library General Public
11  License as published by the Free Software Foundation; either
12  version 2 of the License, or (at your option) any later version.
13 
14  This library is distributed in the hope that it will be useful,
15  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17  Library General Public License for more details.
18 
19  You should have received a copy of the GNU Library General Public License
20  along with this library; see the file COPYING.LIB. If not, write to
21  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
22  Boston, MA 02110-1301, USA.
23 */
24 
25 #include "klocale.h"
26 #if defined Q_OS_WIN
27 #include "klocale_win_p.h"
28 #elif defined Q_OS_MAC
29 #include "klocale_mac_p.h"
30 #else
31 #include "klocale_unix_p.h"
32 #endif
33 
34 #include <QDateTime>
35 
36 #include "kconfig.h"
37 #include "kdatetime.h"
38 #include "kcalendarsystem.h"
39 #include "kdayperiod_p.h"
40 #include "kcurrencycode.h"
41 
42 KLocale::KLocale(KSharedConfig::Ptr config)
43 #if defined Q_OS_WIN
44  : d(new KLocaleWindowsPrivate(this, config))
45 #elif defined Q_OS_MAC
46  : d(new KLocaleMacPrivate(this, config))
47 #else
48  : d(new KLocaleUnixPrivate(this, config))
49 #endif
50 {
51 }
52 
53 KLocale::KLocale(const QString &language, const QString &country, KConfig *config)
54 #if defined Q_OS_WIN
55  : d(new KLocaleWindowsPrivate(this, language, country, config))
56 #elif defined Q_OS_MAC
57  : d(new KLocaleMacPrivate(this, language, country, config))
58 #else
59  : d(new KLocaleUnixPrivate(this, language, country, config))
60 #endif
61 {
62 }
63 
65 {
66  delete d;
67 }
68 
69 bool KLocale::setCountry(const QString &country, KConfig *config)
70 {
71  return d->setCountry(country, config);
72 }
73 
75 {
76  return d->setCountryDivisionCode(countryDivisionCode);
77 }
78 
79 bool KLocale::setLanguage(const QString &language, KConfig *config)
80 {
81  return d->setLanguage(language, config);
82 }
83 
84 bool KLocale::setLanguage(const QStringList &languages)
85 {
86  return d->setLanguage(languages);
87 }
88 
89 void KLocale::setCurrencyCode(const QString &newCurrencyCode)
90 {
91  d->setCurrencyCode(newCurrencyCode);
92 }
93 
94 void KLocale::splitLocale(const QString &locale, QString &language, QString &country, QString &modifier,
95  QString &charset)
96 {
97  KLocalePrivate::splitLocale(locale, language, country, modifier, charset);
98 }
99 
101 {
102  return d->language();
103 }
104 
106 {
107  return d->country();
108 }
109 
111 {
112  return d->countryDivisionCode();
113 }
114 
116 {
117  return d->currency();
118 }
119 
121 {
122  return d->currencyCode();
123 }
124 
126 {
127  return d->allDigitSetsList();
128 }
129 
131 {
132  return d->digitSetToName(digitSet, withDigits);
133 }
134 
135 QString KLocale::convertDigits(const QString &str, DigitSet digitSet, bool ignoreContext) const
136 {
137  return d->convertDigits(str, digitSet, ignoreContext);
138 }
139 
141 {
142  return d->nounDeclension();
143 }
144 
146 {
147  return d->dateMonthNamePossessive();
148 }
149 
151 {
152  return d->weekStartDay();
153 }
154 
156 {
157  return d->workingWeekStartDay();
158 }
159 
161 {
162  return d->workingWeekEndDay();
163 }
164 
166 {
167  return d->weekDayOfPray();
168 }
169 
171 {
172  return d->decimalPlaces();
173 }
174 
176 {
177  return d->decimalSymbol();
178 }
179 
181 {
182  return d->thousandsSeparator();
183 }
184 
186 {
187  return d->currencySymbol();
188 }
189 
191 {
192  return d->monetaryDecimalSymbol();
193 }
194 
196 {
197  return d->monetaryThousandsSeparator();
198 }
199 
201 {
202  return d->positiveSign();
203 }
204 
206 {
207  return d->negativeSign();
208 }
209 
211 {
212  return monetaryDecimalPlaces();
213 }
214 
216 {
217  return d->monetaryDecimalPlaces();
218 }
219 
221 {
222  return d->positivePrefixCurrencySymbol();
223 }
224 
226 {
227  return d->negativePrefixCurrencySymbol();
228 }
229 
231 {
232  return d->positiveMonetarySignPosition();
233 }
234 
236 {
237  return d->negativeMonetarySignPosition();
238 }
239 
240 QString KLocale::formatMoney(double num, const QString &symbol, int precision) const
241 {
242  return d->formatMoney(num, symbol, precision);
243 }
244 
245 QString KLocale::formatNumber(double num, int precision) const
246 {
247  return d->formatNumber(num, precision);
248 }
249 
251 {
252  return d->formatLong(num);
253 }
254 
255 QString KLocale::formatNumber(const QString &numStr, bool round, int precision) const
256 {
257  return d->formatNumber(numStr, round, precision);
258 }
259 
260 QString KLocale::formatByteSize(double size, int precision, KLocale::BinaryUnitDialect dialect,
261  KLocale::BinarySizeUnits specificUnit) const
262 {
263  return d->formatByteSize(size, precision, dialect, specificUnit);
264 }
265 
267 {
268  return d->formatByteSize(size);
269 }
270 
272 {
273  return d->binaryUnitDialect();
274 }
275 
277 {
278  d->setBinaryUnitDialect(newDialect);
279 }
280 
281 QString KLocale::formatDuration(unsigned long mSec) const
282 {
283  return d->formatDuration(mSec);
284 }
285 
286 QString KLocale::prettyFormatDuration(unsigned long mSec) const
287 {
288  return d->prettyFormatDuration(mSec);
289 }
290 
292 {
293  return d->formatDate(date, format);
294 }
295 
296 class KGlobalLocaleStatic
297 {
298 public:
299  KGlobalLocaleStatic()
300  : locale()
301  {
302  }
303 
304  KLocale locale;
305 };
306 
307 Q_GLOBAL_STATIC(KGlobalLocaleStatic, s_globalLocale)
308 
310 {
311  KGlobalLocaleStatic *glob = s_globalLocale();
312  return &glob->locale;
313 }
314 
315 double KLocale::readNumber(const QString &_str, bool *ok) const
316 {
317  return d->readNumber(_str, ok);
318 }
319 
320 double KLocale::readMoney(const QString &_str, bool *ok) const
321 {
322  return d->readMoney(_str, ok);
323 }
324 
325 QDate KLocale::readDate(const QString &intstr, bool *ok) const
326 {
327  return d->readDate(intstr, ok);
328 }
329 
330 QDate KLocale::readDate(const QString &intstr, ReadDateFlags flags, bool *ok) const
331 {
332  return d->readDate(intstr, flags, ok);
333 }
334 
335 QDate KLocale::readDate(const QString &intstr, const QString &fmt, bool *ok) const
336 {
337  return d->readDate(intstr, fmt, ok);
338 }
339 
340 QTime KLocale::readTime(const QString &intstr, bool *ok) const
341 {
342  return d->readTime(intstr, ok);
343 }
344 
345 QTime KLocale::readTime(const QString &intstr, KLocale::ReadTimeFlags flags, bool *ok) const
346 {
347  return d->readTime(intstr, flags, ok);
348 }
349 
350 QTime KLocale::readLocaleTime(const QString &intstr, bool *ok, TimeFormatOptions options,
351  TimeProcessingOptions processing) const
352 {
353  return d->readLocaleTime(intstr, ok, options, processing);
354 }
355 
356 QString KLocale::formatTime(const QTime &time, bool includeSecs, bool isDuration) const
357 {
358  return d->formatTime(time, includeSecs, isDuration);
359 }
360 
362 {
363  return d->formatLocaleTime(time, options);
364 }
365 
367 {
368  return d->use12Clock();
369 }
370 
372 {
373  return d->dayPeriodForTime(time).periodName(format);
374 }
375 
377 {
378  return d->languageList();
379 }
380 
382 {
383  return d->currencyCodeList();
384 }
385 
386 QString KLocale::formatDateTime(const QDateTime &dateTime, KLocale::DateFormat format, bool includeSeconds) const
387 {
388  return d->formatDateTime(dateTime, format, includeSeconds);
389 }
390 
392 {
393  return d->formatDateTime(dateTime, format, options);
394 }
395 
396 void KLocale::setDateFormat(const QString &format)
397 {
398  d->setDateFormat(format);
399 }
400 
402 {
403  d->setDateFormatShort(format);
404 }
405 
407 {
408  d->setDateMonthNamePossessive(possessive);
409 }
410 
411 void KLocale::setTimeFormat(const QString &format)
412 {
413  d->setTimeFormat(format);
414 }
415 
417 {
418  d->setWeekStartDay(day);
419 }
420 
422 {
423  d->setWorkingWeekStartDay(day);
424 }
425 
427 {
428  d->setWorkingWeekEndDay(day);
429 }
430 
432 {
433  d->setWeekDayOfPray(day);
434 }
435 
437 {
438  return d->dateFormat();
439 }
440 
442 {
443  return d->dateFormatShort();
444 }
445 
447 {
448  return d->timeFormat();
449 }
450 
452 {
453  d->setDecimalPlaces(digits);
454 }
455 
457 {
458  d->setDecimalSymbol(symbol);
459 }
460 
462 {
463  d->setThousandsSeparator(separator);
464 }
465 
467 {
468  d->setPositiveSign(sign);
469 }
470 
472 {
473  d->setNegativeSign(sign);
474 }
475 
477 {
478  d->setPositiveMonetarySignPosition(signpos);
479 }
480 
482 {
483  d->setNegativeMonetarySignPosition(signpos);
484 }
485 
487 {
488  d->setPositivePrefixCurrencySymbol(prefix);
489 }
490 
492 {
493  d->setNegativePrefixCurrencySymbol(prefix);
494 }
495 
496 void KLocale::setFracDigits(int digits)
497 {
498  setMonetaryDecimalPlaces(digits);
499 }
500 
502 {
503  d->setMonetaryDecimalPlaces(digits);
504 }
505 
507 {
508  d->setMonetaryThousandsSeparator(separator);
509 }
510 
512 {
513  d->setMonetaryDecimalSymbol(symbol);
514 }
515 
517 {
518  d->setCurrencySymbol(symbol);
519 }
520 
521 int KLocale::pageSize() const
522 {
523  return d->pageSize();
524 }
525 
526 void KLocale::setPageSize(int size)
527 {
528  d->setPageSize(size);
529 }
530 
532 {
533  return d->measureSystem();
534 }
535 
537 {
538  d->setMeasureSystem(value);
539 }
540 
542 {
543  return KLocalePrivate::defaultLanguage();
544 }
545 
547 {
548  return KLocalePrivate::defaultCountry();
549 }
550 
552 {
553  return KLocalePrivate::defaultCurrencyCode();
554 }
555 
557 {
558  return d->encoding();
559 }
560 
562 {
563  return d->encodingMib();
564 }
565 
567 {
568  return d->fileEncodingMib();
569 }
570 
572 {
573  return d->codecForEncoding();
574 }
575 
576 bool KLocale::setEncoding(int mibEnum)
577 {
578  return d->setEncoding(mibEnum);
579 }
580 
582 {
583  return d->allLanguagesList();
584 }
585 
587 {
588  return d->installedLanguages();
589 }
590 
592 {
593  return d->languageCodeToName(language);
594 }
595 
597 {
598  return d->allCountriesList();
599 }
600 
602 {
603  return d->countryCodeToName(country);
604 }
605 
607 {
608  d->setCalendar(calendarType);
609 }
610 
612 {
613  d->setCalendarSystem(calendarSystem);
614 }
615 
617 {
618  return d->calendarType();
619 }
620 
622 {
623  return d->calendarSystem();
624 }
625 
627 {
628  return d->calendar();
629 }
630 
632 {
633  d->setWeekNumberSystem(weekNumberSystem);
634 }
635 
637 {
638  return d->weekNumberSystem();
639 }
640 
642 {
643  return d->weekNumberSystem();
644 }
645 
647  : d(new KLocalePrivate(*rhs.d))
648 {
649  d->q = this;
650 }
651 
653 {
654  // the assignment operator works here
655  *d = *rhs.d;
656  d->q = this;
657  return *this;
658 }
659 
661 {
662  d->setDigitSet(digitSet);
663 }
664 
666 {
667  return d->digitSet();
668 }
669 
671 {
672  d->setMonetaryDigitSet(digitSet);
673 }
674 
676 {
677  return d->monetaryDigitSet();
678 }
679 
681 {
682  d->setDateTimeDigitSet(digitSet);
683 }
684 
686 {
687  return d->dateTimeDigitSet();
688 }
689 
691 {
692  d->initFormat();
693 }
QString dayPeriodText(const QTime &time, DateTimeComponentFormat format=DefaultComponentFormat) const
Definition: klocale.cpp:371
void setDateTimeDigitSet(DigitSet digitSet)
Definition: klocale.cpp:680
void setNegativeSign(const QString &sign)
Changes the sign used to identify a negative number.
Definition: klocale.cpp:471
void setDateFormat(const QString &format)
Changes the current date format.
Definition: klocale.cpp:396
void setDateFormatShort(const QString &format)
Changes the current short date format.
Definition: klocale.cpp:401
QString countryDivisionCode() const
Definition: klocale.cpp:110
void setMeasureSystem(MeasureSystem value)
Changes the preferred measuring system.
Definition: klocale.cpp:536
int fileEncodingMib() const
Returns the file encoding.
Definition: klocale.cpp:566
KLocale(KSharedConfig::Ptr config=KSharedConfig::Ptr())
Constructs a KLocale.
Definition: klocale.cpp:42
Date/times with associated time zone.
void setDecimalPlaces(int digits)
Definition: klocale.cpp:451
bool positivePrefixCurrencySymbol() const
If and only if the currency symbol precedes a positive value, this will be true.
Definition: klocale.cpp:220
static QString defaultCurrencyCode()
Definition: klocale.cpp:551
QString prettyFormatDuration(unsigned long mSec) const
Given a number of milliseconds, converts that to a pretty string containing the localized equivalent...
Definition: klocale.cpp:286
void setThousandsSeparator(const QString &separator)
Changes the separator used to group digits when formating numbers.
Definition: klocale.cpp:461
bool use12Clock() const
Use this to determine if the user wants a 12 hour clock.
Definition: klocale.cpp:366
const QByteArray encoding() const
Returns the user&#39;s preferred encoding.
Definition: klocale.cpp:556
QString digitSetToName(DigitSet digitSet, bool withDigits=false) const
Definition: klocale.cpp:130
void setCalendar(const QString &calendarType)
Definition: klocale.cpp:606
MeasureSystem
The Metric system will give you information in mm, while the Imperial system will give you informatio...
Definition: klocale.h:1636
void setMonetaryDigitSet(DigitSet digitSet)
Definition: klocale.cpp:670
QString formatLong(long num) const
Given an integer, converts that to a numeric string containing the localized numeric equivalent...
Definition: klocale.cpp:250
DateFormat
Format for date string.
Definition: klocale.h:783
QString formatLocaleTime(const QTime &pTime, TimeFormatOptions options=KLocale::TimeDefault) const
Definition: klocale.cpp:361
QString formatTime(const QTime &pTime, bool includeSecs=false, bool isDuration=false) const
Definition: klocale.cpp:356
void setWeekDayOfPray(int day)
Changes how KLocale defines the day reserved for religious observance.
Definition: klocale.cpp:431
QString countryCodeToName(const QString &country) const
Convert a known country code to a human readable, localized form.
Definition: klocale.cpp:601
BinarySizeUnits
These binary units are used in KDE by the formatByteSize() functions.
Definition: klocale.h:488
QString decimalSymbol() const
Returns what a decimal point should look like ("." or "," etc.) according to the current locale or us...
Definition: klocale.cpp:175
QString languageCodeToName(const QString &language) const
Convert a known language code to a human readable, localized form.
Definition: klocale.cpp:591
QString formatDuration(unsigned long mSec) const
Given a number of milliseconds, converts that to a string containing the localized equivalent...
Definition: klocale.cpp:281
void setDateMonthNamePossessive(bool possessive)
Changes the form of month name used in dates.
Definition: klocale.cpp:406
KCalendarSystem abstract base class, provides support for local Calendar Systems in KDE...
DateTimeComponentFormat
Definition: klocale.h:770
QString monetaryThousandsSeparator() const
Returns what a thousands separator for monetary values should look like ("," or " " etc...
Definition: klocale.cpp:195
static QString defaultCountry()
Returns the code of the default country, i.e.
Definition: klocale.cpp:546
QString convertDigits(const QString &str, DigitSet digitSet, bool ignoreContext=false) const
Definition: klocale.cpp:135
void setCalendarSystem(KLocale::CalendarSystem calendarSystem)
Definition: klocale.cpp:611
QString dateFormatShort() const
Returns the currently selected short date format.
Definition: klocale.cpp:441
const KCalendarSystem * calendar() const
Returns a pointer to the calendar system object.
Definition: klocale.cpp:626
ReadTimeFlags
Flags for the old version of readTime()
Definition: klocale.h:1155
void setPositiveSign(const QString &sign)
Changes the sign used to identify a positive number.
Definition: klocale.cpp:466
QTextCodec * codecForEncoding() const
Returns the user&#39;s preferred encoding.
Definition: klocale.cpp:571
CalendarSystem
Definition: klocale.h:646
bool setLanguage(const QString &language, KConfig *config)
Changes the current language.
Definition: klocale.cpp:79
QList< DigitSet > allDigitSetsList() const
Definition: klocale.cpp:125
KLocale::CalendarSystem calendarSystem() const
Definition: klocale.cpp:621
DigitSet monetaryDigitSet() const
Definition: klocale.cpp:675
QStringList currencyCodeList() const
Definition: klocale.cpp:381
SignPosition negativeMonetarySignPosition() const
Denotes where to place a negative sign in relation to a monetary value.
Definition: klocale.cpp:235
void setNegativePrefixCurrencySymbol(bool prefix)
Changes the position where the currency symbol should be printed for negative monetary values...
Definition: klocale.cpp:491
void reparseConfiguration()
Definition: klocale.cpp:690
DigitSet digitSet() const
Definition: klocale.cpp:665
void setMonetaryDecimalSymbol(const QString &symbol)
Changes the symbol used to identify the decimal pointer for monetary values.
Definition: klocale.cpp:511
bool negativePrefixCurrencySymbol() const
If and only if the currency symbol precedes a negative value, this will be true.
Definition: klocale.cpp:225
WeekNumberSystem
Definition: klocale.h:681
QString formatByteSize(double size) const
Converts size from bytes to the string representation using the user&#39;s default binary unit dialect...
Definition: klocale.cpp:266
bool setCountry(const QString &country, KConfig *config)
Changes the current country.
Definition: klocale.cpp:69
QString language() const
Returns the language code used by this object.
Definition: klocale.cpp:100
QString country() const
Returns the country code of the country where the user lives.
Definition: klocale.cpp:105
KCurrencyCode * currency() const
Definition: klocale.cpp:115
ReadDateFlags
Flags for readDate()
Definition: klocale.h:1108
void setTimeFormat(const QString &format)
Changes the current time format.
Definition: klocale.cpp:411
void setPositivePrefixCurrencySymbol(bool prefix)
Changes the position where the currency symbol should be printed for positive monetary values...
Definition: klocale.cpp:486
int weekDayOfPray() const
Use this to determine which day is reserved for religious observance.
Definition: klocale.cpp:165
static KLocale * global()
Return the global KLocale instance.
Definition: klocale.cpp:309
QStringList allLanguagesList() const
Provides list of all known language codes.
Definition: klocale.cpp:581
QString dateFormat() const
Returns the currently selected date format.
Definition: klocale.cpp:436
QString currencyCode() const
Definition: klocale.cpp:120
void setMonetaryDecimalPlaces(int digits)
Definition: klocale.cpp:501
A class representing a date and time with an associated time zone.
Definition: kdatetime.h:148
int pageSize() const
Returns the preferred page size for printing.
Definition: klocale.cpp:521
QString currencySymbol() const
Returns what the symbol denoting currency in the current locale as as defined by user settings should...
Definition: klocale.cpp:185
void setCurrencySymbol(const QString &symbol)
Changes the current currency symbol.
Definition: klocale.cpp:516
int decimalPlaces() const
Definition: klocale.cpp:170
QTime readLocaleTime(const QString &str, bool *ok=nullptr, TimeFormatOptions options=KLocale::TimeDefault, TimeProcessingOptions processing=ProcessNonStrict) const
Definition: klocale.cpp:350
KLocale & operator=(const KLocale &rhs)
Assignment operator.
Definition: klocale.cpp:652
QString formatDateTime(const QDateTime &dateTime, DateFormat format=ShortDate, bool includeSecs=false) const
Returns a string formatted to the current locale&#39;s conventions regarding both date and time...
Definition: klocale.cpp:386
bool nounDeclension() const
Definition: klocale.cpp:140
void setBinaryUnitDialect(BinaryUnitDialect newDialect)
Sets newDialect to be the default dialect for this locale (and only this locale). ...
Definition: klocale.cpp:276
bool dateMonthNamePossessive() const
Use this to determine whether in dates a possessive form of month name is preferred ("of January" rat...
Definition: klocale.cpp:145
void setMonetaryThousandsSeparator(const QString &separator)
Changes the separator used to group digits when formating monetary values.
Definition: klocale.cpp:506
QStringList installedLanguages() const
Definition: klocale.cpp:586
void setPageSize(int paperFormat)
Changes the preferred page size when printing.
Definition: klocale.cpp:526
QStringList languageList() const
Returns the language codes selected by user, ordered by decreasing priority.
Definition: klocale.cpp:376
int workingWeekStartDay() const
Use this to determine which day is the first working day of the week.
Definition: klocale.cpp:155
void setWorkingWeekStartDay(int day)
Changes how KLocale defines the first working day in week.
Definition: klocale.cpp:421
virtual ~KLocale()
Destructor.
Definition: klocale.cpp:64
MeasureSystem measureSystem() const
Returns which measuring system we use.
Definition: klocale.cpp:531
KLocale provides support for language and country specific stuff.
Definition: klocale.h:75
QDate readDate(const QString &str, bool *ok=nullptr) const
Converts a localized date string to a QDate.
Definition: klocale.cpp:325
void setPositiveMonetarySignPosition(SignPosition signpos)
Changes the sign position used for positive monetary values.
Definition: klocale.cpp:476
QStringList allCountriesList() const
Provides list of all known country codes.
Definition: klocale.cpp:596
BinaryUnitDialect binaryUnitDialect() const
Returns the user&#39;s configured binary unit dialect.
Definition: klocale.cpp:271
SignPosition
Various positions for where to place the positive or negative sign when they are related to a monetar...
Definition: klocale.h:148
KLocale::WeekNumberSystem weekNumberSystem()
Definition: klocale.cpp:636
QString positiveSign() const
Returns what a positive sign should look like ("+", " ", etc.) according to the current locale or use...
Definition: klocale.cpp:200
QString negativeSign() const
Returns what a negative sign should look like ("-", etc.) according to the current locale or user set...
Definition: klocale.cpp:205
void setDecimalSymbol(const QString &symbol)
Changes the symbol used to identify the decimal pointer.
Definition: klocale.cpp:456
SignPosition positiveMonetarySignPosition() const
Returns the position of a positive sign in relation to a monetary value.
Definition: klocale.cpp:230
int fracDigits() const
Definition: klocale.cpp:210
int weekStartDay() const
Use this to determine which day is the first day of the week.
Definition: klocale.cpp:150
void setCurrencyCode(const QString &newCurrencyCode)
Definition: klocale.cpp:89
QString formatDate(const QDate &date, DateFormat format=LongDate) const
Returns a string formatted to the current locale&#39;s conventions regarding dates.
Definition: klocale.cpp:291
double readNumber(const QString &numStr, bool *ok=nullptr) const
Converts a localized numeric string to a double.
Definition: klocale.cpp:315
BinaryUnitDialect
This enum chooses what dialect is used for binary units.
Definition: klocale.h:523
DigitSet
Definition: klocale.h:176
void setWeekStartDay(int day)
Changes how KLocale defines the first day in week.
Definition: klocale.cpp:416
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:245
bool setEncoding(int mibEnum)
Changes the current encoding.
Definition: klocale.cpp:576
QTime readTime(const QString &str, bool *ok=nullptr) const
Converts a localized time string to a QTime.
Definition: klocale.cpp:340
static void splitLocale(const QString &locale, QString &language, QString &country, QString &modifier, QString &charset)
Parses locale string into distinct parts.
Definition: klocale.cpp:94
void setWeekNumberSystem(KLocale::WeekNumberSystem weekNumberSystem)
Definition: klocale.cpp:631
int workingWeekEndDay() const
Use this to determine which day is the last working day of the week.
Definition: klocale.cpp:160
void setNegativeMonetarySignPosition(SignPosition signpos)
Changes the sign position used for negative monetary values.
Definition: klocale.cpp:481
QString calendarType() const
Definition: klocale.cpp:616
QString formatMoney(double num, const QString &currency=QString(), int precision=-1) const
Given a double, converts that to a numeric string containing the localized monetary equivalent...
Definition: klocale.cpp:240
DigitSet dateTimeDigitSet() const
Definition: klocale.cpp:685
void setFracDigits(int digits)
Definition: klocale.cpp:496
bool setCountryDivisionCode(const QString &countryDivision)
Definition: klocale.cpp:74
static QString defaultLanguage()
Returns the name of the internal language.
Definition: klocale.cpp:541
int monetaryDecimalPlaces() const
Definition: klocale.cpp:215
double readMoney(const QString &numStr, bool *ok=nullptr) const
Converts a localized monetary string to a double.
Definition: klocale.cpp:320
void setWorkingWeekEndDay(int day)
Changes how KLocale defines the last working day in week.
Definition: klocale.cpp:426
void setDigitSet(DigitSet digitSet)
Definition: klocale.cpp:660
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:190
QString thousandsSeparator() const
Returns what the thousands separator should look like ("," or "." etc.) according to the current loca...
Definition: klocale.cpp:180
QString timeFormat() const
Returns the currently selected time format.
Definition: klocale.cpp:446
int encodingMib() const
Returns the user&#39;s preferred encoding.
Definition: klocale.cpp:561
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Thu Dec 3 2020 22:59:36 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.