Skip to content
GitLab
    • Why GitLab
    • Pricing
    • Contact Sales
    • Explore
  • Why GitLab
  • Pricing
  • Contact Sales
  • Explore
  • Sign in
  • Get free trial
  • Moritz Bunkus
  • MKVToolNixMKVToolNix
  • Issues
  • #3624

Override QLocale number conversion behavior for Chinese users

(this is a low-priority request)

I see weird number representations in Qt-based applications occasionally.

In MKVToolNix GUI v79.0 stable:

Suzhou Mazi in MKVToolNix GUI image

In another web drive provider:

Overflowed Unicode characters used for date/time

The conversion was done automatically by QLocale, which uses the highly-polluted Unicode CLDR as its definitive source.

I see no chance in fixing this soon at the upstream, so let's make it simple and efficient.


The Windows 11 devices sold in China have the following default registry value:

[HKEY_CURRENT_USER\Control Panel\International]
"sNativeDigits"="〇一二三四五六七八九"

Compare with:

"sNativeDigits"="0123456789"

Related Settings page:

Windows numbers.png

With the Chinese value in effect, regardless of the UI language selected in MKVToolNix GUI, it starts in the weird number mode.

What appeared in MKVToolNix GUI's QSpinBox are Suzhou numerals (mazi), namingly "fancy numbers", which aren't taught in the fundamental education of China. They are less known in China than the Roman numbers.

In China we mostly use Arabic numbers, then Chinese characters (for formal text, especially dates), then "Big" (lit. Uppercased) Chinese characters for finacial scenes (to make them hard to tamper):

Arabic:      0 1 2 3 4 5 6 7 8 9 10 100 1000 10000 10⁸
Chinese:     〇一二 三四五 六七八 九 十  百   千     万  亿
Uppercased:  零壹贰 叁肆伍 陆柒捌 玖 拾  佰   仟     萬  億
Suzhou mazi: 〇〡〢 〣〤〥 〦〧〨 〩

See also "Big" numbers (daiji) in Japanese.

In short, a modern Chinese computer user should never expect Suzhou mazi in QSpinBoxes.

I request the following change when you have free time:

  • reads user locale and system locale
  • evaluates the Script values for both locales (see QLocale::codeToScript)
  • if either of the Script values is one of the following, make a reimplemented QSpinBox::textFromValue() effective. (What we need is the exact decimal Arabic number value with no thousand separator.)
QLocale Script Constant Value
QLocale::HanScript (since Qt 5.1) 43
QLocale::HanWithBopomofoScript (since Qt 5.7) 45
QLocale::SimplifiedHanScript 118
QLocale::TraditionalHanScript 137

Attached are the locale-related Windows registry values, in case you have trouble reproducing this number behavior: zh-hans-mo.reg

Edited Oct 16, 2023 by Dian Li
Assignee
Assign to
Time tracking