PySide6.QtCore.QLocale¶
- class QLocale¶
- The - QLocaleclass converts between numbers and their string representations in various languages. More…- Synopsis¶- Methods¶- def - __init__()
- def - amText()
- def - bcp47Name()
- def - collation()
- def - country()
- def - currencySymbol()
- def - dateFormat()
- def - dateTimeFormat()
- def - dayName()
- def - decimalPoint()
- def - exponential()
- def - firstDayOfWeek()
- def - groupSeparator()
- def - language()
- def - monthName()
- def - name()
- def - negativeSign()
- def - numberOptions()
- def - __ne__()
- def - __eq__()
- def - percent()
- def - pmText()
- def - positiveSign()
- def - quoteString()
- def - script()
- def - swap()
- def - territory()
- def - textDirection()
- def - timeFormat()
- def - toDate()
- def - toDateTime()
- def - toDouble()
- def - toFloat()
- def - toInt()
- def - toLong()
- def - toLongLong()
- def - toLower()
- def - toShort()
- def - toString()
- def - toTime()
- def - toUInt()
- def - toULong()
- def - toULongLong()
- def - toUShort()
- def - toUpper()
- def - uiLanguages()
- def - weekdays()
- def - zeroDigit()
 - Static functions¶- def - c()
- def - codeToCountry()
- def - codeToLanguage()
- def - codeToScript()
- def - countryToCode()
- def - languageToCode()
- def - scriptToCode()
- def - scriptToString()
- def - setDefault()
- def - system()
 - Note - This documentation may contain snippets that were automatically translated from C++ to Python. We always welcome contributions to the snippet translation. If you see an issue with the translation, you can also let us know by creating a ticket on https:/bugreports.qt.io/projects/PYSIDE - Detailed Description¶- Warning - This section contains snippets that were automatically translated from C++ to Python and may contain errors. - QLocaleis constructed for a specified language, optional script and territory. It offers various facilities for formatting data as text, localized appropriately, and for reading data out of localized text.- Example: - egyptian = QLocale(QLocale.Arabic, QLocale.Egypt) s1 = egyptian.toString(1.571429E+07, 'e') s2 = egyptian.toString(10) d = egyptian.toDouble(s1) i = egyptian.toInt(s2) - QLocalesupports the concept of a default locale, which is determined from the system’s locale settings at application startup. The default locale can be changed by calling the static member- setDefault(). Setting the default locale has the following effects:- If a - QLocaleobject is constructed with the default constructor, it will use the default locale’s settings.
- arg()uses the default locale to format a number when its position specifier in the format string contains an ‘L’, e.g. “%L1”.
 - The following example illustrates how to use - QLocaledirectly:- ok = bool() d = float() QLocale.setDefault(QLocale.C) # uses '.' as a decimal point QLocale cLocale # default-constructed C locale d = cLocale.toDouble("1234,56", ok) # ok == false, d == 0 d = cLocale.toDouble("1234.56", ok) # ok == true, d == 1234.56 QLocale.setDefault(QLocale.German) # uses ',' as a decimal point QLocale german # default-constructed German locale d = german.toDouble("1234,56", ok) # ok == true, d == 1234.56 d = german.toDouble("1234.56", ok) # ok == false, d == 0 QLocale.setDefault(QLocale.English) # Default locale now uses ',' as a group separator. str = QString("%1 %L2 %L3").arg(12345).arg(12345).arg(12345, 0, 16) # str == "12345 12,345 3039" - An alternative method for constructing a - QLocaleobject is by specifying the locale name.- korean = QLocale("ko") swiss = QLocale("de_CH") - This constructor reads the language, script and/or territory from the given name, accepting either uderscore or dash as separator (and ignoring any trailing - .codesetor- @variantsuffix).- Note - For the current keyboard input locale take a look at QInputMethod::locale(). - Appropriateness of the formats¶- QLocale‘s data is based on Common Locale Data Repository v47.- This data is published by The Unicode Consortium, who aim to follow customary, common use by writers of each language, in each script, in each territory for which data is given. This may in some cases differ from what is recognized as official, depending on how widely that official standard is followed in practice. - For example, although the relevant international standard (from the BIPM) mandates a thin non-breaking space as the separator between groups of digits in numbers, when they are split up to aid readability, and many jurisdictions have adopted this as their official standard for the formatting of numbers, many locales in fact have a traditional way of formatting numbers with punctuators separating groups of digits. CLDR, and thus - QLocale, follows this common usage rather than the official standard.- Matching combinations of language, script and territory¶- QLocalehas data, derived from CLDR, for many combinations of language, script and territory, but not all. If it is constructed with all three of these key values specified (treating- AnyLanguage,- AnyScriptor- AnyTerritoryas unspecified) and- QLocalehas data for the given combination, this data is used. Otherwise,- QLocaledoes its best to find a sensible combination of language, script and territory, for which it does have data, that matches those that were specified.- The CLDR provides tables of likely combinations, which are used to fill in any unspecified key or keys; if - QLocalehas data for the result of such a likely combination, that is used. If no language is specified, and none can be determined from script and territory, or if- QLocalehas no data for the language, the “C” locale (when reading the keys from a string) or default locale (otherwise) is used.- When - QLocalehas no data for the keys specified, with likely keys filled in where unspecified, but does have data for the resulting language, a fall-back is sought, based on ignoring either territory, script or both (in that order). This results in a- QLocalewhich may not match what was asked for, but provides localization that’s as suitable as the available data permits, for the keys specified.- Use - language(),- script()and- territory()to determine the actual keys used.- See also - arg()- locale()- class Language¶
