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

ekke ekke at ekkes-corner.org
Fri Feb 12 13:08:11 CET 2016


formatting of inserted text was ugly
added as .txt file

Am 12.02.16 um 13:04 schrieb ekke:
> 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
>
> T..... see attached .tx file
>     
>     
>
>     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
>     
>
>   
>
>
>
>
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest
>
>
-- 

ekke (ekkehard gentz) independent software architect international
development native mobile business apps BlackBerry 10 | Qt Mobile
(Android, iOS) workshops - trainings - bootcamps *BlackBerry Elite
Developer BlackBerry Platinum Enterprise Partner* max-josefs-platz 30,
D-83022 rosenheim, germany mailto:ekke at ekkes-corner.org blog:
http://ekkes-corner.org apps and more: http://appbus.org twitter:
@ekkescorner skype: ekkes-corner LinkedIn:
http://linkedin.com/in/ekkehard/ Steuer-Nr: 156/220/30931 FA Rosenheim,
UST-ID: DE189929490

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

TEMPLATE = app

QT += qml quick

CONFIG += c++11

SOURCES += main.cpp

# Additional import path used to resolve QML modules in Qt Creator's code model
QML_IMPORT_PATH =

# Default rules for deployment.
include(deployment.pri)

RESOURCES += qml.qrc

# var, prepend, append
 defineReplace(prependAll) {
     for(a,$$1):result += $$2$${a}$$3
     return($$result)
 }
# Supported languages
LANGUAGES = de en
# Available translations
TRANSLATIONS = $$prependAll(LANGUAGES, $$PWD/translations/EkkesSampleApp_, .ts)
# Used to embed the qm files in resources
TRANSLATIONS_FILES =
# run LRELEASE to generate the qm files
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("Failed to run: $$command")
     TRANSLATIONS_FILES += $$qmfile
 }

 # TRANSLATIONS - Create extra targets for convenience
 wd = $$replace(PWD, /, $$QMAKE_DIR_SEP)
 # LUPDATE - Make new targets for each and all languages
 qtPrepareTool(LUPDATE, lupdate)
 LUPDATE += -locations relative -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
 }

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"


More information about the Interest mailing list