├── .github └── FUNDING.yml ├── .gitignore ├── LICENSE ├── README.md ├── fonts.qrc ├── fonts ├── Pacifico.ttf └── TitilliumWeb-Regular.ttf ├── i18n ├── translating-qml_de.ts ├── translating-qml_no.ts └── translating-qml_ru.ts ├── images ├── de.png ├── demo.gif ├── en.png ├── no.png └── ru.png ├── main.cpp ├── main.qml ├── qml.qrc ├── qmldir ├── qtquickcontrols2.conf ├── styles.qml ├── trans.cpp ├── trans.h └── translating-qml.pro /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | github: [retifrav] 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # C++ objects and libs 2 | 3 | *.slo 4 | *.lo 5 | *.o 6 | *.a 7 | *.la 8 | *.lai 9 | *.so 10 | *.dll 11 | *.dylib 12 | 13 | # Qt-es 14 | 15 | /.qmake.cache 16 | /.qmake.stash 17 | *.pro.user 18 | *.pro.user.* 19 | *.qbs.user 20 | *.qbs.user.* 21 | *.moc 22 | moc_*.cpp 23 | qrc_*.cpp 24 | ui_*.h 25 | Makefile* 26 | *build-* 27 | 28 | # QtCreator 29 | 30 | *.autosave 31 | 32 | #QtCtreator Qml 33 | *.qmlproject.user 34 | *.qmlproject.user.* 35 | .DS_Store 36 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 retif 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Translating QML 2 | 3 | Demonstration of dynamic switching between languages in QML application. 4 | 5 | ![Dynamic switching between languages in QML application](/images/demo.gif?raw=true "Dynamic switching between languages in QML application") 6 | 7 | Note, that Qt versions before 5.10 do not yet have [QQmlEngine::retranslate()](http://doc.qt.io/qt-5/qqmlengine.html#retranslate), and then you'll have to use the *empty string* magic trick. 8 | 9 | Beside buiding the app, you also need to compile translation files `.ts` into `.qm` wtih **Qt Translator** or **lrelease** tool and then place them into `i18n` folder within the build directory. 10 | 11 | For more details read the following article: https://retifrav.github.io/blog/2017/01/04/translating-qml-app/ -------------------------------------------------------------------------------- /fonts.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | fonts/TitilliumWeb-Regular.ttf 4 | fonts/Pacifico.ttf 5 | 6 | 7 | -------------------------------------------------------------------------------- /fonts/Pacifico.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/retifrav/translating-qml/b3a92514e4809fcc0d44c94a5b790dd045c91795/fonts/Pacifico.ttf -------------------------------------------------------------------------------- /fonts/TitilliumWeb-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/retifrav/translating-qml/b3a92514e4809fcc0d44c94a5b790dd045c91795/fonts/TitilliumWeb-Regular.ttf -------------------------------------------------------------------------------- /i18n/translating-qml_de.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | main 6 | 7 | 8 | When the communism will come, everything'll be fuckin A!<br/>It will come very soon - we just only need to wait!<br/>All the stuff will be for free, everything will be so cool!<br/>There will probably no need to even die no matter what! 9 | Wenn der Kommunismus kommt, wird alles verdammt groß!<br/>Es wird sehr bald kommen - wir müssen nur warten!<br/>Alles wird kostenlos sein, alles wird so cool sein!<br/>Es wird wohl nicht nötig sein, sogar zu sterben, egal was! 10 | 11 | 12 | 13 | I woke up after midnight and realised - <b>IT DOES</b>!<br/>Everything goes according to the plan. 14 | Ich wachte nach mitternacht auf und erkannte - <b>ES IST</b>!<br/>Alles geht nach dem plan. 15 | 16 | 17 | 18 | <font color='blue'><i>Egor Letov</i></font> 19 | <font color='blue'><i>Egor Letov</i></font> 20 | 21 | 22 | 23 | Simple button 24 | Einfache schaltfläche 25 | 26 | 27 | 28 | Some output into console 29 | Einige ausgabe in die konsole 30 | 31 | 32 | 33 | Some tooltip 34 | Einige tooltips 35 | 36 | 37 | 38 | key 39 | schlüssel 40 | 41 | 42 | 43 | game 44 | spiel 45 | 46 | 47 | 48 | sickle 49 | sichel 50 | 51 | 52 | 53 | hammer 54 | hammer 55 | 56 | 57 | 58 | star 59 | star 60 | 61 | 62 | 63 | lantern 64 | laterne 65 | 66 | 67 | 68 | -------------------------------------------------------------------------------- /i18n/translating-qml_no.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | main 6 | 7 | 8 | When the communism will come, everything'll be fuckin A!<br/>It will come very soon - we just only need to wait!<br/>All the stuff will be for free, everything will be so cool!<br/>There will probably no need to even die no matter what! 9 | Når kommunismen vil komme, everything'll være jævla kjempebra!<br/>Det vil komme veldig snart - vi trenger bare å vente!<br/>Alle ting vil være gratis, alt vil bli så kult!<br/>Det vil trolig ikke nødvendig å selv dø uansett hva! 10 | 11 | 12 | 13 | I woke up after midnight and realised - <b>IT DOES</b>!<br/>Everything goes according to the plan. 14 | Jeg våknet opp etter midnatt og realisert - <b>DET SPILLER</b>!<br/>Alt går etter planen. 15 | 16 | 17 | 18 | <font color='blue'><i>Egor Letov</i></font> 19 | <font color='blue'><i>Egor Letov</i></font> 20 | 21 | 22 | 23 | Simple button 24 | Enkel knapp 25 | 26 | 27 | 28 | Some output into console 29 | Noen utgang til konsollen 30 | 31 | 32 | 33 | Some tooltip 34 | Noen verktøytips 35 | 36 | 37 | 38 | key 39 | nøkkel 40 | 41 | 42 | 43 | game 44 | spill 45 | 46 | 47 | 48 | sickle 49 | sigd 50 | 51 | 52 | 53 | hammer 54 | hammer 55 | 56 | 57 | 58 | star 59 | stjerne 60 | 61 | 62 | 63 | lantern 64 | lykt 65 | 66 | 67 | 68 | -------------------------------------------------------------------------------- /i18n/translating-qml_ru.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | main 6 | 7 | 8 | When the communism will come, everything'll be fuckin A!<br/>It will come very soon - we just only need to wait!<br/>All the stuff will be for free, everything will be so cool!<br/>There will probably no need to even die no matter what! 9 | А при коммунизме всё будет заебись!<br/>Он наступит скоро - надо только ждать!<br/>Там всё будет бесплатно, там всё будет в кайф!<br/>Там наверное вообще не надо будет умирать! 10 | 11 | 12 | 13 | I woke up after midnight and realised - <b>IT DOES</b>!<br/>Everything goes according to the plan. 14 | Я проснулся среди ночи и понял, что - <b>ВСЁ</b>!<br/>Всё идёт по плану. 15 | 16 | 17 | 18 | <font color='blue'><i>Egor Letov</i></font> 19 | <font color='blue'><i>Егор Летов</i></font> 20 | 21 | 22 | 23 | Simple button 24 | Простая кнопка 25 | 26 | 27 | 28 | Some output into console 29 | Такой-то вывод в консоль 30 | 31 | 32 | 33 | Some tooltip 34 | Такое-то всплывающее сообщение 35 | 36 | 37 | 38 | key 39 | ключ 40 | 41 | 42 | 43 | game 44 | игра 45 | 46 | 47 | 48 | sickle 49 | серп 50 | 51 | 52 | 53 | hammer 54 | молот 55 | 56 | 57 | 58 | star 59 | звезда 60 | 61 | 62 | 63 | lantern 64 | фонарь 65 | 66 | 67 | 68 | -------------------------------------------------------------------------------- /images/de.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/retifrav/translating-qml/b3a92514e4809fcc0d44c94a5b790dd045c91795/images/de.png -------------------------------------------------------------------------------- /images/demo.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/retifrav/translating-qml/b3a92514e4809fcc0d44c94a5b790dd045c91795/images/demo.gif -------------------------------------------------------------------------------- /images/en.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/retifrav/translating-qml/b3a92514e4809fcc0d44c94a5b790dd045c91795/images/en.png -------------------------------------------------------------------------------- /images/no.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/retifrav/translating-qml/b3a92514e4809fcc0d44c94a5b790dd045c91795/images/no.png -------------------------------------------------------------------------------- /images/ru.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/retifrav/translating-qml/b3a92514e4809fcc0d44c94a5b790dd045c91795/images/ru.png -------------------------------------------------------------------------------- /main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include "trans.h" 7 | 8 | int main(int argc, char *argv[]) 9 | { 10 | QGuiApplication app(argc, argv); 11 | // QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); 12 | 13 | // set the custom font from resources 14 | int id = QFontDatabase::addApplicationFont(":/fonts/TitilliumWeb-Regular.ttf"); 15 | app.setFont(QFont(QFontDatabase::applicationFontFamilies(id).at(0))); 16 | // you can just comment this, really 17 | 18 | QQmlApplicationEngine engine; 19 | // object of our class with "magic" property for translation 20 | Trans trans(&engine); 21 | // make this object available from QML side 22 | engine.rootContext()->setContextProperty("trans", &trans); 23 | engine.load(QUrl(QLatin1String("qrc:/main.qml"))); 24 | 25 | return app.exec(); 26 | } 27 | -------------------------------------------------------------------------------- /main.qml: -------------------------------------------------------------------------------- 1 | import QtQuick 2.7 2 | import QtQuick.Layouts 1.3 3 | import QtQuick.Controls 2.0 4 | import "." // you have to have that for singleton 5 | 6 | ApplicationWindow { 7 | id: root 8 | width: 800 9 | minimumWidth: 500 10 | height: 600 11 | minimumHeight: 600 12 | visible: true 13 | title: "Translating QML application" 14 | 15 | Column { 16 | width: parent.width * 0.95 17 | spacing: 15 18 | padding: 15 19 | 20 | RowLayout { 21 | anchors.horizontalCenter: parent.horizontalCenter 22 | 23 | Button { 24 | // text: "EN" 25 | Layout.preferredWidth: 76 26 | Layout.preferredHeight: 53 27 | Image { 28 | anchors.fill: parent 29 | opacity: parent.pressed ? 0.8 : 1 30 | anchors.margins: 3 31 | source: "/images/en.png" 32 | } 33 | 34 | background: Rectangle { 35 | id: flag_en 36 | color: "grey" 37 | radius: 5 38 | 39 | states: [ 40 | State { 41 | name: "default" 42 | PropertyChanges { 43 | target: flag_en; 44 | color: "grey" 45 | } 46 | }, 47 | State { 48 | name: "clicked" 49 | PropertyChanges { 50 | target: flag_en; 51 | color: Styles.selectedColor 52 | } 53 | } 54 | ] 55 | } 56 | 57 | onClicked: { 58 | onClicked: trans.selectLanguage("en"); 59 | highlightFlag("en"); 60 | } 61 | } 62 | Rectangle 63 | { 64 | Layout.preferredWidth: 2 65 | Layout.fillHeight: true 66 | Layout.margins: 10 67 | color: "black" 68 | } 69 | Button { 70 | // text: "RU" 71 | Layout.preferredWidth: 76 72 | Layout.preferredHeight: 53 73 | Image { 74 | anchors.fill: parent 75 | opacity: parent.pressed ? 0.8 : 1 76 | anchors.margins: 3 77 | source: "/images/ru.png" 78 | } 79 | background: Rectangle { 80 | id: flag_ru 81 | color: "grey" 82 | radius: 5 83 | 84 | states: [ 85 | State { 86 | name: "default" 87 | PropertyChanges { 88 | target: flag_ru; 89 | color: "grey" 90 | } 91 | }, 92 | State { 93 | name: "clicked" 94 | PropertyChanges { 95 | target: flag_ru; 96 | color: Styles.selectedColor 97 | } 98 | } 99 | ] 100 | } 101 | onClicked: { 102 | onClicked: trans.selectLanguage("ru"); 103 | highlightFlag("ru"); 104 | } 105 | } 106 | Rectangle 107 | { 108 | Layout.preferredWidth: 2 109 | Layout.fillHeight: true 110 | Layout.margins: 10 111 | color: "black" 112 | } 113 | Button { 114 | // text: "NO" 115 | Layout.preferredWidth: 76 116 | Layout.preferredHeight: 53 117 | Image { 118 | anchors.fill: parent 119 | opacity: parent.pressed ? 0.8 : 1 120 | anchors.margins: 3 121 | source: "/images/no.png" 122 | } 123 | background: Rectangle { 124 | id: flag_no 125 | color: "grey" 126 | radius: 5 127 | 128 | states: [ 129 | State { 130 | name: "default" 131 | PropertyChanges { 132 | target: flag_no; 133 | color: "grey" 134 | } 135 | }, 136 | State { 137 | name: "clicked" 138 | PropertyChanges { 139 | target: flag_no; 140 | color: Styles.selectedColor 141 | } 142 | } 143 | ] 144 | } 145 | onClicked: { 146 | onClicked: trans.selectLanguage("no"); 147 | highlightFlag("no"); 148 | } 149 | } 150 | Rectangle 151 | { 152 | Layout.preferredWidth: 2 153 | Layout.fillHeight: true 154 | Layout.margins: 10 155 | color: "black" 156 | } 157 | Button { 158 | // text: "DE" 159 | Layout.preferredWidth: 76 160 | Layout.preferredHeight: 53 161 | Image { 162 | anchors.fill: parent 163 | opacity: parent.pressed ? 0.8 : 1 164 | anchors.margins: 3 165 | source: "/images/de.png" 166 | } 167 | background: Rectangle { 168 | id: flag_de 169 | color: "grey" 170 | radius: 5 171 | 172 | states: [ 173 | State { 174 | name: "default" 175 | PropertyChanges { 176 | target: flag_de; 177 | color: "grey" 178 | } 179 | }, 180 | State { 181 | name: "clicked" 182 | PropertyChanges { 183 | target: flag_de; 184 | color: Styles.selectedColor 185 | } 186 | } 187 | ] 188 | } 189 | onClicked: { 190 | onClicked: trans.selectLanguage("de"); 191 | highlightFlag("de"); 192 | } 193 | } 194 | } 195 | 196 | Label { 197 | topPadding: 15 198 | font.pixelSize: Styles.primaryFontSize 199 | text: qsTr("When the communism will come, everything'll be fuckin A!
" 200 | + "It will come very soon - we just only need to wait!
" 201 | + "All the stuff will be for free, everything will be so cool!
" 202 | + "There will probably no need to even die no matter what!") 203 | //+ trans.emptyString 204 | } 205 | 206 | Label { 207 | font.pixelSize: Styles.primaryFontSize 208 | text: qsTr("I woke up after midnight and realised - IT DOES!
" 209 | + "Everything goes according to the plan.") 210 | //+ trans.emptyString 211 | } 212 | 213 | Label { 214 | font.pixelSize: Styles.primaryFontSize 215 | text: qsTr("Egor Letov") 216 | //+ trans.emptyString 217 | } 218 | 219 | Button { 220 | text: qsTr("Simple button") //+ trans.emptyString 221 | font.pixelSize: Styles.primaryFontSize 222 | onClicked: console.log(qsTr("Some output into console")) //+ trans.emptyString) 223 | 224 | ToolTip.visible: pressed 225 | ToolTip.text: qsTr("Some tooltip") //+ trans.emptyString 226 | } 227 | 228 | Tumbler { 229 | width: 150 //parent.width / 3 230 | background: Rectangle { 231 | border.color: "grey" 232 | border.width: 1 233 | } 234 | 235 | delegate: ItemDelegate { 236 | // because you cannot do scripts in model(?) 237 | text: qsTr(model.title) //+ trans.emptyString 238 | opacity: 0.4 + Math.max(0, 1 - Math.abs(Tumbler.displacement)) * 0.6 239 | font.pixelSize: Styles.secondaryFontSize; 240 | } 241 | model: ListModel { 242 | ListElement { title: qsTr("key"); } 243 | ListElement { title: qsTr("game"); } 244 | ListElement { title: qsTr("sickle"); } 245 | ListElement { title: qsTr("hammer"); } 246 | ListElement { title: qsTr("star"); } 247 | 248 | // to demonstrate dynamically added items 249 | Component.onCompleted: { 250 | append({ title: qsTr("lantern") }); 251 | } 252 | } 253 | visibleItemCount: 5 254 | } 255 | } 256 | 257 | Component.onCompleted: { 258 | flag_en.state = "clicked"; 259 | } 260 | 261 | function highlightFlag(lang) 262 | { 263 | switch (lang) 264 | { 265 | case "en": 266 | flag_en.state = "clicked"; 267 | flag_ru.state = flag_no.state = flag_de.state = "default"; 268 | break; 269 | case "ru": 270 | flag_ru.state = "clicked"; 271 | flag_en.state = flag_no.state = flag_de.state = "default"; 272 | break; 273 | case "no": 274 | flag_no.state = "clicked"; 275 | flag_en.state = flag_ru.state = flag_de.state = "default"; 276 | break; 277 | case "de": 278 | flag_de.state = "clicked"; 279 | flag_en.state = flag_ru.state = flag_no.state = "default"; 280 | break; 281 | } 282 | } 283 | } 284 | -------------------------------------------------------------------------------- /qml.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | main.qml 4 | qtquickcontrols2.conf 5 | images/de.png 6 | images/en.png 7 | images/no.png 8 | images/ru.png 9 | qmldir 10 | styles.qml 11 | 12 | 13 | -------------------------------------------------------------------------------- /qmldir: -------------------------------------------------------------------------------- 1 | singleton Styles styles.qml -------------------------------------------------------------------------------- /qtquickcontrols2.conf: -------------------------------------------------------------------------------- 1 | ; This file can be edited to change the style of the application 2 | ; See Styling Qt Quick Controls 2 in the documentation for details: 3 | ; http://doc.qt.io/qt-5/qtquickcontrols2-styles.html 4 | 5 | [Controls] 6 | Style=Default 7 | 8 | [Universal] 9 | Theme=Light 10 | ;Accent=Steel 11 | 12 | [Material] 13 | Theme=Light 14 | ;Accent=BlueGrey 15 | ;Primary=BlueGray 16 | -------------------------------------------------------------------------------- /styles.qml: -------------------------------------------------------------------------------- 1 | pragma Singleton 2 | import QtQuick 2.7 3 | import QtQuick.Window 2.0 4 | 5 | Item { 6 | // primary font size for texts and tabs 7 | property int primaryFontSize: 16 // Screen.pixelDensity * Screen.devicePixelRatio 8 | // secondary font size for buttons and inputs 9 | property int secondaryFontSize: 20 // Screen.pixelDensity * Screen.devicePixelRatio 10 | // selected color 11 | property string selectedColor: "#60BD51" 12 | } 13 | -------------------------------------------------------------------------------- /trans.cpp: -------------------------------------------------------------------------------- 1 | #include "trans.h" 2 | 3 | Trans::Trans(QQmlEngine *engine) 4 | { 5 | _translator = new QTranslator(this); 6 | _engine = engine; 7 | } 8 | 9 | //QString Trans::getEmptyString() 10 | //{ 11 | // return QString(); 12 | //} 13 | 14 | void Trans::selectLanguage(QString language) 15 | { 16 | // working folder 17 | QDir dir = QDir(qApp->applicationDirPath()).absolutePath(); 18 | // #ifdef Q_OS_MACOS // crutch for Mac OS 19 | // dir.cdUp(); 20 | // dir.cdUp(); 21 | // dir.cdUp(); 22 | // #endif 23 | // qDebug() << dir.path(); 24 | 25 | if (!_translator->load( 26 | // for example, in case of "ru" language the file would be 27 | // translating-qml_ru.qm 28 | // extension is set automatically 29 | QString("translating-qml_%1").arg(language), 30 | // look for the file in i18n folder within working directory 31 | QString("%1/i18n").arg(dir.path()) 32 | ) 33 | ) 34 | { 35 | qDebug() << "Failed to load translation file, falling back to English"; 36 | } 37 | // it's a global thing, we can use it anywhere (after #including ) 38 | qApp->installTranslator(_translator); 39 | _engine->retranslate(); 40 | 41 | emit languageChanged(); 42 | } 43 | -------------------------------------------------------------------------------- /trans.h: -------------------------------------------------------------------------------- 1 | #ifndef TRANS_H 2 | #define TRANS_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | class Trans : public QObject 12 | { 13 | Q_OBJECT 14 | // that's the "magic" string for the trick (not needed anymore since Qt 5.10) 15 | //Q_PROPERTY(QString emptyString READ getEmptyString NOTIFY languageChanged) 16 | 17 | public: 18 | Trans(QQmlEngine *engine); 19 | 20 | //QString getEmptyString(); 21 | 22 | Q_INVOKABLE void selectLanguage(QString language); 23 | 24 | signals: 25 | void languageChanged(); 26 | 27 | private: 28 | QTranslator *_translator; 29 | QQmlEngine *_engine; 30 | }; 31 | 32 | #endif // TRANS_H 33 | -------------------------------------------------------------------------------- /translating-qml.pro: -------------------------------------------------------------------------------- 1 | QT += qml quick 2 | 3 | CONFIG += c++11 4 | 5 | SOURCES += main.cpp \ 6 | trans.cpp 7 | 8 | RESOURCES += qml.qrc \ 9 | fonts.qrc 10 | 11 | # Additional import path used to resolve QML modules in Qt Creator's code model 12 | QML_IMPORT_PATH = 13 | 14 | # Additional import path used to resolve QML modules just for Qt Quick Designer 15 | QML_DESIGNER_IMPORT_PATH = 16 | 17 | # The following define makes your compiler emit warnings if you use 18 | # any feature of Qt which as been marked deprecated (the exact warnings 19 | # depend on your compiler). Please consult the documentation of the 20 | # deprecated API in order to know how to port your code away from it. 21 | DEFINES += QT_DEPRECATED_WARNINGS 22 | 23 | # You can also make your code fail to compile if you use deprecated APIs. 24 | # In order to do so, uncomment the following line. 25 | # You can also select to disable deprecated APIs only up to a certain version of Qt. 26 | #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 27 | 28 | # Default rules for deployment. 29 | qnx: target.path = /tmp/$${TARGET}/bin 30 | else: unix:!android: target.path = /opt/$${TARGET}/bin 31 | !isEmpty(target.path): INSTALLS += target 32 | 33 | HEADERS += \ 34 | trans.h 35 | 36 | # list of source files containing strings for translation 37 | lupdate_only { # that way those files will be skipped by C++ compiler 38 | SOURCES = *.qml # \ 39 | # pages/*.qml 40 | } 41 | 42 | # list of language files that will store translated strings for every language we want 43 | # create i18n directory first, if you don't have it 44 | TRANSLATIONS = i18n/translating-qml_de.ts \ 45 | i18n/translating-qml_no.ts \ 46 | i18n/translating-qml_ru.ts 47 | --------------------------------------------------------------------------------