- This enumerated type is used to specify a language. - Constant - Description - QLocale.Language.AnyLanguage - QLocale.Language.C - A simplified English locale; see - c()- QLocale.Language.Abkhazian - QLocale.Language.Afan - Obsolete, please use Oromo - QLocale.Language.Afar - QLocale.Language.Afrikaans - QLocale.Language.Aghem - QLocale.Language.Akan - QLocale.Language.Akkadian - QLocale.Language.Akoose - QLocale.Language.Albanian - QLocale.Language.AmericanSignLanguage - QLocale.Language.Amharic - QLocale.Language.AncientEgyptian - QLocale.Language.AncientGreek - QLocale.Language.Anii - QLocale.Language.Arabic - QLocale.Language.Aragonese - QLocale.Language.Aramaic - QLocale.Language.Armenian - QLocale.Language.Assamese - QLocale.Language.Asturian - QLocale.Language.Asu - QLocale.Language.Atsam - QLocale.Language.Avaric - QLocale.Language.Avestan - QLocale.Language.Aymara - QLocale.Language.Azerbaijani - QLocale.Language.Bafia - QLocale.Language.Balinese - QLocale.Language.Baluchi - QLocale.Language.Bambara - QLocale.Language.Bamun - QLocale.Language.Bangla - QLocale.Language.Basaa - QLocale.Language.Bashkir - QLocale.Language.Basque - QLocale.Language.BatakToba - QLocale.Language.Belarusian - QLocale.Language.Bemba - QLocale.Language.Bena - QLocale.Language.Bengali - Obsolete, please use Bangla - QLocale.Language.Bhojpuri - QLocale.Language.Bhutani - Obsolete, please use Dzongkha - QLocale.Language.Bislama - QLocale.Language.Blin - QLocale.Language.Bodo - QLocale.Language.Bosnian - QLocale.Language.Breton - QLocale.Language.Buginese - QLocale.Language.Bulgarian - QLocale.Language.Burmese - QLocale.Language.Byelorussian - Obsolete, please use Belarusian - QLocale.Language.Cambodian - Obsolete, please use Khmer - QLocale.Language.Cantonese - QLocale.Language.Catalan - QLocale.Language.Cebuano - QLocale.Language.CentralAtlasTamazight - QLocale.Language.CentralKurdish - QLocale.Language.CentralMoroccoTamazight - Obsolete, please use CentralAtlasTamazight - QLocale.Language.Chakma - QLocale.Language.Chamorro - QLocale.Language.Chechen - QLocale.Language.Cherokee - QLocale.Language.Chewa - Obsolete, please use Nyanja - QLocale.Language.Chickasaw - QLocale.Language.Chiga - QLocale.Language.Chinese - (Mandarin) - QLocale.Language.Church - QLocale.Language.Chuvash - QLocale.Language.Colognian - QLocale.Language.Coptic - QLocale.Language.Cornish - QLocale.Language.Corsican - QLocale.Language.Cree - QLocale.Language.Croatian - QLocale.Language.Czech - QLocale.Language.Danish - QLocale.Language.Divehi - QLocale.Language.Dogri - QLocale.Language.Duala - QLocale.Language.Dutch - QLocale.Language.Dzongkha - QLocale.Language.Embu - QLocale.Language.English - QLocale.Language.Erzya - QLocale.Language.Esperanto - QLocale.Language.Estonian - QLocale.Language.Ewe - QLocale.Language.Ewondo - QLocale.Language.Faroese - QLocale.Language.Fijian - QLocale.Language.Filipino - QLocale.Language.Finnish - QLocale.Language.French - QLocale.Language.Frisian - same as WesternFrisian - QLocale.Language.Friulian - QLocale.Language.Fulah - QLocale.Language.Ga - QLocale.Language.Gaelic - QLocale.Language.Galician - QLocale.Language.Ganda - QLocale.Language.Geez - QLocale.Language.Georgian - QLocale.Language.German - QLocale.Language.Gothic - QLocale.Language.Greek - QLocale.Language.Greenlandic - Obsolete, please use Kalaallisut - QLocale.Language.Guarani - QLocale.Language.Gujarati - QLocale.Language.Gusii - QLocale.Language.Haitian - QLocale.Language.Haryanvi - QLocale.Language.Hausa - QLocale.Language.Hawaiian - QLocale.Language.Hebrew - QLocale.Language.Herero - QLocale.Language.Hindi - QLocale.Language.HiriMotu - QLocale.Language.Hungarian - QLocale.Language.Icelandic - QLocale.Language.Ido - QLocale.Language.Igbo - QLocale.Language.InariSami - QLocale.Language.Indonesian - QLocale.Language.Ingush - QLocale.Language.Interlingua - QLocale.Language.Interlingue - QLocale.Language.Inuktitut - QLocale.Language.Inupiak - Obsolete, please use Inupiaq - QLocale.Language.Inupiaq - QLocale.Language.Irish - QLocale.Language.Italian - QLocale.Language.Japanese - QLocale.Language.Javanese - QLocale.Language.Jju - QLocale.Language.JolaFonyi - QLocale.Language.Kabuverdianu - QLocale.Language.Kabyle - QLocale.Language.Kaingang - QLocale.Language.Kako - QLocale.Language.Kalaallisut - QLocale.Language.Kalenjin - QLocale.Language.Kamba - QLocale.Language.Kangri - QLocale.Language.Kannada - QLocale.Language.Kanuri - QLocale.Language.KaraKalpak - QLocale.Language.Kashmiri - QLocale.Language.Kazakh - QLocale.Language.Kenyang - QLocale.Language.Khmer - QLocale.Language.Kiche - QLocale.Language.Kikuyu - QLocale.Language.Kinyarwanda - QLocale.Language.Kirghiz - Obsolete, please use Kyrgyz - QLocale.Language.Komi - QLocale.Language.Kongo - QLocale.Language.Konkani - QLocale.Language.Korean - QLocale.Language.Koro - QLocale.Language.KoyraboroSenni - QLocale.Language.KoyraChiini - QLocale.Language.Kpelle - QLocale.Language.Kuanyama - QLocale.Language.Kurdish - QLocale.Language.Kurundi - Obsolete, please use Rundi - QLocale.Language.Kuvi - QLocale.Language.Kwanyama - Obsolete, please use Kuanyama - QLocale.Language.Kwasio - QLocale.Language.Kyrgyz - QLocale.Language.Lakota - QLocale.Language.Langi - QLocale.Language.Lao - QLocale.Language.Latin - QLocale.Language.Latvian - QLocale.Language.Lezghian - QLocale.Language.Limburgish - QLocale.Language.Lingala - QLocale.Language.Ligurian - QLocale.Language.LiteraryChinese - QLocale.Language.Lithuanian - QLocale.Language.Lojban - QLocale.Language.LowerSorbian - QLocale.Language.LowGerman - QLocale.Language.LubaKatanga - QLocale.Language.LuleSami - QLocale.Language.Luo - QLocale.Language.Luxembourgish - QLocale.Language.Luyia - QLocale.Language.Macedonian - QLocale.Language.Machame - QLocale.Language.Maithili - QLocale.Language.MakhuwaMeetto - QLocale.Language.Makonde - QLocale.Language.Malagasy - QLocale.Language.Malay - QLocale.Language.Malayalam - QLocale.Language.Maltese - QLocale.Language.Mandingo - QLocale.Language.Manipuri - QLocale.Language.Manx - QLocale.Language.Maori - QLocale.Language.Mapuche - QLocale.Language.Marathi - QLocale.Language.Marshallese - QLocale.Language.Masai - QLocale.Language.Mazanderani - QLocale.Language.Mende - QLocale.Language.Meru - QLocale.Language.Meta - QLocale.Language.Mohawk - QLocale.Language.Moksha - QLocale.Language.Mongolian - QLocale.Language.Morisyen - QLocale.Language.Mundang - QLocale.Language.Muscogee - QLocale.Language.Nama - QLocale.Language.NauruLanguage - QLocale.Language.Navaho - Obsolete, please use Navajo - QLocale.Language.Navajo - QLocale.Language.Ndonga - QLocale.Language.Nepali - QLocale.Language.Newari - QLocale.Language.Ngiemboon - QLocale.Language.Nheengatu - QLocale.Language.NigerianPidgin - QLocale.Language.Ngomba - QLocale.Language.Nko - QLocale.Language.NorthernFrisian - QLocale.Language.NorthernLuri - QLocale.Language.NorthernSami - QLocale.Language.NorthernSotho - QLocale.Language.NorthNdebele - QLocale.Language.NorwegianBokmal - QLocale.Language.NorwegianNynorsk - QLocale.Language.Nuer - QLocale.Language.Nyanja - QLocale.Language.Nyankole - QLocale.Language.Obolo - QLocale.Language.Occitan - QLocale.Language.Odia - QLocale.Language.Ojibwa - QLocale.Language.OldIrish - QLocale.Language.OldNorse - QLocale.Language.OldPersian - QLocale.Language.Oriya - Obsolete, please use Odia - QLocale.Language.Oromo - QLocale.Language.Osage - QLocale.Language.Ossetic - QLocale.Language.Pahlavi - QLocale.Language.Palauan - QLocale.Language.Pali - QLocale.Language.Papiamento - QLocale.Language.Pashto - QLocale.Language.Persian - QLocale.Language.Phoenician - QLocale.Language.Pijin - QLocale.Language.Polish - QLocale.Language.Portuguese - QLocale.Language.Prussian - QLocale.Language.Punjabi - QLocale.Language.Quechua - QLocale.Language.Rajasthani - QLocale.Language.RhaetoRomance - Obsolete, please use Romansh - QLocale.Language.Rohingya - QLocale.Language.Romanian - QLocale.Language.Romansh - QLocale.Language.Rombo - QLocale.Language.Rundi - QLocale.Language.Russian - QLocale.Language.Rwa - QLocale.Language.Saho - QLocale.Language.Sakha - QLocale.Language.Samburu - QLocale.Language.Samoan - QLocale.Language.Sango - QLocale.Language.Sangu - QLocale.Language.Sanskrit - QLocale.Language.Santali - QLocale.Language.Sardinian - QLocale.Language.Saurashtra - QLocale.Language.Sena - QLocale.Language.Serbian - QLocale.Language.Shambala - QLocale.Language.Shona - QLocale.Language.SichuanYi - QLocale.Language.Sicilian - QLocale.Language.Sidamo - QLocale.Language.Silesian - QLocale.Language.Sindhi - QLocale.Language.Sinhala - QLocale.Language.SkoltSami - QLocale.Language.Slovak - QLocale.Language.Slovenian - QLocale.Language.Soga - QLocale.Language.Somali - QLocale.Language.SouthernKurdish - QLocale.Language.SouthernSami - QLocale.Language.SouthernSotho - QLocale.Language.SouthNdebele - QLocale.Language.Spanish - QLocale.Language.StandardMoroccanTamazight - QLocale.Language.Sundanese - QLocale.Language.Swahili - QLocale.Language.SwampyCree - QLocale.Language.Swati - QLocale.Language.Swedish - QLocale.Language.SwissGerman - QLocale.Language.Syriac - QLocale.Language.Tachelhit - QLocale.Language.Tahitian - QLocale.Language.TaiDam - QLocale.Language.Taita - QLocale.Language.Tajik - QLocale.Language.Tamil - QLocale.Language.Taroko - QLocale.Language.Tasawaq - QLocale.Language.Tatar - QLocale.Language.Telugu - QLocale.Language.Teso - QLocale.Language.Thai - QLocale.Language.Tibetan - QLocale.Language.Tigre - QLocale.Language.Tigrinya - QLocale.Language.TokelauLanguage - QLocale.Language.TokiPona - QLocale.Language.TokPisin - QLocale.Language.Tongan - QLocale.Language.Torwali - QLocale.Language.Tsonga - QLocale.Language.Tswana - QLocale.Language.Turkish - QLocale.Language.Turkmen - QLocale.Language.TuvaluLanguage - QLocale.Language.Tyap - QLocale.Language.Ugaritic - QLocale.Language.Uighur - Obsolete, please use Uyghur - QLocale.Language.Uigur - Obsolete, please use Uyghur - QLocale.Language.Ukrainian - QLocale.Language.UpperSorbian - QLocale.Language.Urdu - QLocale.Language.Uyghur - QLocale.Language.Uzbek - QLocale.Language.Vai - QLocale.Language.Venda - QLocale.Language.Venetian - QLocale.Language.Vietnamese - QLocale.Language.Volapuk - QLocale.Language.Vunjo - QLocale.Language.Walamo - Obsolete, please use Wolaytta - QLocale.Language.Walloon - QLocale.Language.Walser - QLocale.Language.Warlpiri - QLocale.Language.Welsh - QLocale.Language.WesternBalochi - QLocale.Language.WesternFrisian - same as Frisian - QLocale.Language.Wolaytta - QLocale.Language.Wolof - QLocale.Language.Xhosa - QLocale.Language.Yangben - QLocale.Language.Yiddish - QLocale.Language.Yoruba - QLocale.Language.Zarma - QLocale.Language.Zhuang - QLocale.Language.Zulu - See also 
 - class Script¶
