A system of translations into different languages has been implemented. Added translations into Russian. Various UI fixes for valid internationalization
This commit is contained in:
14
main.cpp
14
main.cpp
@@ -20,7 +20,7 @@
|
||||
|
||||
#include "bmsinterface.h"
|
||||
#include "utility.h"
|
||||
#include "mobile/fwhelper.h"
|
||||
#include "translator.h"
|
||||
|
||||
#include <QApplication>
|
||||
#include <QFontDatabase>
|
||||
@@ -40,9 +40,16 @@ QObject *utilitySingletontypeProvider(QQmlEngine */*engine*/, QJSEngine */*scrip
|
||||
return utility;
|
||||
}
|
||||
|
||||
QObject *translatorSingletontypeProvider(QQmlEngine *engine, QJSEngine */*scriptEngine*/)
|
||||
{
|
||||
auto *translator = new Translator(engine);
|
||||
return translator;
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
Q_INIT_RESOURCE(res);
|
||||
Q_INIT_RESOURCE(translations);
|
||||
Q_INIT_RESOURCE(qml_icons);
|
||||
Q_INIT_RESOURCE(qml_items);
|
||||
|
||||
@@ -59,16 +66,13 @@ int main(int argc, char *argv[])
|
||||
font.setStyleStrategy(QFont::PreferAntialias);
|
||||
app.setFont(font);
|
||||
|
||||
// app.setFont(QFont("Artifakt Element", 16, QFont::Medium));
|
||||
|
||||
QQmlApplicationEngine engine;
|
||||
|
||||
qmlRegisterSingletonType<BMSInterface>("Cubo", 1, 0, "BmsInterface", bmsInterfaceSingletontypeProvider);
|
||||
qmlRegisterSingletonType<Utility>("Cubo", 1, 0, "Utility", utilitySingletontypeProvider);
|
||||
qmlRegisterType<BleUart>("Cubo", 1, 0, "BleUart");
|
||||
qmlRegisterSingletonType<Translator>("Cubo", 1, 0, "Translator", translatorSingletontypeProvider);
|
||||
qmlRegisterType<Commands>("Cubo", 1, 0, "Commands");
|
||||
qmlRegisterType<ConfigParams>("Cubo", 1, 0, "ConfigParams");
|
||||
qmlRegisterType<FwHelper>("Cubo", 1, 0, "FwHelper");
|
||||
|
||||
engine.addImportPath(QStringLiteral("qrc:/"));
|
||||
engine.load(QUrl(QStringLiteral("qrc:/MainWindow.qml")));
|
||||
|
||||
Reference in New Issue
Block a user