How to translate ecma scripts

Discussion forum for C++ and script developers who are using the QCAD development platform or who are looking to contribute to QCAD (translations, documentation, etc).

Moderator: andrew

Forum rules

Always indicate your operating system and QCAD version.

Attach drawing files, scripts and screenshots.

Post one question per topic.

Post Reply
mink
Active Member
Posts: 30
Joined: Mon Jan 19, 2015 7:20 pm

How to translate ecma scripts

Post by mink » Thu Feb 05, 2015 12:08 pm

Hi again,

I'm looking around how to achieve the things I have to do ...
Just now internationalisation.

To make a text literal translateable, I enclose it into qsTr("").
Then I can extract the Strings with lupdate, use linguist to do the actual translation, and then use lrelease. Fine.

But: Is the lupdate / lrelease thing included in qmake process? I probalbly overlooked it ...

I cannot imagine that you do it manually for QCad.
Does there exist something like a howto, or can you please give me direction?

Thanks in advance and
Regards,

Ulrich

User avatar
andrew
Site Admin
Posts: 9037
Joined: Fri Mar 30, 2007 6:07 am

Re: How to translate ecma scripts

Post by andrew » Thu Feb 05, 2015 1:46 pm

mink wrote:But: Is the lupdate / lrelease thing included in qmake process? I probalbly overlooked it ...
No. lupdate / lrelease are relatively slow, so running them on every build would not be practical.
I cannot imagine that you do it manually for QCad.
I do use some bash scripts to update and release translations. The script to update simply runs lupdate on the top level .pro file, lupdate updates recursively.

However, lrelease does not work recursively, so here I do something along the lines of:
for f in `find src -name "*.pro"`; do
    lrelease $f
done

mink
Active Member
Posts: 30
Joined: Mon Jan 19, 2015 7:20 pm

Re: How to translate ecma scripts

Post by mink » Thu Feb 05, 2015 3:18 pm

Thanks, Andrew, as always a very informative anser. I will dig into the lupdate / lrelease parameter and follow the bash aproach. This was I can restrict on my sources / scripts.

BTW, does the shared_ts.pri in the root of the source files give the correct clues?

Regards,

Ulrich

User avatar
andrew
Site Admin
Posts: 9037
Joined: Fri Mar 30, 2007 6:07 am

Re: How to translate ecma scripts

Post by andrew » Thu Feb 05, 2015 3:30 pm

mink wrote:BTW, does the shared_ts.pri in the root of the source files give the correct clues?
This file defines the list of translation files that will be generated for all QCAD tools. If you want to generate the same translation files for your scripts, you can include this .pri file in your .pro files. Alternatively, you can simple define your own list of translations in your .pro file or in a shared .pri file included by all your scripts.

The misc tools for example only support a small subset of these translations as defined in scripts/Misc/translations.pri

Post Reply

Return to “QCAD Programming, Script Programming and Contributing”