- This enumerated type is used to specify a script. - Constant - Description - QLocale.Script.AnyScript - QLocale.Script.AdlamScript - QLocale.Script.AhomScript - QLocale.Script.AnatolianHieroglyphsScript - QLocale.Script.ArabicScript - QLocale.Script.ArmenianScript - QLocale.Script.AvestanScript - QLocale.Script.BalineseScript - QLocale.Script.BamumScript - QLocale.Script.BanglaScript - QLocale.Script.BassaVahScript - QLocale.Script.BatakScript - QLocale.Script.BengaliScript - Obsolete, please use BanglaScript - QLocale.Script.BhaiksukiScript - QLocale.Script.BopomofoScript - QLocale.Script.BrahmiScript - QLocale.Script.BrailleScript - QLocale.Script.BugineseScript - QLocale.Script.BuhidScript - QLocale.Script.CanadianAboriginalScript - QLocale.Script.CarianScript - QLocale.Script.CaucasianAlbanianScript - QLocale.Script.ChakmaScript - QLocale.Script.ChamScript - QLocale.Script.CherokeeScript - QLocale.Script.CopticScript - QLocale.Script.CuneiformScript - QLocale.Script.CypriotScript - QLocale.Script.CyrillicScript - QLocale.Script.DeseretScript - QLocale.Script.DevanagariScript - QLocale.Script.DuployanScript - QLocale.Script.EgyptianHieroglyphsScript - QLocale.Script.ElbasanScript - QLocale.Script.EthiopicScript - QLocale.Script.FraserScript - QLocale.Script.GeorgianScript - QLocale.Script.GlagoliticScript - QLocale.Script.GothicScript - QLocale.Script.GranthaScript - QLocale.Script.GreekScript - QLocale.Script.GujaratiScript - QLocale.Script.GurmukhiScript - QLocale.Script.HangulScript - QLocale.Script.HanifiScript - QLocale.Script.HanScript - QLocale.Script.HanunooScript - QLocale.Script.HanWithBopomofoScript - QLocale.Script.HatranScript - QLocale.Script.HebrewScript - QLocale.Script.HiraganaScript - QLocale.Script.ImperialAramaicScript - QLocale.Script.InscriptionalPahlaviScript - QLocale.Script.InscriptionalParthianScript - QLocale.Script.JamoScript - QLocale.Script.JapaneseScript - QLocale.Script.JavaneseScript - QLocale.Script.KaithiScript - QLocale.Script.KannadaScript - QLocale.Script.KatakanaScript - QLocale.Script.KayahLiScript - QLocale.Script.KharoshthiScript - QLocale.Script.KhmerScript - QLocale.Script.KhojkiScript - QLocale.Script.KhudawadiScript - QLocale.Script.KoreanScript - QLocale.Script.LannaScript - QLocale.Script.LaoScript - QLocale.Script.LatinScript - QLocale.Script.LepchaScript - QLocale.Script.LimbuScript - QLocale.Script.LinearAScript - QLocale.Script.LinearBScript - QLocale.Script.LycianScript - QLocale.Script.LydianScript - QLocale.Script.MahajaniScript - QLocale.Script.MalayalamScript - QLocale.Script.MandaeanScript - QLocale.Script.ManichaeanScript - QLocale.Script.MarchenScript - QLocale.Script.MeiteiMayekScript - QLocale.Script.MendeScript - QLocale.Script.MendeKikakuiScript - Obsolete, please use MendeScript - QLocale.Script.MeroiticCursiveScript - QLocale.Script.MeroiticScript - QLocale.Script.ModiScript - QLocale.Script.MongolianScript - QLocale.Script.MroScript - QLocale.Script.MultaniScript - QLocale.Script.MyanmarScript - QLocale.Script.NabataeanScript - QLocale.Script.NewaScript - QLocale.Script.NewTaiLueScript - QLocale.Script.NkoScript - QLocale.Script.OghamScript - QLocale.Script.OlChikiScript - QLocale.Script.OldHungarianScript - QLocale.Script.OldItalicScript - QLocale.Script.OldNorthArabianScript - QLocale.Script.OldPermicScript - QLocale.Script.OldPersianScript - QLocale.Script.OldSouthArabianScript - QLocale.Script.OdiaScript - QLocale.Script.OriyaScript - Obsolete, please use OdiaScript - QLocale.Script.OrkhonScript - QLocale.Script.OsageScript - QLocale.Script.OsmanyaScript - QLocale.Script.PahawhHmongScript - QLocale.Script.PalmyreneScript - QLocale.Script.PauCinHauScript - QLocale.Script.PhagsPaScript - QLocale.Script.PhoenicianScript - QLocale.Script.PollardPhoneticScript - QLocale.Script.PsalterPahlaviScript - QLocale.Script.RejangScript - QLocale.Script.RunicScript - QLocale.Script.SamaritanScript - QLocale.Script.SaurashtraScript - QLocale.Script.SharadaScript - QLocale.Script.ShavianScript - QLocale.Script.SiddhamScript - QLocale.Script.SignWritingScript - QLocale.Script.SimplifiedChineseScript - same as SimplifiedHanScript - QLocale.Script.SimplifiedHanScript - same as SimplifiedChineseScript - QLocale.Script.SinhalaScript - QLocale.Script.SoraSompengScript - QLocale.Script.SundaneseScript - QLocale.Script.SylotiNagriScript - QLocale.Script.SyriacScript - QLocale.Script.TagalogScript - QLocale.Script.TagbanwaScript - QLocale.Script.TaiLeScript - QLocale.Script.TaiVietScript - QLocale.Script.TakriScript - QLocale.Script.TamilScript - QLocale.Script.TangutScript - QLocale.Script.TeluguScript - QLocale.Script.ThaanaScript - QLocale.Script.ThaiScript - QLocale.Script.TibetanScript - QLocale.Script.TifinaghScript - QLocale.Script.TirhutaScript - QLocale.Script.TraditionalChineseScript - same as TraditionalHanScript - QLocale.Script.TraditionalHanScript - same as TraditionalChineseScript - QLocale.Script.UgariticScript - QLocale.Script.VaiScript - QLocale.Script.VarangKshitiScript - QLocale.Script.YiScript - See also 
 - class Country¶
