Internationalization and Localization Support for Safety Critical UIs
Now you can conveniently design, implement, and verify safety-critical user interfaces for many languages. This feature brings the QSR on par with the typical Qt applications in ease of use. The localization has been possible with the already released QSR version, but now it is straightforward. Managing the data assets for language variants is easy with minimal effort.
You can use the example provided with the QSR to see how easy it is to use. The example includes ten different language variants. You can choose any number of variants you like for your application. You can switch the languages in your application on the fly. There is no reason to restart the application and the switch is instant.
This feature works seamlessly with another new feature for display content verification. The QSR tooling generates the safe assets resource files automatically. This usability improvement makes use and rapid prototyping easy and smooth.
font.family: "Helvetica World"
text: qsTr("Hello world!")
The project file contains a list of languages and translation files. Here is a code snippet from the example's project file.
SAFE_RESOURCES += safeasset.qrc
SAFE_LANGUAGES = en fi de uk el ar da et no sv
SAFE_TRANSLATION = $$PWD/translationFiles/safeui
TRANSLATIONS += translationFiles/safeui_en.ts translationFiles/safeui_fi.ts translationFiles/safeui_de.ts
translationFiles/safeui_uk.ts translationFiles/safeui_el.ts translationFiles/safeui_ar.ts translationFiles/safeui_da.ts
translationFiles/safeui_et.ts translationFiles/safeui_no.ts translationFiles/safeui_sv.ts
#Run the lrelease tool to generate the qm files
command = $$QMAKE_LRELEASE_EXE $$TRANSLATIONS
system($$command)|error("Failed to run: $$command")
There is a file for each translated text for the given language. The individual translation files for the static Safe Text look like this:
<?xml version="1.0" encoding="utf-8"?>
<TS version="2.1" language="fi_FI">
<location filename="SafeUI.qml" line="64"/>
<translation type="unfinished">Hei maailma!</translation>
The Safe Image uses a resource file you can edit with the Qt Creator's text editor or resource editor. Here is the example file showing the thumbnails of the Safe Images for different languages.
Note that the safe asset resource file is generated automatically. This is user-friendly improvement for handling the related assets in you application.
QSR 2.0 is expected to be available soon. The pre-release version is already available via the Qt installer. The QSR is part of the Qt for Device Creation Enterprise version. So, you get it as part of the bundle without needing a dedicated QSR license. Shall you have any questions, please don't hesitate to contact us.
Subscribe to our newsletter
Try Qt 6.5 Now!
Download the latest release here: www.qt.io/download.
Qt 6.5 is the latest Long-Term-Support release with all you need for C++ cross-platform app development.
Qt World Summit 2023: Berlin awaits!
Check out all our open positions here and follow us on Instagram to see what it's like to be #QtPeople.