summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools/qlocale.h
Commit message (Collapse)AuthorAgeFilesLines
* Move text-related code out of corelib/tools/ to corelib/text/Edward Welbourne2019-07-101-1153/+0
| | | | | | | | This includes byte array, string, char, unicode, locale, collation and regular expressions. Change-Id: I8b125fa52c8c513eb57a0f1298b91910e5a0d786 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Add locale support for Cebuano and Erzya languages (new in CLDR v35.1)Edward Welbourne2019-05-201-1/+3
| | | | | | | Change-Id: I5d0ee7bc27eeca1c046d442b0410128ea5abbdb3 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
* Remove handling of missing Q_COMPILER_RVALUE_REFSAllan Sandfeld Jensen2019-05-011-2/+0
| | | | | | | | Remove remaining handling of missing support for rvalue refs. Change-Id: I78bab8bccfeeb9c76f464f345874364a37e4840a Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Improve the default selection of locale for QCollatorEdward Welbourne2019-04-101-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | QCollator was using the default-constructed QLocale() as its default; this locale's default was the system locale; however, that didn't pay any attention to system settings for collation such as Unix's environment variable LC_COLLATE or the MS-Win LOCALE_SSORTLOCALE configuration option. Teach the system locale back-ends to look up their relevant settings, add QLocale::collation() as a channel via which to access that and change no-parameter construction of QCollator to a separate implementation (rather than the constructor taking QLocale having a default) using it. [ChangeLog][QtCore][QLocale] The system locale now knows what to use for collation, QLocale::system().collation(). [ChangeLog][QtCore][QCollator] The default QCollator now uses the system's collation locale, rather than the system locale itself. Fixes: QTBUG-58621 Change-Id: I90f86621541385330315d1f9d6a4b982bdcea9d5 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Replace Q_DECL_NOEXCEPT with noexcept in corelibAllan Sandfeld Jensen2019-04-031-4/+4
| | | | | | | In preparation of Qt6 move away from pre-C++11 macros. Change-Id: I44126693c20c18eca5620caab4f7e746218e0ce3 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Add conversion to and from long and ulongVolker Hilsheimer2019-02-211-0/+12
| | | | | | | | | | | | | This implements conversion parity with QString, which can convert to and from long and unsigned long. The implementation simply forwards to existing long long overloads or uses the existing helpers, so just as for the conversion to/from int or short, no additional test cases were added. Change-Id: I37ef06d9ce4d80d98bd72720353996bac723e09c Fixes: QTBUG-782 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* QLocale: add const version of formattedDataSizeChristian Ehrlicher2018-11-021-0/+3
| | | | | | | | | | | | | | QLocale::formattedDataSize() was not marked const when it was added although the function is const. Add a const overload and mark the non-const version as deprecated and remove it with Qt6 Fixes: QTBUG-71445 Change-Id: I56d051d9928b5e00cdaca7a874c543fed27a888d Reviewed-by: Luca Beldi <v.ronin@yahoo.it> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Merge remote-tracking branch 'origin/5.12' into devQt Forward Merge Bot2018-09-291-1/+1
|\ | | | | | | Change-Id: I6083c3e61b7dbe188f83676f7e7bb268e5ccf2f3
| * Merge remote-tracking branch 'origin/5.11' into 5.12Liang Qi2018-09-271-1/+1
| |\ | | | | | | | | | | | | | | | | | | | | | Conflicts: src/corelib/global/qconfig-bootstrapped.h src/widgets/util/qcompleter.cpp Change-Id: I4f44f0f074982530f2f2e750ce696230b2754cf3
| | * Modernize the "datestring" featureLiang Qi2018-09-241-1/+1
| | | | | | | | | | | | | | | | | | Change-Id: I2236a456fe3758d9054b22e36fe6316f3522d533 Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* | | Make updateSystemPrivate() local to qlocale.cppEdward Welbourne2018-09-111-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It's not thread-safe so should only be used within systemData()'s locked code. This eliminates the last callers of it by making it a local function of the compilation unit, exposing a method from QSystemLocale() to get round its use of private parts. Make the constructor for QSystemLocale only stomp its _systemLocale global if previously unset, but let instantiation still clear globalLocaleData.m_language_id, so that it can be used as a way to trigger an update to system locale data. Change-Id: I908dca9fd30bbf20f42321ab8f9094f2fa37b7b0 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | | Add some missing language codes to our locale dataEdward Welbourne2018-08-271-1/+6
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | We were missing a few languages CLDR knew about; so add them to the list in enumdata.py (and add trailing commas to lists to make future additions not need to change the prior last line; python is perfectly happy with this). [ChangeLog][QtCore][QLocale] Added support for Western Balochi, Ido, Lojban, Sicilian and Souther Kurdish. Change-Id: I0d24cff46a0ae8db48ec1db8762088f877319982 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@qt.io>
* | Tidy up generation of aliases in locale-related enumsEdward Welbourne2018-08-161-12/+12
| | | | | | | | | | | | | | | | | | Replace lines of formatted output with dictionaries from which that output can be generated efficiently (in sorted order). Tidy up the python code, in the process. Change-Id: Ifb74eb69342646c5dbabc3247b3a8ddef602e934 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Add support for numbered territories in CLDREdward Welbourne2018-08-131-2/+5
|/ | | | | | | | | | | | | | | | | | The CLDR data contains eight locales with numeric territory codes, 001 for World, 150 for Europe and 419 for Latin America. The last was already known in our enumdata.py, but as "Latin America and The Caribbean", which is not supported by the CLDR, so I've amended it while adding the other two. This gives us support for Esperanto and Yiddish (among others). [ChangeLog][QtCore][QLocale] Added support for World and Europe as (numeric) "country" codes ("territory" in CLDR terms), thereby enabling support for Yiddish and Esperanto, among other locales using such codes. Task-number: QTBUG-57802 Change-Id: Ibb1180fb720743a3a0589527649d10f3c9cd123d Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Replace Q_NULLPTR with nullptr where possibleKevin Funk2017-09-191-16/+16
| | | | | | | | | | | | | Remaining uses of Q_NULLPTR are in: src/corelib/global/qcompilerdetection.h (definition and documentation of Q_NULLPTR) tests/manual/qcursor/qcursorhighdpi/main.cpp (a test executable compilable both under Qt4 and Qt5) Change-Id: If6b074d91486e9b784138f4514f5c6d072acda9a Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* Add QLocale::formattedDataSize and consolidate use casesShawn Rutledge2017-06-201-0/+15
| | | | | | | | | | | | | | | It should be easier to translate sizes in bytes to human-readable strings consistently rather than having to repeat this code (and the string translations) in various places. The FileDialog in QtQuick.Controls has a use for this, too. [ChangeLog][QtCore][QLocale] Added QLocale::formattedDataSize() for formatting quantities of bytes as kB, MB, GB etc. Done-with: Edward Welbourne <edward.welbourne@qt.io> Change-Id: I27bca146c3eba90fa7a5d52ef6626ce85723e3f0 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QLocale: add toString(Q(Date|QTime)+, QStringView format) overloadsMarc Mutz2017-04-121-2/+8
| | | | | | | | | | | | | While at it, change the interface of qt_repeatCount() to just take a single QStringView, since QStringView::mid() is so cheap. Add some \internal docs. [ChangeLog][QtCore][QLocale] Added toString(QDate/QTime/QDateTime) overloads taking the format string as a QStringView. Change-Id: Ic078796677a6db06227c8a3e276dbdb1039ceead Reviewed-by: Anton Kudryavtsev <antkudr@mail.ru> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* QLocale: add QStringView overload of number parsing functionsMarc Mutz2017-03-291-0/+11
| | | | | | | | | This ports all to<Integer>() functions in QLocale to QStringView. Change-Id: Idc3f026d5afdf51abab670b54ea96d2361cdc350 Reviewed-by: Anton Kudryavtsev <antkudr@mail.ru> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* QLocale: Add option to pad numbers with trailing zeroesUlf Hermann2016-09-151-1/+3
| | | | | | | | | | | | | | | | | | | | | | EcmaScript mandates that number-to-string functions pad the resulting strings with zeroes, up to the requested precision. QLocale actually supports this, under the disguise of the "Alternate" flag, used by QString::asprintf(). We split this flag into the three options it actually represents and make IncludeTrailingZeroesAfterDot available as a NumberOption. This allows us to generate numbers in an EcmaScript compliant way. In addition, a symmetrical option to reject trailing zeroes when parsing strings to numbers is added. [ChangeLog][QtCore][QLocale] Additional flags in QLocale::NumberOption allow generating strings from doubles in accordance to EcmaScript's Number.toPrecision(n). Change-Id: If1090d5a0364a29811011a472afc8b75d0af0a8f Reviewed-by: Simon Hausmann <simon.hausmann@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Re-generate QLocale data from CLDR v29Konstantin Ritt2016-04-081-5/+49
| | | | | | | | | | | * A bunch of fixes and additions to the locale data * Add new scripts from Unicode 8.0 and 9.0 * Map some potentially useful languages and territories [ChangeLog][QtCore] QLocale data updated to CLDR v29 Change-Id: I759ccb27fe19be2722be913c5c2e6aa5f36e5c14 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* Updated license headersJani Heikkinen2016-01-151-14/+20
| | | | | | | | | | | From Qt 5.7 -> LGPL v2.1 isn't an option anymore, see http://blog.qt.io/blog/2016/01/13/new-agreement-with-the-kde-free-qt-foundation/ Updated license headers to use new LGPL header instead of LGPL21 one (in those files which will be under LGPL v3) Change-Id: I046ec3e47b1876cd7b4b0353a576b352e3a946d9 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* Add ability to specify precision of float/double currency stringsDan Cape2016-01-131-3/+11
| | | | | | | | | | | | | | | Added a new overload function that allows the developer to specify the desired precision. Until 6.0, it will require the symbol and precision to be passed to it. Once Qt is at version 6.0, it will replace the overload function that requires a value and optionally a symbol. [ChangeLog][QtCore][QLocale] Added an overload for toCurrencyString() that allows the decimal precision to be specified. Change-Id: I1fb7dde3583f46de2ed20ec2a7abaeca23a903ef Task-number: QTBUG-46595 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Mark QLocale as sharedMarc Mutz2016-01-121-2/+6
| | | | | | | | It was already movable, so it's BC. Only needed to add nothrow member-swap and nothrow move assignment. Change-Id: Iefedb877078da8ee075eb67185eef221143ddec1 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Add flags to omit/reject padding in scientific notation exponentsUlf Hermann2015-11-231-1/+4
| | | | | | | | | | | | | | The EcmaScript format for printing doubles in exponent form differs from Qt's format only in this aspect. EcmaScript explicitly prohibits leading zeroes in exponents. It is thus worthwhile to add those flags in order to be able to generate and parse doubles in compliance with EcmaScript. [ChangeLog][QtCore][QLocale] Additional flags in QLocale::NumberOption allow generating and parsing doubles in EcmaScript compliant format. Change-Id: Ia7b82c2e67bb8b80bd890014ff5cd4563faf2a03 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* Interpret precision == -128 as "shortest" double conversionUlf Hermann2015-11-231-0/+4
| | | | | | | | | | | | Also use this for converting doubles with QVariant. We generally want exact results there, rather than adding rounding errors whenever we convert. [ChangeLog][QtCore][QLocale] Added special value for double conversion precision to get shortest accurate representation. Change-Id: I905b8a103f39adf31d24b6ce2c8a283cf271b597 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* QLocale: Add Q_ENUM for QLocale::ScriptThiago Macieira2015-10-281-0/+1
| | | | | Change-Id: I7e6338336dd6468ead24ffff141129d557330f00 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* QtCore: Use Q_NULLPTR instead of 0 in all public headersMarc Mutz2015-07-011-16/+16
| | | | | | | | | This is in preparation of adding -Wzero-as-null-pointer-constant (or similar) to the headers check. Task-number: QTBUG-45291 Change-Id: I0cc388ef9faf45cbcf425ad0dc77db3060c104a8 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Add qHash(QLocale)Marc Mutz2015-06-301-0/+5
| | | | | | | | | | | QLocales can be compared for equality, so qHash should be overloaded, too. [ChangeLog][QtCore][QLocale] Added qHash(QLocale). Change-Id: Ia0fdf1207b842b9bb20b8f9ab0165016915debf4 Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Update CLDR to v27Konstantin Ritt2015-03-271-2/+50
| | | | | | | | | | | | | + A bunch of fixes in the locale data + New scripts from Unicode 7.0 + New locales - Some locales disappeared (aa_DJ, aa_ER, st_LS, ss_SZ, swc_CD, tn_BW) - Some locales lost their contents (i.e. en_Dsrt_US) [ChangeLog][QtCore] QLocale data updated to CLDR v.27 Change-Id: Iba8c7884f8087e577cbb25a8fc106dd7bd3ebb5d Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Update copyright headersJani Heikkinen2015-02-111-7/+7
| | | | | | | | | | | | | | | | | | Qt copyrights are now in The Qt Company, so we could update the source code headers accordingly. In the same go we should also fix the links to point to qt.io. Outdated header.LGPL removed (use header.LGPL21 instead) Old header.LGPL3 renamed to header.LGPL3-COMM to match actual licensing combination. New header.LGPL-COMM taken in the use file which were using old header.LGPL3 (src/plugins/platforms/android/extract.cpp) Added new header.LGPL3 containing Commercial + LGPLv3 + GPLv2 license combination Change-Id: I6f49b819a8a20cc4f88b794a8f6726d975e8ffbe Reviewed-by: Matti Paaso <matti.paaso@theqtcompany.com>
* Use Q_ENUM and Q_FLAG for types in QtCoreOlivier Goffart2015-02-041-3/+4
| | | | | | Change-Id: I33590a9c4c6d87c5bbba1d201e32c6bf1bd3e00b Reviewed-by: Lars Knoll <lars.knoll@digia.com> Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* Update license headers and add new license filesMatti Paaso2014-09-241-19/+11
| | | | | | | | | - Renamed LICENSE.LGPL to LICENSE.LGPLv21 - Added LICENSE.LGPLv3 - Removed LICENSE.GPL Change-Id: Iec3406e3eb3f133be549092015cefe33d259a3f2 Reviewed-by: Iikka Eklund <iikka.eklund@digia.com>
* Update the internal CLDR tables up to v.24Konstantin Ritt2014-01-131-1/+4
| | | | | | | Change-Id: I9c0b110e36dd80c6a0b7275aa13bc548419aca9c Reviewed-by: Lars Knoll <lars.knoll@digia.com> Reviewed-by: John Layt <jlayt@kde.org> Reviewed-by: Mehdi Fekari <mfekari@blackberry.com>
* Update QLocale locale database up to CLDR 23.1Konstantin Ritt2013-08-121-1/+2
| | | | | | | This only added Kosovo [XK] territory and few valid locales for it. Change-Id: Ia0b47041ed5cd1303b5bc233f2502a3725c74da9 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Update QLocale data to CLDRv23Konstantin Ritt2013-04-011-1/+3
| | | | | | | | Say hello to Interlingua and Mongolian once again. Change-Id: I735fbc5793f34620be1f6932a251224b9ded02e3 Reviewed-by: Denis Dzyubenko <denis@ddenis.info> Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* QLocale: Add some more languages and scriptsKonstantin Ritt2013-03-051-3/+122
| | | | | Change-Id: Iab23128c1567974154cdcce7412b2e1468bb8462 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* QLocale: Added QStringRef overloads to toInt(), toUInt(), etc...Keith Gardner2013-02-181-0/+10
| | | | | | | | | | Added the following function overloads to QLocale: toShort, toUShort, toInt, toUInt, toLong, toULong, toLongLong, toULongLong, toFloat, and toDouble. Change-Id: I8cd90ca08b88338b08a73a72492f4c91c4f46ea4 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Remove QT_{BEGIN,END}_HEADER macro usageSergio Ahumada2013-01-291-4/+0
| | | | | | | | | | | The macro was made empty in ba3dc5f3b56d1fab6fe37fe7ae08096d7dc68bcb and is no longer necessary or used. Discussed-on: http://lists.qt-project.org/pipermail/development/2013-January/009284.html Change-Id: Id2bb2e2cabde059305d4af5f12593344ba30f001 Reviewed-by: Laszlo Papp <lpapp@kde.org> Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com> Reviewed-by: hjk <hjk121@nokiamail.com>
* Update copyright year in Digia's license headersSergio Ahumada2013-01-181-1/+1
| | | | | Change-Id: Ic804938fc352291d011800d21e549c10acac66fb Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Add a Q_ENUMS for MeasurementSystemmfekari2012-12-171-0/+1
| | | | | | Change-Id: Ib60de407f7ec8df907884ad2cf2fbf8e7b2c02f4 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
* [SIC] QLocale: Update some language names with their modern valuesKonstantin Ritt2012-11-241-9/+11
| | | | | | | | Some of them were incorrectly spelled (for a while) Change-Id: I871968e3bbdd2172f4c4dfb6e74729c05e7e8e01 Reviewed-by: Lars Knoll <lars.knoll@digia.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Update Qlocale data up to CLDR 22.1Konstantin Ritt2012-11-211-4/+14
| | | | | Change-Id: Ie6ddfec14cb052e0b89230dc93290ff79488fb25 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Update Qlocale data up to CLDR 2.0.1Konstantin Ritt2012-11-211-1/+19
| | | | | Change-Id: I4279fac57436d7009a6d61dab5936b72fd39fc14 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* [SIC/BIC] QLocale: update enums up to CLRD 1.9.1Konstantin Ritt2012-11-211-38/+81
| | | | | | | | | | This patch adds some missing codes (two-letter ones only), removes an outdated ones, and updates some names. The legacy language codes are handled in QLocalePrivate::codeToLanguage() (fortunately, there are only 4 of such codes). Change-Id: Iff50aecd1c762b6399cd151aebb955f341d366c6 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Add a bunch of missed scriptsKonstantin Ritt2012-11-151-1/+26
| | | | | Change-Id: I078bf95cb50c7ef634f9f3133ab9f9d25439e4ef Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Add missing Bodo language introduced in CLDR 1.9.1Konstantin Ritt2012-11-151-1/+2
| | | | | Change-Id: I4feb6ba781299d65ff3bf2717f08a0ac7eae7928 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Change copyrights from Nokia to DigiaIikka Eklund2012-09-221-24/+24
| | | | | | | | Change copyrights and license headers from Nokia to Digia Change-Id: If1cc974286d29fd01ec6c19dd4719a67f4c3f00e Reviewed-by: Lars Knoll <lars.knoll@digia.com> Reviewed-by: Sergio Ahumada <sergio.ahumada@digia.com>
* Refactor the ICU code for QLocaleLars Knoll2012-06-101-0/+1
| | | | | | | | | | | | | | | | | Clean up the ICU code and make it thread-safe. Add a QIcuData structure to QLocalePrivate, that contains ICU specific data. Link against ICU directly, greatly simplifying the code. Also fix a bug in the locale specific case conversion code that would cause it to fail and fall back to the QString code if the output string was larger than the input. Change-Id: Ie67e5ea14fa204ebc5887d7aaeb1a4f3ecaf8697 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QLocale: Clean up QLocalePrivate implementationJohn Layt2012-04-241-15/+6
| | | | | | | | | | | | | | In Qt4 QLocalePrivate is a struct returned by a d() method. This will be unsuitable for the planned change to use ICU and may cause BIC issues. This change makes QLocalePrivate a class and creates a new struct QLocaleData to hold the data index. Further clean-ups are possible but are left for later. Change-Id: Ie316a07790f74674a3b520b735dff72695cc4060 Reviewed-by: Lars Knoll <lars.knoll@nokia.com> Reviewed-by: Jason McDonald <jason.mcdonald@nokia.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Make QLocale::toULongLong return the proper type: qulonglongThiago Macieira2012-04-051-1/+1
| | | | | | | | Task-number: QTBUG-25143 Change-Id: Ia8fd588c25d11fe31acd57fd34a90d51dace248c Reviewed-by: Giuseppe D'Angelo <dangelog@gmail.com> Reviewed-by: João Abecasis <joao.abecasis@nokia.com> Reviewed-by: John Layt <jlayt@kde.org>