- This enumerated type is used to identify a territory. - An individual territory may be a province of a country, a country (by far the most common case) or a larger geographic entity, to which some localization details are specific. - Constant - Description - QLocale.Country.AnyCountry - Osbolete alias for - AnyTerritory- QLocale.Country.AnyTerritory - QLocale.Country.Afghanistan - QLocale.Country.AlandIslands - QLocale.Country.Albania - QLocale.Country.Algeria - QLocale.Country.AmericanSamoa - QLocale.Country.Andorra - QLocale.Country.Angola - QLocale.Country.Anguilla - QLocale.Country.Antarctica - QLocale.Country.AntiguaAndBarbuda - QLocale.Country.Argentina - QLocale.Country.Armenia - QLocale.Country.Aruba - QLocale.Country.AscensionIsland - QLocale.Country.Australia - QLocale.Country.Austria - QLocale.Country.Azerbaijan - QLocale.Country.Bahamas - QLocale.Country.Bahrain - QLocale.Country.Bangladesh - QLocale.Country.Barbados - QLocale.Country.Belarus - QLocale.Country.Belgium - QLocale.Country.Belize - QLocale.Country.Benin - QLocale.Country.Bermuda - QLocale.Country.Bhutan - QLocale.Country.Bolivia - QLocale.Country.Bonaire - QLocale.Country.BosniaAndHerzegowina - Obsolete, use - BosniaAndHerzegovinainstead- QLocale.Country.BosniaAndHerzegovina - QLocale.Country.Botswana - QLocale.Country.BouvetIsland - QLocale.Country.Brazil - QLocale.Country.BritishIndianOceanTerritory - QLocale.Country.BritishVirginIslands - QLocale.Country.Brunei - QLocale.Country.Bulgaria - QLocale.Country.BurkinaFaso - QLocale.Country.Burundi - QLocale.Country.Cambodia - QLocale.Country.Cameroon - QLocale.Country.Canada - QLocale.Country.CanaryIslands - QLocale.Country.CaribbeanNetherlands - QLocale.Country.CapeVerde - QLocale.Country.CaymanIslands - QLocale.Country.CentralAfricanRepublic - QLocale.Country.CeutaAndMelilla - QLocale.Country.Chad - QLocale.Country.Chile - QLocale.Country.China - QLocale.Country.ChristmasIsland - QLocale.Country.ClippertonIsland - QLocale.Country.CocosIslands - QLocale.Country.Colombia - QLocale.Country.Comoros - QLocale.Country.CongoBrazzaville - QLocale.Country.CongoKinshasa - QLocale.Country.CookIslands - QLocale.Country.CostaRica - QLocale.Country.Croatia - QLocale.Country.Cuba - QLocale.Country.Curacao - QLocale.Country.CuraSao - Obsolete, use - Curacaoinstead- QLocale.Country.Cyprus - QLocale.Country.Czechia - QLocale.Country.CzechRepublic - Obsolete, use - Czechiainstead- QLocale.Country.DemocraticRepublicOfCongo - Obsolete, use - CongoKinshasainstead- QLocale.Country.DemocraticRepublicOfKorea - Obsolete, use - NorthKoreainstead- QLocale.Country.Denmark - QLocale.Country.DiegoGarcia - QLocale.Country.Djibouti - QLocale.Country.Dominica - QLocale.Country.DominicanRepublic - QLocale.Country.EastTimor - QLocale.Country.Ecuador - QLocale.Country.Egypt - QLocale.Country.ElSalvador - QLocale.Country.EquatorialGuinea - QLocale.Country.Eritrea - QLocale.Country.Estonia - QLocale.Country.Eswatini - QLocale.Country.Ethiopia - QLocale.Country.EuropeanUnion - QLocale.Country.Europe - QLocale.Country.FalklandIslands - QLocale.Country.FaroeIslands - QLocale.Country.Fiji - QLocale.Country.Finland - QLocale.Country.France - QLocale.Country.FrenchGuiana - QLocale.Country.FrenchPolynesia - QLocale.Country.FrenchSouthernTerritories - QLocale.Country.Gabon - QLocale.Country.Gambia - QLocale.Country.Georgia - QLocale.Country.Germany - QLocale.Country.Ghana - QLocale.Country.Gibraltar - QLocale.Country.Greece - QLocale.Country.Greenland - QLocale.Country.Grenada - QLocale.Country.Guadeloupe - QLocale.Country.Guam - QLocale.Country.Guatemala - QLocale.Country.Guernsey - QLocale.Country.Guinea - QLocale.Country.GuineaBissau - QLocale.Country.Guyana - QLocale.Country.Haiti - QLocale.Country.HeardAndMcDonaldIslands - QLocale.Country.Honduras - QLocale.Country.HongKong - QLocale.Country.Hungary - QLocale.Country.Iceland - QLocale.Country.India - QLocale.Country.Indonesia - QLocale.Country.Iran - QLocale.Country.Iraq - QLocale.Country.Ireland - QLocale.Country.IsleOfMan - QLocale.Country.Israel - QLocale.Country.Italy - QLocale.Country.IvoryCoast - QLocale.Country.Jamaica - QLocale.Country.Japan - QLocale.Country.Jersey - QLocale.Country.Jordan - QLocale.Country.Kazakhstan - QLocale.Country.Kenya - QLocale.Country.Kiribati - QLocale.Country.Kosovo - QLocale.Country.Kuwait - QLocale.Country.Kyrgyzstan - QLocale.Country.Laos - QLocale.Country.LatinAmerica - QLocale.Country.LatinAmericaAndTheCaribbean - Obsolete, use - LatinAmericainstead- QLocale.Country.Latvia - QLocale.Country.Lebanon - QLocale.Country.Lesotho - QLocale.Country.Liberia - QLocale.Country.Libya - QLocale.Country.Liechtenstein - QLocale.Country.Lithuania - QLocale.Country.Luxembourg - QLocale.Country.Macao - QLocale.Country.Macau - QLocale.Country.Macedonia - QLocale.Country.Madagascar - QLocale.Country.Malawi - QLocale.Country.Malaysia - QLocale.Country.Maldives - QLocale.Country.Mali - QLocale.Country.Malta - QLocale.Country.MarshallIslands - QLocale.Country.Martinique - QLocale.Country.Mauritania - QLocale.Country.Mauritius - QLocale.Country.Mayotte - QLocale.Country.Mexico - QLocale.Country.Micronesia - QLocale.Country.Moldova - QLocale.Country.Monaco - QLocale.Country.Mongolia - QLocale.Country.Montenegro - QLocale.Country.Montserrat - QLocale.Country.Morocco - QLocale.Country.Mozambique - QLocale.Country.Myanmar - QLocale.Country.Namibia - QLocale.Country.NauruCountry - Osbolete alias for - NauruTerritory- QLocale.Country.NauruTerritory - QLocale.Country.Nepal - QLocale.Country.Netherlands - QLocale.Country.NewCaledonia - QLocale.Country.NewZealand - QLocale.Country.Nicaragua - QLocale.Country.Niger - QLocale.Country.Nigeria - QLocale.Country.Niue - QLocale.Country.NorfolkIsland - QLocale.Country.NorthernMarianaIslands - QLocale.Country.NorthKorea - QLocale.Country.Norway - QLocale.Country.Oman - QLocale.Country.OutlyingOceania - QLocale.Country.Pakistan - QLocale.Country.Palau - QLocale.Country.PalestinianTerritories - QLocale.Country.Panama - QLocale.Country.PapuaNewGuinea - QLocale.Country.Paraguay - QLocale.Country.PeoplesRepublicOfCongo - Obsolete, use - CongoBrazzavilleinstead- QLocale.Country.Peru - QLocale.Country.Philippines - QLocale.Country.Pitcairn - QLocale.Country.Poland - QLocale.Country.Portugal - QLocale.Country.PuertoRico - QLocale.Country.Qatar - QLocale.Country.RepublicOfKorea - Obsolete, use - SouthKoreainstead- QLocale.Country.Reunion - QLocale.Country.Romania - QLocale.Country.RussianFederation - QLocale.Country.Russia - QLocale.Country.Rwanda - QLocale.Country.SaintBarthelemy - QLocale.Country.SaintHelena - QLocale.Country.SaintKittsAndNevis - QLocale.Country.SaintLucia - QLocale.Country.SaintMartin - QLocale.Country.SaintPierreAndMiquelon - QLocale.Country.SaintVincentAndGrenadines - QLocale.Country.SaintVincentAndTheGrenadines - QLocale.Country.Samoa - QLocale.Country.SanMarino - QLocale.Country.SaoTomeAndPrincipe - QLocale.Country.SaudiArabia - QLocale.Country.Senegal - QLocale.Country.Serbia - QLocale.Country.Seychelles - QLocale.Country.SierraLeone - QLocale.Country.Singapore - QLocale.Country.SintMaarten - QLocale.Country.Slovakia - QLocale.Country.Slovenia - QLocale.Country.SolomonIslands - QLocale.Country.Somalia - QLocale.Country.SouthAfrica - QLocale.Country.SouthGeorgiaAndSouthSandwichIslands - QLocale.Country.SouthGeorgiaAndTheSouthSandwichIslands - QLocale.Country.SouthKorea - QLocale.Country.SouthSudan - QLocale.Country.Spain - QLocale.Country.SriLanka - QLocale.Country.Sudan - QLocale.Country.Suriname - QLocale.Country.SvalbardAndJanMayen - QLocale.Country.SvalbardAndJanMayenIslands - QLocale.Country.Swaziland - QLocale.Country.Sweden - QLocale.Country.Switzerland - QLocale.Country.Syria - QLocale.Country.SyrianArabRepublic - Obsolete, use - Syriainstead- QLocale.Country.Taiwan - QLocale.Country.Tajikistan - QLocale.Country.Tanzania - QLocale.Country.Thailand - QLocale.Country.TimorLeste - QLocale.Country.Togo - QLocale.Country.TokelauCountry - Osbolete alias for - TokelauTerritory- QLocale.Country.TokelauTerritory - QLocale.Country.Tonga - QLocale.Country.TrinidadAndTobago - QLocale.Country.TristanDaCunha - QLocale.Country.Tunisia - QLocale.Country.Turkey - QLocale.Country.Turkmenistan - QLocale.Country.TurksAndCaicosIslands - QLocale.Country.TuvaluCountry - Osbolete alias for - TuvaluTerritory- QLocale.Country.TuvaluTerritory - QLocale.Country.Uganda - QLocale.Country.Ukraine - QLocale.Country.UnitedArabEmirates - QLocale.Country.UnitedKingdom - QLocale.Country.UnitedStates - QLocale.Country.UnitedStatesOutlyingIslands - QLocale.Country.UnitedStatesMinorOutlyingIslands - QLocale.Country.UnitedStatesVirginIslands - QLocale.Country.Uruguay - QLocale.Country.Uzbekistan - QLocale.Country.Vanuatu - QLocale.Country.VaticanCity - QLocale.Country.VaticanCityState - QLocale.Country.Venezuela - QLocale.Country.Vietnam - QLocale.Country.WallisAndFutuna - QLocale.Country.WallisAndFutunaIslands - QLocale.Country.WesternSahara - QLocale.Country.World - QLocale.Country.Yemen - QLocale.Country.Zambia - QLocale.Country.Zimbabwe - Note - Use the Territory alias for this enumeration where possible. The Country enum shall be renamed to Territory at a later release. 
 - class MeasurementSystem¶
- This enum defines which units are used for measurement. - Constant - Description - QLocale.MeasurementSystem.MetricSystem - This value indicates metric units, such as meters, centimeters and millimeters, based on SI . - QLocale.MeasurementSystem.ImperialUSSystem - This value indicates imperial units, such as inches and miles as they are used in the United States. - QLocale.MeasurementSystem.ImperialUKSystem - This value indicates imperial units, such as inches and miles as they are used in the United Kingdom. - QLocale.MeasurementSystem.ImperialSystem - Provided for compatibility. Same as ImperialUSSystem 
 - class FormatType¶
- This enum describes the different formats that can be used when converting - QDate,- QTime, and- QDateTimeobjects, as well as months and days, to strings specific to the locale.- Constant - Description - QLocale.FormatType.LongFormat - Longer format. - QLocale.FormatType.ShortFormat - Shorter format. - QLocale.FormatType.NarrowFormat - A special version for use when space is very limited. - Note - NarrowFormatmight contain the same text for different months and days. It can even be an empty string if the locale doesn’t support narrow names, so you should avoid using it for date formatting. Also, for the system locale this format is the same as- ShortFormat.
 - class NumberOption¶
- (inherits - enum.Flag) This enum defines a set of options for number-to-string and string-to-number conversions. They can be retrieved with- numberOptions()and set with- setNumberOptions().- Constant - Description - QLocale.NumberOption.DefaultNumberOptions - This option represents the default behavior for all locales except the C locale, with group separators, with one leading zero in single digit exponents, and without trailing zeroes at the end of the fractional part (when present). - QLocale.NumberOption.OmitGroupSeparator - If this option is set, the number-to-string functions will not break up digits into groups. The C locale sets this option by default. The default for all other locales is to break up digits into groups, in the whole-number part of a number, with group separators. - QLocale.NumberOption.RejectGroupSeparator - If this option is set, the string-to-number functions will fail if they encounter group separators in their input. The default is to accept numbers containing correctly placed group separators. - QLocale.NumberOption.OmitLeadingZeroInExponent - If this option is set, the number-to-string functions will not pad exponents with zeroes when printing floating point numbers in scientific notation. The default is to add one leading zero to single digit exponents. - QLocale.NumberOption.RejectLeadingZeroInExponent - If this option is set, the string-to-number functions will fail if they encounter an exponent padded with zeroes when parsing a floating point number in scientific notation. The default is to accept such padding. - QLocale.NumberOption.IncludeTrailingZeroesAfterDot - If this option is set, the number-to-string functions will pad numbers with zeroes to the requested precision in “g” or “most concise” mode. The default is to omit trailing zeroes, which may leave fewer digits in the fractional part than the precision asked for. - QLocale.NumberOption.RejectTrailingZeroesAfterDot - If this option is set, the string-to-number functions will fail if they encounter trailing zeroes at the end of the fractional part, when parsing a number in scientific or decimal representation. The default is to accept trailing zeroes. 
 - class FloatingPointPrecisionOption¶
