lupdate-c command - github.com/rcalixte/libqt6c/cmd/lupdate-c - Go Packages (original) (raw)
LUPDATE FOR C
The lupdate-c program reads from a .c or .h source file written with libqt6c and generates a Qt translation source file (.ts) for use with either Qt Linguist and/or Qt's lreleasetools.
Example
For a usage example, see the lupdate examplefolder.
Building
This can be built from source by running go build while in this directory. The resulting binary will be static by default and named lupdate-c. There are no external dependencies.
Installation
This can also be fetched and installed by running:
go install github.com/rcalixte/libqt6c/cmd/lupdate-c@latest
If successful, this will place the lupdate-c binary at $GOPATH/bin.
Usage
Valid and supported syntax from the code file(s) containing libqt6c methods are processed into Qt translation files for use with Qt's internationalization tools.
Comments are supported with similar syntax natively supported by Qt:
// an ignored/private comment
/* an ignored/private comment block */
//: a comment for translators
/*: an included comment block for translators */
To see the full options that are available, run ./lupdate-c -h.
Execution design
- Tokenize and parse valid source file(s).
- Generate translation contexts based on the C code structure.
i. Example of valid and supported syntax structure1:
const char* txt = q_application_translate("Context", "Translated string");
QLabel* label = q_label_new3(txt);
const char* text = q_pushbutton_tr("Translated string");
QPushButton* button = q_pushbutton_new3(text); - Write out the translation file.
[!NOTE] As a workaround, all
trmethods useQObjectas the translation context.
1Only raw string and integer parameter types used in valid syntax are supported.