qml: Follow the selected language in System default and activity dates

bitcoin-core/gui-qml: PR #1051

3 minor findings

Findings

Link

[minor] · System default can select different languages for Core and QML

With System default and preferences such as [en-US, es-ES], independent catalog searches select Spanish QML strings but English Core strings and date names, despite English being the first preference.

Location: qml/applocale.cpp:144 (head).

Details and suggested fix

install() searches the entire UI-language list separately for bitcoin and bitcoin_qml. Core ships English and Spanish catalogs, but QML ships only Spanish, so the QML search skips the English preference and loads Spanish. SystemNamesLocale() follows only the English Core translator, producing the mismatch whenever these preferences reach startup or a switch back to System default. Choosing a language explicitly avoids it. Resolve one language for both catalogs, treating English source text as an English match, and restrict both loads to that selection. Add a regression test with {"en-US", "es-ES"} that expects the QML Language label and date names to remain English.


Link

[minor] · Same-language long-date variants lose their literal words

A same-language system long-date pattern that differs from Qt's built-in pattern loses words such as Spanish de; this conditional behavior is source-supported, but its occurrence on Windows or macOS has not been observed.

Location: qml/applocale.cpp:117 (head).

Details and suggested fix

The activity Day heading obtains the regional long-date pattern from QLocale(), but preserves its literals only when the entire string equals the built-in pattern reconstructed from the names language and regional territory. An equivalent Spanish pattern such as dddd, d' de 'MMMM' de 'yyyy, when unequal to that built-in string, becomes dddd, d MMMM yyyy and renders jueves, 15 enero 2026. Recognize same-language literals independently of field layout and quoting, for example by comparing normalized literal words, while retaining the stripping path for foreign-language patterns. Add a test for the equivalent Spanish quoting variant.


Link

[minor] · Calendar script test assumes a month-first host locale

Source inspection shows the new calendar script test would fail on year-first regional locales such as ja_JP, because it hardcodes month-first labels without pinning the regional locale; no test failure was observed.

Location: test/qml/tst_activitylist.qml:850 (head).

Details and suggested fix

Changing Qt.uiLanguage selects Serbian names but does not change the regional QLocale() used by AppLocale.wordDateFormat(). On a year-first host, the calendar correctly displays 2026 januar and 2026 јануар, whereas the assertions require the reverse order. The QML harness and CTest environment leave that regional locale inherited from the host. Since this test targets script switching, assert the expected Latin and Cyrillic month names without requiring a particular field order.


Coverage details