- (inherits - enum.IntEnum) This enum defines a constant that can be given as precision to- number(),- number(), and- toString()when converting floats or doubles, in order to express a variable number of digits as precision.- Constant - Description - QLocale.FloatingPointPrecisionOption.FloatingPointShortest - The conversion algorithm will try to find the shortest accurate representation for the given number. “Accurate” means that you get the exact same number back from an inverse conversion on the generated string representation. In particular, trailing zeros are omitted (from the mantissa, in exponent formats). - See also - toString()- number()- number()
 - class TagSeparator¶
- Indicate how to combine the parts that make up a locale identifier. - A locale identifier may be made up of several tags, indicating language, script and territory (plus, potentially, other details), joined together to form the identifier. Various standards and conventional forms use either a dash (the Unicode HYPHEN-MINUS, U+002D) or an underscore (LOW LINE, U+005F). Different clients of - QLocalemay thus need one or the other.- Constant - Description - QLocale.TagSeparator.TagSeparator.Dash - Use - '-', the dash or hyphen character.- QLocale.TagSeparator.TagSeparator.Underscore - Use - '_', the underscore character.- Note - Although dash and underscore are the only separators used in public standards (as at 2023), it is possible to cast any ASCII character to this type if a non-standard ASCII separator is needed. Casting a non-ASCII character (with decimal value above 127) is not supported: such values are reserved for future use as enum members if some public standard ever uses a non-ASCII separator. It is, of course, possible to use - replace()to replace the separator used by a function taking a parameter of this type with an arbitrary Unicode character or string.- Added in version 6.7. 
 - class CurrencySymbolFormat¶
- Specifies the format of the currency symbol. - Constant - Description - QLocale.CurrencySymbolFormat.CurrencyIsoCode - a ISO-4217 code of the currency. - QLocale.CurrencySymbolFormat.CurrencySymbol - a currency symbol. - QLocale.CurrencySymbolFormat.CurrencyDisplayName - a user readable name of the currency. 
 - class DataSizeFormat¶
- (inherits - enum.Flag) Specifies the format for representation of data quantities.- Constant - Description - QLocale.DataSizeFormat.DataSizeIecFormat - format using base 1024 and IEC prefixes: KiB, MiB, GiB, … - QLocale.DataSizeFormat.DataSizeTraditionalFormat - format using base 1024 and SI prefixes: kB, MB, GB, … - QLocale.DataSizeFormat.DataSizeSIFormat - format using base 1000 and SI prefixes: kB, MB, GB, … - See also 
 - class LanguageCodeType¶
- (inherits - enum.IntFlag) This enum defines language code types that can be used to restrict set of language codes considered by- codeToLanguageand- languageToCode.- Constant - Description - QLocale.LanguageCodeType.ISO639Part1 - ISO 639 Part 1 Alpha 2 code. - QLocale.LanguageCodeType.ISO639Part2B - ISO 639 Part 2 bibliographic Alpha 3 code. - QLocale.LanguageCodeType.ISO639Part2T - ISO 639 Part 2 terminological Alpha 3 code. - QLocale.LanguageCodeType.ISO639Part3 - ISO 639 Part 3 Alpha 3 code. - QLocale.LanguageCodeType.LegacyLanguageCode - Codes that are not part of the above set, but that were supported by Qt in the past. This value can only be used by - codeToLanguage(). It is ignored when passed to- languageToCode().- QLocale.LanguageCodeType.ISO639Part2 - Any ISO 639 Part 2 code. - QLocale.LanguageCodeType.ISO639Alpha2 - Any ISO-639 2-letter code. - QLocale.LanguageCodeType.ISO639Alpha3 - Any ISO-639 3-letter code. - QLocale.LanguageCodeType.ISO639 - Any ISO 639 code. - QLocale.LanguageCodeType.AnyLanguageCode - Specifies that any code can be used. - Added in version 6.3. 
 - class QuotationStyle¶
- This enum defines a set of possible styles for locale specific quotation. - Constant - Description - QLocale.QuotationStyle.StandardQuotation - If this option is set, the standard quotation marks will be used to quote strings. - QLocale.QuotationStyle.AlternateQuotation - If this option is set, the alternate quotation marks will be used to quote strings. - See also 
 - PySide6.QtCore.QLocale.DefaultTwoDigitBaseYear¶
 - __init__()¶
 - Constructs a - QLocaleobject initialized with the default locale.- If no default locale was set using - setDefault(), this locale will be the same as the one returned by- system().- See also - __init__(name)
- Parameters:
- name – str 
 
 - Constructs a - QLocaleobject with the specified- name.- The name has the format “language[_script][_territory][.codeset][@modifier]” or “C”, where: - language is a lowercase, two-letter, ISO 639 language code (some three-letter codes are also recognized), 
- script is a capitalized, four-letter, ISO 15924 script code, 
- territory is an uppercase, two-letter, ISO 3166 territory code (some numeric codes are also recognized), and 
- codeset and modifier are ignored. 
 - The separator can be either underscore - '_'(U+005F, “low line”) or a dash- '-'(U+002D, “hyphen-minus”). If- QLocalehas no data for the specified combination of language, script, and territory, then it uses the most suitable match it can find instead. If the string violates the locale format, or no suitable data can be found for the specified keys, the “C” locale is used instead.- This constructor is much slower than - QLocale(Language, Script, Territory) or- QLocale(Language, Territory).- See also - bcp47Name()- Matching combinations of language, script and territory- __init__(other)
- Parameters:
- other – - QLocale
 
 - Constructs a - QLocaleobject as a copy of- other.- __init__(name)
- Parameters:
- name – str 
 
 - Constructs a - QLocaleobject for the specified- languageand- territory.- If there is more than one script in use for this combination, a likely script will be selected. If - QLocalehas no data for the specified- language, the default locale is used. If- QLocalehas no data for the specified combination of- languageand- territory, an alternative territory may be used instead.- See also - setDefault()- Matching combinations of language, script and territory- __init__(language[, script=QLocale.Script.AnyScript[, territory=QLocale.Country.AnyTerritory]])
 - Constructs a - QLocaleobject for the specified- language,- scriptand- territory.- If - QLocaledoes not have data for the given combination, it will find data for as good a match as it can. It falls back on the default locale if- languageis- AnyLanguageand no language can be inferred from- scriptand- territory
- QLocalehas no data for the language, either given as- languageor inferred as above.
 - See also - setDefault()- Matching combinations of language, script and territory- amText()¶
- Return type:
- str 
 
 - Returns the localized name of the “AM” suffix for times specified using the conventions of the 12-hour clock. - See also - bcp47Name([separator=QLocale.TagSeparator.Dash])¶
- Parameters:
- separator – - TagSeparator
- Return type:
- str 
 
 - Returns the BCP47 field names joined with dashes. - This combines as many of language, script and territory (and possibly other BCP47 fields) for this locale as are needed to uniquely specify it. Note that fields may be omitted if the Unicode consortium’s - Likely Subtag Rulesimply the omitted fields when given those retained. See- name()for how to construct a string from individual fields, if some other format is needed.- Unlike - uiLanguages(), the value returned by bcp47Name() represents the locale name of the- QLocaledata; this need not be the language the user-interface should be in.- This function tries to conform the locale name to the IETF Best Common Practice 47, defined by RFC 5646. Since Qt 6.7, it supports an optional - separatorparameter which can be used to override the BCP47-specified use of a hyphen to separate the tags. For use in IETF-defined protocols, however, the default,- Dash, should be retained.- See also - Returns a - QLocaleobject initialized to the “C” locale.- This locale is based on en_US but with various quirks of its own, such as simplified number formatting and its own date formatting. It implements the POSIX standards that describe the behavior of standard library functions of the “C” programming language. - Among other things, this means its collation order is based on the ASCII values of letters, so that (for case-sensitive sorting) all upper-case letters sort before any lower-case one (rather than each letter’s upper- and lower-case forms sorting adjacent to one another, before the next letter’s two forms). - See also - static codeToCountry(countryCode)¶
- Parameters:
- countryCode – str 
- Return type:
 - Note - This function is deprecated. 
 - Returns the QLocale::Territory enum corresponding to the two-letter or three-digit - countryCode, as defined in the ISO 3166 standard.- If the code is invalid or not known - AnyTerritoryis returned.- Use - codeToTerritory(- QStringView) instead.- static codeToLanguage(languageCode[, codeTypes=QLocale.LanguageCodeType.AnyLanguageCode])¶
- Parameters:
- languageCode – str 
- codeTypes – Combination of - LanguageCodeType
 
- Return type:
 
 - Returns the - Languageenum corresponding to the two- or three-letter- languageCode, as defined in the ISO 639 standards.- If specified, - codeTypesselects which set of codes to consider for conversion. By default all codes known to Qt are considered. The codes are matched in the following order:- ISO639Part1,- ISO639Part2B,- ISO639Part2T,- ISO639Part3,- LegacyLanguageCode.- If the code is invalid or not known - QLocale::AnyLanguageis returned.- Returns the - Scriptenum corresponding to the four-letter script- scriptCode, as defined in the ISO 15924 standard.- If the code is invalid or not known - AnyScriptis returned.- Returns the QLocale::Territory enum corresponding to the two-letter or three-digit - territoryCode, as defined in the ISO 3166 standard.- If the code is invalid or not known - AnyTerritoryis returned.- Returns the locale to use for collation. - The result is usually this locale; however, the system locale (which is commonly the default locale) will return the system collation locale. The result is suitable for passing to - QCollator‘s constructor.- See also - static countriesForLanguage(lang)¶
- Parameters:
- lang – - Language
- Return type:
- .list of QLocale.Country 
 - Note - This function is deprecated. 
 - Use - matchingLocales()instead and consult the- territory()of each.- Returns the list of countries that have entries for - languagein Qt’s locale database. If the result is an empty list, then- languageis not represented in Qt’s locale database.- See also - Use - territory()instead.- Returns the territory of this locale. - See also - static countryToCode(country)¶
- Parameters:
- country – - Country
- Return type:
- str 
 - Note - This function is deprecated. 
 - Use - territoryToCode()instead.- Returns the two-letter territory code for - country, as defined in the ISO 3166 standard.- Note - For - QLocale::AnyTerritoryor- QLocale::AnyCountryan empty string is returned.- static countryToString(country)¶
