Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Can't get lupdate to work
I run the following command (as shown in the documentation) in my cmd program:
D:\QTLinguist>lupdate counterpoint.qml -ts counterpoint_en.ts
When it runs I get the following message
Found 0 source text(s) (0 new and 0 already existing).
It creates the ts file, but when I try to open it with "linguist.exe" I get an error message telling me the ts file is blank and program ends.
Maybe give lupdate the path the the source files? How should it know where to look for them?
See the documentation.
Odelphi last edited by Odelphi
@Christian-Ehrlicher Thank you for your response. The documentation I saw was very light on specifics about exactly how the command should be run. However, FYI, the qml file is in the same directory as the lupdate program. Windows will look in the current directory when a directory is not given. But just to be sure, I also ran the command by specifically indicating the exact location of the qml file in the command line. I also made sure the qml file is encoded in UTF-8 format. Still didn't work.
Windows will look in the current directory when a directory is not given.
Don't know what window should have to do with your problem
But just to be sure, I also ran the command by specifically indicating the exact location of the qml file in the command line.
I don't see where in the documentation this was stated. You have to either pass a .pro - file with all the sources or the sources lupdate should search via command line.
lupdate --helpis clear enough I would say:
Usage: lupdate--help lupdate [options] [project-file]... lupdate [options] [source-file|path|@lst-file]... -ts ts-files|@lst-file ...
@Christian-Ehrlicher You just made my point. You said, "I don't see where in the documentation this was stated. " It is not stated in the documentation that you need to put the path, so I didn't (at first) but just to be sure, I ran it again with the path but it didn't make any difference. I wish I can send you the qml file so you can do it for me. As the song says, "I don't care". The qml file is a public file on Github so there is no copyright issue. I am just using it to learn how to do translations.
You can go to: https://github.com/rogerioConstante/Contraponto
If you get it to work, let me know and tell me specifically what you did to get it to work.
BTW: I only have the lupdate, lconvert, lrelease and linguist programs on my computer. I don't need any other programs, dlls, cpps, py, or anything else on my computer to get it to work, do I?
It is not stated in the documentation that you need to put the path
Because the documentation just describes the straight-forward way when using a proper .pro - file what you do not.
If you don't follow the normal way you have to dig into the problem by yourself. The first case is checking what the tool you want to use gives you as help... but looks like this is too much to ask.
Your qml file has not a single translatable string so I don't expect that lupdate can do anything for you. Please read the documentation.
You said, "Your qml file has not a single translatable string". What does that mean? I read the documentation, but it doesn't tell me what constitutes a "translatable string". All it says is, "The lupdate command line tool finds the translatable strings in the specified source, header and Qt Designer interface files, and produces or updates .ts translation files." I thought the program went through the qml file and put qstr( <quoted string>) around anything that has quote marks around it and then write an xml code for it.
I thought the program went through the qml file and put qstr( <quoted string>)
No, it is you job to decide what needs to be translated and put it in qstr(). Why should a tool decide that?
It is even stated in the documentation: "Strings in QML can be marked for translation using the qsTr(), qsTranslate(), qsTrId(), QT_TR_NOOP(), QT_TRANSLATE_NOOP(), and QT_TRID_NOOP() functions." (link @Christian-Ehrlicher provided: https://doc.qt.io/qt-5/qtquick-internationalization.html).
@Odelphi Not thinking, reading and gathering information before assuming something.