[Interest] Translation Qt Quick Apps (Qt 5.6 qt.labs.controls)

ekke ekke at ekkes-corner.org
Fri Feb 12 13:04:53 CET 2016


Hi,

while evaluating Qt 5.6 for Android / iOS and preparing blogs with
recipes for BlackBery Cascades developers HowTo go with Qt 5.6 I run
into a problem.

Using Cascades (qt 4.8) translation is easy:

  * Open Projectfile (bardescriptor.xml)
  * add languages

and you're done. All the work under the hood: creation of .ts files and
generating .qm files was done automagically.
I only had to use QtLinguist, translate the strings, save, go back to
Eclipse Momentics, refresh and run on device.

Have expected something similar with Qt Creator and learned that there
are many steps of file creation, copy files, running commands from
commandline:
https://blog.qt.io/blog/2014/03/19/qt-weekly-2-localizing-qt-quick-apps/

fortunately I found this article:
https://wiki.qt.io/Automating_generation_of_qm_files

then looked at
https://qt.gitorious.org/qt-labs/weather-app?p=qt-labs:weather-app.git;a=blob_plain;f=weatherapp.pro;hb=HEAD

tried to understand all what happened inside the .pro and thought that I
added the important parts to a .pro file from my sample. project.
Here's the .pro - the part below qml.qrc was inserted by me

TEMPLATE=app

QT+=qmlquick

CONFIG+=c++11

SOURCES+=main.cpp

#AdditionalimportpathusedtoresolveQMLmodulesinQtCreator'scodemodel

QML_IMPORT_PATH=

#Defaultrulesfordeployment.

include(deployment.pri)

RESOURCES+=qml.qrc

#var,prepend,append

defineReplace(prependAll){

for(a,$$1):result+=$$2$${a}$$3

return($$result)

}

#Supportedlanguages

LANGUAGES=deen

#Availabletranslations

TRANSLATIONS=$$prependAll(LANGUAGES,$$PWD/translations/EkkesSampleApp_,.ts)

#Usedtoembedtheqmfilesinresources

TRANSLATIONS_FILES=

#runLRELEASEtogeneratetheqmfiles

qtPrepareTool(LRELEASE,lrelease)

for(tsfile,TRANSLATIONS){

qmfile=$$shadowed($$tsfile)

qmfile~=s,\\.ts$,.qm,

qmdir=$$dirname(qmfile)

!exists($$qmdir){

mkpath($$qmdir)|error("Aborting.")

}

command=$$LRELEASE-removeidentical$$tsfile-qm$$qmfile

system($$command)|error("Failedtorun:$$command")

TRANSLATIONS_FILES+=$$qmfile

}

#TRANSLATIONS-Createextratargetsforconvenience

wd=$$replace(PWD,/,$$QMAKE_DIR_SEP)

#LUPDATE-Makenewtargetsforeachandalllanguages

qtPrepareTool(LUPDATE,lupdate)

LUPDATE+=-locationsrelative-no-ui-lines

TSFILES=$$files($$PWD/translations/QuickForecast_*.ts)$$PWD/translations/EkkesSampleApp_untranslated.ts

for(file,TSFILES){

lang=$$replace(file,.*_([^/]*)\\.ts,\\1)

v=ts-$${lang}.commands

$$v=cd$$wd&&$$LUPDATE$$SOURCES$$APP_FILES-ts$$file

QMAKE_EXTRA_TARGETS+=ts-$$lang

}



But getting an error:

12:14:37: Starting: "/usr/bin/make"

/daten/_QT/5.6/android_armv7/bin/qmake -spec android-g++ CONFIG+=debug
CONFIG+=qml_debug -o Makefile ../EkkesSampleApp/EkkesSampleApp.pro

lrelease error: Cannot open
/daten/_qt_work/EkkesSampleApp/translations/EkkesSampleApp_de.ts: No
such file or directory

Project ERROR: Failed to run: /daten/_QT/5.6/android_armv7/bin/lrelease
-removeidentical
/daten/_qt_work/EkkesSampleApp/translations/EkkesSampleApp_de.ts -qm
/daten/_qt_work/build-EkkesSampleApp-Android_f_r_armeabi_v7a_GCC_4_9_Qt_5_6_0-Debug/translations/EkkesSampleApp_de.qm

make: *** [Makefile] Error 3

12:14:37: The process "/usr/bin/make" exited with code 2.

Error while building/deploying project EkkesSampleApp (kit: Android für
armeabi-v7a (GCC 4.9, Qt 5.6.0))

When executing step "Make"


Am I  missing anything ?
Or do I have to add something to the project ?

Tried creating the folder translations inside project from OSX Finder
but didn't help.
Or must folders added another way from inside Qt Creator.

thx helping

ekke
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20160212/1235723e/attachment.html>


More information about the Interest mailing list