- Parameters:
- country – - Country
- Return type:
- str 
 - Note - This function is deprecated. 
 - Use - territoryToString()instead.- Returns a - QStringcontaining the name of- country.- createSeparatedList(strl)¶
- Parameters:
- strl – list of strings 
- Return type:
- str 
 
 - Returns a string that represents a join of a given - listof strings with a separator defined by the locale.- currencySymbol([format=QLocale.CurrencySymbolFormat.CurrencySymbol])¶
- Parameters:
- format – - CurrencySymbolFormat
- Return type:
- str 
 
 - Returns a currency symbol according to the - format.- dateFormat([format=QLocale.FormatType.LongFormat])¶
- Parameters:
- format – - FormatType
- Return type:
- str 
 
 - Returns the date format used for the current locale. - If - formatis- LongFormat, the format will be elaborate, otherwise it will be short. For example,- LongFormatfor the- en_USlocale is- dddd, MMMM d, yyyy,- ShortFormatis- M/d/yy.- See also - dateTimeFormat([format=QLocale.FormatType.LongFormat])¶
- Parameters:
- format – - FormatType
- Return type:
- str 
 
 - Returns the date time format used for the current locale. - If - formatis- LongFormat, the format will be elaborate, otherwise it will be short. For example,- LongFormatfor the- en_USlocale is- dddd, MMMM d, yyyy h:mm:ss AP t,- ShortFormatis- M/d/yy h:mm AP.- See also - dayName(day[, format=QLocale.FormatType.LongFormat])¶
- Parameters:
- day – int 
- format – - FormatType
 
- Return type:
- str 
 
 - Returns the localized name of the - day(where 1 represents Monday, 2 represents Tuesday and so on), in the format specified by- type.- For example, if the locale is - en_USand- dayis 1,- LongFormatwill return- Monday,- ShortFormat- Mon, and- NarrowFormat- M.- See also - decimalPoint()¶
- Return type:
- str 
 
 - Returns the fractional part separator for this locale. - This is the token that separates the whole number part from the fracional part in the representation of a number which has a fractional part. This is commonly called the “decimal point character” - even though, in many locales, it is not a “point” (or similar dot). It is (since Qt 6.0) returned as a string in case some locale needs more than one UTF-16 code-point to represent its separator. - See also - exponential()¶
- Return type:
- str 
 
 - Returns the exponent separator for this locale. - This is a token used to separate mantissa from exponent in some floating-point numeric representations. It is (since Qt 6.0) returned as a string because, in some locales, it is not a single character - for example, it may consist of a multiplication sign and a representation of the “ten to the power” operator. - See also - toString(double, char, int)- Returns the first day of the week according to the current locale. - formattedDataSize(bytes[, precision=2[, format=QLocale.DataSizeFormat.DataSizeIecFormat]])¶
- Parameters:
- bytes – int 
- precision – int 
- format – Combination of - DataSizeFormat
 
- Return type:
- str 
 
 - Converts a size in bytes to a human-readable localized string, comprising a number and a quantified unit. The quantifier is chosen such that the number is at least one, and as small as possible. For example if - bytesis 16384,- precisionis 2, and- formatis- DataSizeIecFormat(the default), this function returns “16.00 KiB”; for 1330409069609 bytes it returns “1.21 GiB”; and so on. If- formatis- DataSizeIecFormator- DataSizeTraditionalFormat, the given number of bytes is divided by a power of 1024, with result less than 1024; for- DataSizeSIFormat, it is divided by a power of 1000, with result less than 1000.- DataSizeIecFormatuses the new IEC standard quantifiers Ki, Mi and so on, whereas- DataSizeSIFormatuses the older SI quantifiers k, M, etc., and- DataSizeTraditionalFormatabuses them.- groupSeparator()¶
- Return type:
- str 
 
 - Returns the digit-grouping separator for this locale. - This is a token used to break up long sequences of digits, in the representation of a number, to make it easier to read. In some locales it may be empty, indicating that digits should not be broken up into groups in this way. In others it may be a spacing character. It is (since Qt 6.0) returned as a string in case some locale needs more than one UTF-16 code-point to represent its separator. - See also - Returns the language of this locale. - See also - static languageToCode(language[, codeTypes=QLocale.LanguageCodeType.AnyLanguageCode])¶
- Parameters:
- language – - Language
- codeTypes – Combination of - LanguageCodeType
 
- Return type:
- str 
 
 - Returns the two- or three-letter language code for - language, as defined in the ISO 639 standards.- If specified, - codeTypesselects which set of codes to consider. The first code from the set that is defined for- languageis returned. Otherwise, all ISO-639 codes are considered. The codes are considered in the following order:- ISO639Part1,- ISO639Part2B,- ISO639Part2T,- ISO639Part3.- LegacyLanguageCodeis ignored by this function.- Note - For - QLocale::Cthe function returns- "C". For- QLocale::AnyLanguagean empty string is returned. If the language has no code in any selected code set, an empty string is returned.- Returns a - QStringcontaining the name of- language.- static matchingLocales(language, script, territory)¶
 - Returns a list of valid locale objects that match the given - language,- scriptand- territory.- Getting a list of all locales: - QList<- QLocale> allLocales = QLocale::matchingLocales(- AnyLanguage,- AnyScript,- AnyTerritory);- Getting a list of locales suitable for Russia: - QList<- QLocale> locales = QLocale::matchingLocales(- AnyLanguage,- AnyScript,- Russia);- measurementSystem()¶
- Return type:
 
 - Returns the measurement system for the locale. - monthName(month[, format=QLocale.FormatType.LongFormat])¶
- Parameters:
- month – int 
- format – - FormatType
 
- Return type:
- str 
 
 - Returns the localized name of - month, in the format specified by- type.- For example, if the locale is - en_USand- monthis 1,- LongFormatwill return- January.- ShortFormat- Jan, and- NarrowFormat- J.- See also - name([separator=QLocale.TagSeparator.Underscore])¶
- Parameters:
- separator – - TagSeparator
- Return type:
- str 
 
 - The short name of this locale. - Returns the language and territory of this locale as a string of the form “language_territory”, where language is a lowercase, two-letter ISO 639 language code, and territory is an uppercase, two- or three-letter ISO 3166 territory code. If the locale has no specified territory, only the language name is returned. Since Qt 6.7 an optional - separatorparameter can be supplied to override the default underscore character separating the two tags.- Even if the - QLocaleobject was constructed with an explicit script, name() will not contain it for compatibility reasons. Use- bcp47Name()instead if you need a full locale name, or construct the string you want to identify a locale by from those returned by passing its- language()to- languageToCode()and similar for the script and territory.- See also - QLocale()- language()- script()- territory()- bcp47Name()- uiLanguages()- nativeCountryName()¶
- Return type:
- str 
 - Note - This function is deprecated. 
 - Use - nativeTerritoryName()instead.- Returns a native name of the territory for the locale. For example “España” for Spanish/Spain locale. - See also - nativeLanguageName()¶
- Return type:
- str 
 
 - Returns a native name of the language for the locale. For example “Schweizer Hochdeutsch” for the Swiss-German locale. - See also - nativeTerritoryName()¶
- Return type:
- str 
 
 - Returns a native name of the territory for the locale. For example “España” for Spanish/Spain locale. - See also - negativeSign()¶
- Return type:
- str 
 
 - Returns the negative sign indicator of this locale. - This is a token presumed to be used as a prefix to a number to indicate that it is negative. It is (since Qt 6.0) returned as a string because, in some locales, it is not a single character - for example, because it includes a text-direction-control character. - See also - numberOptions()¶
- Return type:
- Combination of - NumberOption
 
 - Returns the options related to number conversions for this - QLocaleinstance.- By default, no options are set for the standard locales, except for the “C” locale, which has - OmitGroupSeparatorset by default.- Returns - trueif the two- QLocaleobjects,- lhsand- rhs, differ; otherwise returns- false.- Note - The system locale is not equal to the - QLocaleobject constructed from its- language(),- script()and- territory(), even if the two agree in all data fields. Nor are two locales with different number options equal.- See also - operator==()- setNumberOptions()- __ne__(lhs)
- Parameters:
- lhs – - Language
- Return type:
- bool 
 
 - __ne__(rhs)
- Parameters:
- rhs – - Language
- Return type:
- bool 
 
 - Returns - trueif the two- QLocaleobjects,- lhsand- rhs, are the same; otherwise returns- false.- Note - The system locale is not equal to the - QLocaleobject constructed from its- language(),- script()and- territory(), even if the two agree in all data fields. Nor are two locales with different number options equal.- See also - operator!=()- setNumberOptions()- __eq__(lhs)
- Parameters:
- lhs – - Language
- Return type:
- bool 
 
 - __eq__(rhs)
- Parameters:
- rhs – - Language
- Return type:
- bool 
 
 - percent()¶
- Return type:
- str 
 
 - Returns the percent marker of this locale. - This is a token presumed to be appended to a number to indicate a percentage. It is (since Qt 6.0) returned as a string because, in some locales, it is not a single character - for example, because it includes a text-direction-control character. - See also - pmText()¶
- Return type:
- str 
 
 - Returns the localized name of the “PM” suffix for times specified using the conventions of the 12-hour clock. - See also - positiveSign()¶
- Return type:
- str 
 
 - Returns the positive sign indicator of this locale. - This is a token presumed to be used as a prefix to a number to indicate that it is positive. It is (since Qt 6.0) returned as a string because, in some locales, it is not a single character - for example, because it includes a text-direction-control character. - See also - quoteString(str[, style=QLocale.QuotationStyle.StandardQuotation])¶
- Parameters:
- str – str 
- style – - QuotationStyle
 
- Return type:
- str 
 
 - quoteString(str[, style=QLocale.QuotationStyle.StandardQuotation])
