Question

I am trying to get localization running under windows by using poedit. So far everything is fine. Unfortunately I do have XML-files which require some attributes to be translated. Example:

<CMD ID="MK">
    <SETUP_NAME NAME="Set active setting">
    <TAG_NAME>TAG_SET_ACTIVE_SETTING</TAG_NAME>
        <TAG_ID>0241</TAG_ID>
        <TAG_TYPE>FORMAT_SHORT</TAG_TYPE>
            <NO_OF_ELEMENTS>1</NO_OF_ELEMENTS>
            <ELEMENT>
                <VAL_TYPE>word</VAL_TYPE>
                <DESCRIPTION>The currently used setting</DESCRIPTION>
                <MIN_VAL>1</MIN_VAL>
                <MAX_VAL>19</MAX_VAL>
            </ELEMENT>
            <TAG_AVAILABLE>true</TAG_AVAILABLE>
        </SETUP_NAME>

I want to translate the attribute content of NAME of the tag SETUP_NAME. I could not figure out how to get this running. Extracting the content of the tags works fine.

Any help is appreciated!

Regards,

Zett

Was it helpful?

Solution

You can use the xgettext -a, --extract-all flag to extract all quoted strings in your XML file.

In POEdit, create a new parser that looks for XML files:

Under Preferences, go to the Parsers tab and hit New. Then enter:

Language:

XML

List of extensions separated by semicolons:

*.xml

Parser command:

xgettext -LC --extract-all -o %o %C %F

An item in keywords list: - leave empty

Item in input files list:

%f

source code charset:

--from-code=%c

And hit OK.

Make sure you add the path where your XML lives to you PO file propeties and you should be able to run Catalogue > Update from sources

This should forcefully extract any quoted strings into your PO file.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top