status-im / status-desktop

Status Desktop client made in Nim & QML
https://status.app
Mozilla Public License 2.0
299 stars 79 forks source link

Create language model on the nim side #6416

Closed osmaczko closed 2 years ago

osmaczko commented 2 years ago

Description

Currently, the language model is created in LanguageStore.qml. Instead, it should be made by the backend: https://github.com/status-im/status-desktop/pull/5853#pullrequestreview-981841672

Motivation

Target languages are driven by the Lokalise platform now. The app should be able to auto-adapt to added/removed target languages or the adaptation should require as least code as possible.

Acceptance criteria

caybro commented 2 years ago

@osmaczko this is somewhat wrong; only Qt (and QTranslator) knows about the available UI languages, and you can query such list with Qt.locale().uiLanguages (see https://doc.qt.io/qt-5/qml-qtqml-locale.html#uiLanguages-prop). No need to build the model; scanning *.ts files would be equally wrong, you want the *.qm files, and those better be bundled in the qrc resource file when compiling.

osmaczko commented 2 years ago

@osmaczko this is somewhat wrong; only Qt (and QTranslator) knows about the available UI languages, and you can query such list with Qt.locale().uiLanguages (see https://doc.qt.io/qt-5/qml-qtqml-locale.html#uiLanguages-prop). No need to build the model; scanning *.ts files would be equally wrong, you want the *.qm files, and those better be bundled in the qrc resource file when compiling.

We still need to build the model, because we need other properties.

EDIT: I agree that scanning/listing *.ts files can be simplified to QLocale::uiLanguages() thanks to https://doc.qt.io/qt-6/qtranslator.html#load (description updated) We still need to scan *.qm files because QLocale::uiLanguages() only returns system langauges.

osmaczko commented 2 years ago

blocked by: https://github.com/status-im/status-desktop/issues/6500