开发者

lupdate - common single words in the ts file?

Im learning how to use QT's translate stuff for the first time for work. They already have things working to some degree and its my job to clean things up and get it working properly as well as using lupdate to keep things in sync when they change etc. We are also using QML in which we wrote a wrapper function for all our strings, so lupdate does not find our function to add to the .ts XML file. The reason we use a wrapper is for centralizing other functions at once place for all strings. We also dont always use a string literal in our 'source' argument but a defined property, such as:

property string buttonTxt: "ButtonText"

then: commonTRFunction(context, buttonTxt)

which of course lupdate does not find for both reasons.

Ive looked into updating the lupdate source very briefly and Im not sure if its worth trying to hack it to find our function or write our own parser to find the standard QT tags AND also our new ones?

Secondly, and related to the first part, Id like a way to make one context section that contains all the common words we use in our app such as 'Back', 'Save', 'Ok' etc etc without repeating it over and over throughout the .ts file. lupdate seems to repeat things over and over in multiple cont开发者_开发知识库exts which seems both inefficient and a waste of lines in the ts file.

I haven't found any QT docs that really explain the differences between tr(), qsTr(), qsTranslate(), QT_TR_NOOP() and QT_TRANSLATE_NOOP(). I know you sometimes need a context and the source, and other times just use the source without a context. We dont use the disambigous arg. Most of our code is in QML and not C++.

Also we are running lupdate from the command line.

Does anyone have thoughts, suggestions or even a tool someone wrote that can be used for what we have? I appreciate your help.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