- Parameters:
- str – str 
- style – - QuotationStyle
 
- Return type:
- str 
 
 - Returns - strquoted according to the current locale using the given quotation- style.- Returns the script of this locale. - Returns the four-letter script code for - script, as defined in the ISO 15924 standard.- Note - For - QLocale::AnyScriptan empty string is returned.- Returns a - QStringcontaining the name of- script.- Sets the global default locale to - locale.- This locale is used when a - QLocaleobject is constructed with no arguments. If this function is not called, the system’s locale is used.- Warning - In a multithreaded application, the default locale should be set at application startup, before any non-GUI threads are created. - setNumberOptions(options)¶
- Parameters:
- options – Combination of - NumberOption
 
 - Sets the - optionsrelated to number conversions for this- QLocaleinstance.- standaloneDayName(day[, format=QLocale.FormatType.LongFormat])¶
- Parameters:
- day – int 
- format – - FormatType
 
- Return type:
- str 
 
 - Returns the localized name of the - day(where 1 represents Monday, 2 represents Tuesday and so on) that is used as a standalone text, in the format specified by- type.- If the locale information does not specify the standalone day name then return value is the same as in - dayName().- See also - standaloneMonthName(month[, format=QLocale.FormatType.LongFormat])¶
- Parameters:
- month – int 
- format – - FormatType
 
- Return type:
- str 
 
 - Returns the localized name of - monththat is used as a standalone text, in the format specified by- type.- If the locale information doesn’t specify the standalone month name then return value is the same as in - monthName().- See also - Swaps this locale with - other. This operation is very fast and never fails.- Returns a QLocale object initialized to the system locale. - The system locale may use system-specific sources for locale data, where available, otherwise falling back on QLocale’s built-in database entry for the language, script and territory the system reports. - For example, on Windows, this locale will use the decimal/grouping characters and date/time formats specified in the system configuration panel. - Note - Qt for Python on macOS will not reflect the user’s region and language preferences though QLocale::system(), but will instead reflect the environment variables POSIX uses to specify locale, similar to Python’s locale module. If the system locale cannot be determined, which can be due to none of the variables ‘LC_ALL’, ‘LC_CTYPE’, ‘LANG’ or ‘LANGUAGE’ being set by your environment, then the default POSIX locale or ‘C’ locale is returned. - See also c(). - Returns the territory of this locale. - See also - Returns the two-letter territory code for - territory, as defined in the ISO 3166 standard.- Note - For - QLocale::AnyTerritoryan empty string is returned.- Returns a - QStringcontaining the name of- territory.- textDirection()¶
- Return type:
 
 - Returns the text direction of the language. - timeFormat([format=QLocale.FormatType.LongFormat])¶
- Parameters:
- format – - FormatType
- Return type:
- str 
 
 - Returns the time format used for the current locale. - If - formatis- LongFormat, the format will be elaborate, otherwise it will be short. For example,- LongFormatfor the- en_USlocale is- h:mm:ss AP t,- ShortFormatis- h:mm AP.- See also - toCurrencyString(i[, symbol=""])¶
- Parameters:
- i – int 
- symbol – str 
 
- Return type:
- str 
 
 - toCurrencyString(value[, symbol=""])
- Parameters:
- value – int 
- symbol – str 
 
- Return type:
- str 
 
 - Returns a localized string representation of - valueas a currency. If the- symbolis provided it is used instead of the default currency symbol.- See also - toCurrencyString(value[, symbol=""[, precision=-1]])
- Parameters:
- value – float 
- symbol – str 
- precision – int 
 
- Return type:
- str 
 
 - Returns a localized string representation of - valueas a currency. If the- symbolis provided it is used instead of the default currency symbol. If the- precisionis provided it is used to set the precision of the currency value.- See also - toCurrencyString(i[, symbol=""[, precision=-1]])
- Parameters:
- i – float 
- symbol – str 
- precision – int 
 
- Return type:
- str 
 
 - toDate(string[, format=QLocale.FormatType.LongFormat[, baseYear=1900]])¶
- Parameters:
- string – str 
- format – - FormatType
- baseYear – int 
 
- Return type:
 
 - Reads - stringas a date in a locale-specific- format.- Parses - stringand returns the date it represents. The format of the date string is chosen according to the- formatparameter (see- dateFormat()).- Some locales use, particularly for - ShortFormat, only the last two digits of the year. In such a case, the 100 years starting at- baseYearare the candidates first considered. Prior to 6.7 there was no- baseYearparameter and 1900 was always used. This is the default for- baseYear, selecting a year from then to 1999. In some cases, other fields may lead to the next or previous century being selected, to get a result consistent with all fields given. See- fromString()for details.- Note - Month and day names, where used, must be given in the locale’s language. - If the date could not be parsed, returns an invalid date. - See also - toDate(string, format[, baseYear=1900])
- Parameters:
- string – str 
- format – str 
- baseYear – int 
 
- Return type:
 
 - Reads - stringas a date in the given- format.- Parses - stringand returns the date it represents. See- fromString()for the interpretation of- format.- When - formatonly specifies the last two digits of a year, the 100 years starting at- baseYearare the candidates first considered. Prior to 6.7 there was no- baseYearparameter and 1900 was always used. This is the default for- baseYear, selecting a year from then to 1999. In some cases, other fields may lead to the next or previous century being selected, to get a result consistent with all fields given. See- fromString()for details.- Note - Month and day names, where used, must be given in the locale’s language. - If the date could not be parsed, returns an invalid date. - See also - toDate(string, format, cal[, baseYear=1900])
- Parameters:
- string – str 
- format – - FormatType
- cal – - QCalendar
- baseYear – int 
 
- Return type:
 
 - toDate(string, format, cal[, baseYear=1900])
 - toDateTime(string[, format=QLocale.FormatType.LongFormat[, baseYear=1900]])¶
- Parameters:
- string – str 
- format – - FormatType
- baseYear – int 
 
- Return type:
 
 - Reads - stringas a date-time in a locale-specific- format.- Parses - stringand returns the date-time it represents. The format of the date string is chosen according to the- formatparameter (see- dateFormat()).- Some locales use, particularly for - ShortFormat, only the last two digits of the year. In such a case, the 100 years starting at- baseYearare the candidates first considered. Prior to 6.7 there was no- baseYearparameter and 1900 was always used. This is the default for- baseYear, selecting a year from then to 1999. In some cases, other fields may lead to the next or previous century being selected, to get a result consistent with all fields given. See- fromString()for details.- Note - Month and day names, where used, must be given in the locale’s language. Any am/pm indicators used must match - amText()or- pmText(), ignoring case.- If the string could not be parsed, returns an invalid - QDateTime.- See also - toDateTime(string, format[, baseYear=1900])
- Parameters:
- string – str 
- format – str 
- baseYear – int 
 
- Return type:
 
 - Reads - stringas a date-time in the given- format.- Parses - stringand returns the date-time it represents. See- fromString()for the interpretation of- format.- When - formatonly specifies the last two digits of a year, the 100 years starting at- baseYearare the candidates first considered. Prior to 6.7 there was no- baseYearparameter and 1900 was always used. This is the default for- baseYear, selecting a year from then to 1999. In some cases, other fields may lead to the next or previous century being selected, to get a result consistent with all fields given. See- fromString()for details.- Note - Month and day names, where used, must be given in the locale’s language. Any am/pm indicators used must match - amText()or- pmText(), ignoring case.- If the string could not be parsed, returns an invalid - QDateTime. If the string can be parsed and represents an invalid date-time (e.g. in a gap skipped by a time-zone transition), an invalid- QDateTimeis returned, whose toMSecsSinceEpoch() represents a near-by date-time that is valid. Passing that to fromMSecsSinceEpoch() will produce a valid date-time that isn’t faithfully represented by the string parsed.- See also - toDateTime(string, format, cal[, baseYear=1900])
- Parameters:
- string – str 
- format – - FormatType
- cal – - QCalendar
- baseYear – int 
 
- Return type:
 
 - toDateTime(string, format, cal[, baseYear=1900])
 - toDouble(s)¶
- Parameters:
- s – str 
- Return type:
- (float, bool ok) 
 
 - Warning - This section contains snippets that were automatically translated from C++ to Python and may contain errors. - Returns the double represented by the localized string - s.- Returns an infinity if the conversion overflows or 0.0 if the conversion fails for any other reason (e.g. underflow). - If - okis not- None, failure is reported by setting *``ok`` to- false, and success by setting *``ok`` to- true.- ok = bool() d = float() c = QLocale(QLocale.C) d = c.toDouble("1234.56", ok) # ok == true, d == 1234.56 d = c.toDouble("1,234.56", ok) # ok == true, d == 1234.56 d = c.toDouble("1234,56", ok) # ok == false, d == 0 german = QLocale(QLocale.German) d = german.toDouble("1234,56", ok) # ok == true, d == 1234.56 d = german.toDouble("1.234,56", ok) # ok == true, d == 1234.56 d = german.toDouble("1234.56", ok) # ok == false, d == 0 d = german.toDouble("1.234", ok) # ok == true, d == 1234.0 - Notice that the last conversion returns 1234.0, because ‘.’ is the thousands group separator in the German locale. - This function ignores leading and trailing whitespace. - See also - toFloat(s)¶
- Parameters:
- s – str 
- Return type:
- (float, bool ok) 
 
 - Returns the float represented by the localized string - s.- Returns an infinity if the conversion overflows or 0.0 if the conversion fails for any other reason (e.g. underflow). - If - okis not- None, failure is reported by setting *``ok`` to- false, and success by setting *``ok`` to- true.- This function ignores leading and trailing whitespace. - See also - toInt(s)¶
- Parameters:
- s – str 
- Return type:
- (int, bool ok) 
 
 - Returns the int represented by the localized string - s.- If the conversion fails the function returns 0. - If - okis not- None, failure is reported by setting *``ok`` to- false, and success by setting *``ok`` to- true.- This function ignores leading and trailing whitespace. - See also - toLong(s)¶
