From c9d31c70d83528da965cfb70e3cf38a53820fd2a Mon Sep 17 00:00:00 2001 From: Volker Hilsheimer Date: Tue, 1 Oct 2024 17:17:06 +0200 Subject: [PATCH] QLocale: document that uiLanguages() might return multiple languages Especially for the system locale, the list of UI languages might span multiple languages, rather than just different variations of the same language. That was not clear, and not covered by the test cases. Test case augmentation in a follow up commit. Pick-to: 6.5 Task-number: QTBUG-124898 Task-number: QTBUG-129434 Change-Id: I39dd7b35778a9ffe0bdce86b2f4c474f275f61b0 Reviewed-by: Edward Welbourne (cherry picked from commit 8230c7d7af684aa8640c5566f0b19c3dd48c1ef0) Reviewed-by: Qt Cherry-pick Bot --- src/corelib/text/qlocale.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/corelib/text/qlocale.cpp b/src/corelib/text/qlocale.cpp index 8ba9b0b313f..de71916ea81 100644 --- a/src/corelib/text/qlocale.cpp +++ b/src/corelib/text/qlocale.cpp @@ -4783,6 +4783,15 @@ QString QLocale::formattedDataSize(qint64 bytes, int precision, DataSizeFormats than dashes, to separate locale tags, pass QLocale::TagSeparator::Underscore as \a separator. + The returned list may contain entries for more than one language. + In particular, this happens for \l{QLocale::system()}{system locale} + when the user has configured the system to accept several languages + for user-interface translations. In such a case, the order of entries + for distinct languages is significant. For example, where a user has + configured a primarily German system to also accept English and Chinese, + in that order of preference, the returned list shall contain some + entries for German, then some for English, and finally some for Chinese. + Most likely you do not need to use this function directly, but just pass the QLocale object to the QTranslator::load() function.