QmlPreview: Load QML translations from qrc context URLs


ProxyTranslator::setLanguage() built the translation directory with
QUrl::toLocalFile(), which returns an empty string for qrc: URLs. When
the context URL pointed into resources, the .qm files were searched in
"/i18n" and never loaded, so no QML translation was applied.

This broke tst_qqmldebugtranslationservice on HarmonyOS, where test
data is built into resources and the data directory URL is
"qrc:/data/": all strings were reported as missing translations and no
elide warnings were produced.

Use QQmlFile::urlToLocalFileOrQrc() so that both local file and qrc
context URLs resolve to a path QTranslator::load() can handle.

Fixes: QTBUG-151215
Fixes: QTBUG-151216
Fixes: QTBUG-151217
Pick-to: 6.12
Change-Id: If8a647d48172448bf8823690699e711178c0707f
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
commit131940bf14689e39701fe673239721fb7314857f
parent7214a32024be080099ad05c596ee778623ed66d8
authorSukyoung Oh <sukyoung.oh@qt.io>
committerSukyoung Oh <sukyoung.oh@qt.io>
commit timeMon, 19 Oct 2026 00:45:48 +0000