[Qt-interest] Translating a xml file using lupdate

Jordan Tcolov mazzzterz at gmail.com
Tue Sep 13 12:47:14 CEST 2011


Just after I posted I found another solution.

<?xml version="1.0" encoding="UTF-8"?>
> <buttons_definitions>
> <buttons>
>
> <!-- Two state buttons -->
>     <button id="0" name="POS">
>         <text0>QT_TRANSLATE_NOOP("XML_Buttons", "Position")</text0>
>     </button>
>
>     <button id="1" name="PROGRAM">
>         <text0>QT_TRANSLATE_NOOP("XML_Buttons", "Program")</text0>
>     </button>
>
> </buttons>
> </buttons_definitions>
>

It's better than the previous and I just have to remove QT_TRANSLATE_NOOP
from the string when reading it which isn't that much of work, but I want to
ask if there is anyway that I can point lupdate that I want to translate
text between the tags <text0></text0>, <text1></text1>, <text2></text2> and
so ?


On Tue, Sep 13, 2011 at 13:24, Jordan Tcolov <mazzzterz at gmail.com> wrote:

> Hi !
> I have some text that are located in XML file and in my project I use these
> texts to show them on buttons and I want to translate them, but I don't know
> how to do that. I managed to workaround it to generate a ts file with
> translation, but... I don't like the approach. Here is how I did it:
>
> Original not translatable file: somename.xml
>
> <?xml version="1.0" encoding="UTF-8"?>
>> <buttons_definitions>
>> <buttons>
>>
>> <!-- Two state buttons -->
>>     <button id="0" name="POS">
>>         <text0>Position</text0>
>>     </button>
>>
>>     <button id="1" name="PROGRAM">
>>         <text0>Program</text0>
>>     </button>
>>
>> </buttons>
>> </buttons_definitions>
>>
>
>
> File with which I got translation in ts file: somename.xml.ui
>
>  <?xml version="1.0" encoding="UTF-8"?>
>> <class>XML_Buttons</class>
>> <buttons_definitions>
>> <buttons>
>>
>> <!-- Two state buttons -->
>>     <button id="0" name="POS">
>>         <text0><string>Position</string></text0>
>>     </button>
>>
>>     <button id="1" name="PROGRAM">
>>         <text0><string>Program</string></text0>
>>     </button>
>>
>> </buttons>
>> </buttons_definitions>
>>
>
> I don't want to change the extension to "ui" and I don't want <class> and
> <string> tags floating around. Is there any other way I can do this ?
>
> Thanks in advace.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20110913/68c6750e/attachment.html 


More information about the Qt-interest-old mailing list