- Parameters:
- s – str 
- Return type:
- (int, bool ok) 
 
 - Returns the long int represented by the localized string - s.- If the conversion fails the function returns 0. - If - okis not- None, failure is reported by setting *``ok`` to- false, and success by setting *``ok`` to- true.- This function ignores leading and trailing whitespace. - See also - toLongLong(s)¶
- Parameters:
- s – str 
- Return type:
- (int, bool ok) 
 
 - Returns the long long int represented by the localized string - s.- If the conversion fails the function returns 0. - If - okis not- None, failure is reported by setting *``ok`` to- false, and success by setting *``ok`` to- true.- This function ignores leading and trailing whitespace. - See also - toLower(str)¶
- Parameters:
- str – str 
- Return type:
- str 
 
 - Returns a lowercase copy of - str.- If Qt Core is using the ICU libraries, they will be used to perform the transformation according to the rules of the current locale. Otherwise the conversion may be done in a platform-dependent manner, with - toLower()as a generic fallback.- See also - toLower()- toShort(s)¶
- Parameters:
- s – str 
- Return type:
- (int, bool ok) 
 
 - Returns the short int represented by the localized string - s.- If the conversion fails the function returns 0. - If - okis not- None, failure is reported by setting *``ok`` to- false, and success by setting *``ok`` to- true.- This function ignores leading and trailing whitespace. - See also - toString(i)
- Parameters:
- i – int 
- Return type:
- str 
 - See also 
 - toString(i)
- Parameters:
- i – int 
- Return type:
- str 
 
 - Returns a localized string representation of - i.- toString(date[, format=QLocale.FormatType.LongFormat])
- Parameters:
- date – - QDate
- format – - FormatType
 
- Return type:
- str 
 
 - toString(date, format)
- Parameters:
- date – - QDate
- format – str 
 
- Return type:
- str 
 
 - Returns a localized string representation of the given - datein the specified- format. If- formatis an empty string, an empty string is returned.- See also - toString(time[, format=QLocale.FormatType.LongFormat])
- Parameters:
- time – - QTime
- format – - FormatType
 
- Return type:
- str 
 
 - Returns a localized string representation of the given - timein the specified- format(see- timeFormat()).- toString(time, format)
- Parameters:
- time – - QTime
- format – str 
 
- Return type:
- str 
 
 - Returns a localized string representation of the given - timeaccording to the specified- format. If- formatis an empty string, an empty string is returned.- See also - toString(dateTime[, format=QLocale.FormatType.LongFormat])
- Parameters:
- dateTime – - QDateTime
- format – - FormatType
 
- Return type:
- str 
 
 - toString(dateTime, format)
- Parameters:
- dateTime – - QDateTime
- format – str 
 
- Return type:
- str 
 
 - Returns a localized string representation of the given - dateTimeaccording to the specified- format. If- formatis an empty string, an empty string is returned.- See also - toString(date, format, cal)
- Parameters:
- date – - QDate
- format – - FormatType
- cal – - QCalendar
 
- Return type:
- str 
 
 - Returns a localized string representation of the given - dateaccording to the specified- format(see- dateFormat()), optionally for a specified calendar- cal.- Note - Some locales may use formats that limit the range of years they can represent. - toString(dateTime, format, cal)
- Parameters:
- dateTime – - QDateTime
- format – - FormatType
- cal – - QCalendar
 
- Return type:
- str 
 
 - Returns a localized string representation of the given - dateTimeaccording to the specified- format(see- dateTimeFormat()), optionally for a specified calendar- cal.- Note - Some locales may use formats that limit the range of years they can represent. - toString(f[, format='g'[, precision=6]])
- Parameters:
- f – float 
- format – int 
- precision – int 
 
- Return type:
- str 
 
 - Returns a string representing the floating-point number - f.- The form of the representation is controlled by the - formatand- precisionparameters.- The - formatdefaults to- 'g'. It can be any of the following:- Format - Meaning - Meaning of - precision- 'e'- format as [-]9.9e[+|-]999 - number of digits after the decimal point - 'E'- format as [-]9.9E[+|-]999 - “ - 'f'- format as [-]9.9 - “ - 'F'- same as - 'f'except for INF and NAN (see below)- “ - 'g'- use - 'e'or- 'f'format, whichever is more concise- maximum number of significant digits (trailing zeroes are omitted) - 'G'- use - 'E'or- 'F'format, whichever is more concise- “ - The special - precisionvalue- FloatingPointShortestselects the shortest representation that, when read as a number, gets back the original floating-point value. Aside from that, any negative- precisionis ignored in favor of the default, 6.- For the - 'e',- 'f'and- 'g'formats, positive infinity is represented as “inf”, negative infinity as “-inf” and floating-point NaN (not-a-number) values are represented as “nan”. For the- 'E',- 'F'and- 'G'formats, “INF” and “NAN” are used instead. This does not vary with locale.- toString(f[, format='g'[, precision=6]])
- Parameters:
- f – float 
- format – int 
- precision – int 
 
- Return type:
- str 
 
 - Returns a string representing the floating-point number - f.- The - formatand- precisionhave the same meanings as described in- toString(double, char, int).- toTime(string[, format=QLocale.FormatType.LongFormat])¶
- Parameters:
- string – str 
- format – - FormatType
 
- Return type:
 
 - Reads - stringas a time in a locale-specific- format.- Parses - stringand returns the time it represents. The format of the time string is chosen according to the- formatparameter (see- timeFormat()).- If the time could not be parsed, returns an invalid time. - See also - toTime(string, format)
- Parameters:
- string – str 
- format – str 
 
- Return type:
 
 - Reads - stringas a time in the given- format.- Parses - stringand returns the time it represents. See- fromString()for the interpretation of- format.- If the time could not be parsed, returns an invalid time. - See also - toUInt(s)¶
- Parameters:
- s – str 
- Return type:
- (int, bool ok) 
 
 - Returns the unsigned int represented by the localized string - s.- If the conversion fails the function returns 0. - If - okis not- None, failure is reported by setting *``ok`` to- false, and success by setting *``ok`` to- true.- This function ignores leading and trailing whitespace. - See also - toULong(s[, ok=None])¶
- Parameters:
- s – str 
- ok – bool 
 
- Return type:
- int 
 
 - Returns the unsigned long int represented by the localized string - s.- If the conversion fails the function returns 0. - If - okis not- None, failure is reported by setting *``ok`` to- false, and success by setting *``ok`` to- true.- This function ignores leading and trailing whitespace. - See also - toULongLong(s)¶
- Parameters:
- s – str 
- Return type:
- (int, bool ok) 
 
 - Returns the unsigned long long int represented by the localized string - s.- If the conversion fails the function returns 0. - If - okis not- None, failure is reported by setting *``ok`` to- false, and success by setting *``ok`` to- true.- This function ignores leading and trailing whitespace. - See also - toUShort(s)¶
- Parameters:
- s – str 
- Return type:
- (int, bool ok) 
 
 - Returns the unsigned short int represented by the localized string - s.- If the conversion fails the function returns 0. - If - okis not- None, failure is reported by setting *``ok`` to- false, and success by setting *``ok`` to- true.- This function ignores leading and trailing whitespace. - See also - toUpper(str)¶
- Parameters:
- str – str 
- Return type:
- str 
 
 - Returns an uppercase copy of - str.- If Qt Core is using the ICU libraries, they will be used to perform the transformation according to the rules of the current locale. Otherwise the conversion may be done in a platform-dependent manner, with - toUpper()as a generic fallback.- Note - In some cases the uppercase form of a string may be longer than the original. - See also - toUpper()- uiLanguages([separator=QLocale.TagSeparator.Dash])¶
- Parameters:
- separator – - TagSeparator
- Return type:
- list of strings 
 
 - List of locale names for use in selecting translations - Each entry in the returned list is the name of a locale suitable to the user’s preferences for what to translate the UI into. Where a name in the list is composed of several tags, they are joined as indicated by - separator. Prior to Qt 6.7 a dash was used as separator.- For example, using the default separator - Dash, if the user has configured their system to use English as used in the USA, the list would be “en-Latn-US”, “en-US”, “en-Latn”, “en”. The order of entries is the order in which to check for translations; earlier items in the list are to be preferred over later ones. If your translation files (or other resources specific to locale) use underscores, rather than dashes, to separate locale tags, pass- Underscoreas- separator.- Returns a list of locale names. This may include multiple languages, especially for the system locale when multiple UI translation languages are configured. The order of entries is significant. For example, for the system locale, it reflects user preferences. - Prior to Qt 6.9, the list only contained explicitly configured locales and their equivalents. This led some callers to add truncations (such as from ‘en-Latn-DE’ to ‘en’) as fallbacks. This could sometimes result in inappropriate choices, especially if these were tried before later entries that would be more appropriate fallbacks. - Starting from Qt 6.9, reasonable truncations are included in the returned list after all entries equivalent to the explicitly specified locales. This change allows for more accurate fallback options without callers needing to do any truncation. - Users can explicitly include preferred fallback locales (such as en-US) in their system configuration to control the order of preference. You are advised to rely on the order of entries in uiLanguages() rather than using custom fallback methods. - Most likely you do not need to use this function directly, but just pass the - QLocaleobject to the- load()function.- See also - weekdays()¶
- Return type:
- .list of Qt.DayOfWeek 
 
 - Returns a list of days that are considered weekdays according to the current locale. - zeroDigit()¶
- Return type:
- str 
 
 - Returns the zero digit character of this locale. - This is a single Unicode character but may be encoded as a surrogate pair, so is (since Qt 6.0) returned as a string. In most locales, other digits follow it in Unicode ordering - however, some number systems, notably those using U+3007 as zero, do not have contiguous digits. Use - toString()to obtain suitable representations of numbers, rather than trying to construct them from this zero digit.- See also