OmegaT does not read an .xml file
Thread poster: Leonardo Orabona
Feb 11, 2022

I've never had problems with OmegaT recognizing .xml files, also because I had downloaded the Okapi Framework plugin. Unfortunately I can't get it to read in any way .xml files in which I should translate some text.

The code is more or less this:

<Strings>
<String ID="TT_RESUPPLY_SPACECRAFT_COST" Text="Cost."/>
<String ID="TT_RESUPPLY_SPACECRAFT_COST_VERBOSE" Text="Cost. This is the fee that must be paid in order to start the preparation proces
... See more
I've never had problems with OmegaT recognizing .xml files, also because I had downloaded the Okapi Framework plugin. Unfortunately I can't get it to read in any way .xml files in which I should translate some text.

The code is more or less this:

<Strings>
<String ID="TT_RESUPPLY_SPACECRAFT_COST" Text="Cost."/>
<String ID="TT_RESUPPLY_SPACECRAFT_COST_VERBOSE" Text="Cost. This is the fee that must be paid in order to start the preparation process for this resupply spacecraft."/>
<String ID="TT_RESUPPLY_SPACECRAFT_BUILD_TIME" Text="Preparation time."/>
<String ID="TT_RESUPPLY_SPACECRAFT_BUILD_TIME_VERBOSE" Text="Preparation time. This is the amount of weeks it takes to get this resupply spacecraft ready."/>
<String ID="TT_RESUPPLY_SPACECRAFT_PROPULSION" Text="Propulsion."/>
<String ID="TT_RESUPPLY_SPACECRAFT_PROPULSION_VERBOSE" Text="Propulsion."/>
<String ID="TT_RESUPPLY_SPACECRAFT_RESEARCH_TECHNOLOGY_TYPE" Text="Required research technology."/>
<String ID="TT_RESUPPLY_SPACECRAFT_RESEARCH_TECHNOLOGY_TYPE_VERBOSE" Text="Required research technology in order to be able to request this type of resupply spacecraft."/>
<String ID="TT_RESUPPLY_SPACECRAFT_CREW_SLOTS" Text="Crew slots."/>
......
</Strings>

could someone help me?
Collapse


 
Milan Condak
Milan Condak  Identity Verified
Local time: 18:48
English to Czech
The Okapi filter and Stax-Filters Feb 13, 2022

You can play with setting of Okapi filters and Stax-Filters

http://www.condak.cz/nove/2019-08/24/en/00.html

and
... See more
You can play with setting of Okapi filters and Stax-Filters

http://www.condak.cz/nove/2019-08/24/en/00.html

and

http://www.condak.cz/nove/2019-08/27/en/00.html

and

http://www.condak.cz/nove/2020-09/18/cs/00.html

Milan
Collapse


Leonardo Orabona
 
Leonardo Orabona
Leonardo Orabona
Italy
TOPIC STARTER
I don't understand... Feb 13, 2022

Milan Condak wrote:

You can play with setting of Okapi filters and Stax-Filters




I'm not quite sure what you mean....
I downloaded the filter you mentioned,
Now it reads me a few strings that get messed up near the comments. (< !-- Comment text -- >)
Also there are some texts that wrap over multiple lines while OmegaT keeps them in a single line when creating the translated document

Since I don't see the code in the first post...I try to write it differently

< Strings >
< ! Comment number 1 -- >
< String ID="string_name1" Text="text to translate 1" / >
< String ID="string_name2" Text="text to translate 2" / >
< String ID="string_name3" Text="text to translate 3" / >

< ! Comment number 2 -- >
< String ID="string_name4" Text="text to translate4" / >
< String ID="string_name5" Text="text to translate 5" / >
< String ID="string_name6" Text="sometimes the text to be translated is wrapped
like this" />

< /Strings >

I have purposely left a space between the < and > tag so that the message will recognize it



[Modificato alle 2022-02-13 09:14 GMT]

[Modificato alle 2022-02-13 09:35 GMT]

[Modificato alle 2022-02-13 09:35 GMT]


 
Samuel Murray
Samuel Murray  Identity Verified
Netherlands
Local time: 18:48
Member (2006)
English to Afrikaans
+ ...
Image of code Feb 13, 2022

Due to an ancient unfixed bug in ProZ.com's forum software, XML-like tags in a post is not displayed but interpreted. Here is an image of the code in Leonardo's post:

omegat thing

[Edited at 2022-02-13 09:33 GMT]


Leonardo Orabona
 
Samuel Murray
Samuel Murray  Identity Verified
Netherlands
Local time: 18:48
Member (2006)
English to Afrikaans
+ ...
@Leonardo Feb 13, 2022

AFAIK, OmegaT's XML filter assumes that translatable text are all outside of tags. I don't know if its possible to tell OmegaT's XML filter that the values of specific attributes (in your case, "Text") is translatable.

 
Samuel Murray
Samuel Murray  Identity Verified
Netherlands
Local time: 18:48
Member (2006)
English to Afrikaans
+ ...
Okapi and Stax Feb 13, 2022

Milan Condak wrote:
You can play with setting of Okapi filters and Stax-Filters.

Stax doesn't have an XML filter, as far as I'm aware.
The documentation of the Okapi XML filter suggests that it, too, can only translate text that is outside of any tags:
https://okapiframework.org/wiki/index.php/XML_Filter

OmegaT is not utterly incapable of being programmed to do this (for example, its HTML filter does allow one to translate certain HTML-specific attributes), but it just hasn't been programmed yet.

I would *not* recommend changing the XML file to a pseudo-HTML file, because OmegaT's HTML filter also makes additional changes to the HTML code upon saving (which is fine for HTML, but not for other types of XML).


 
Leonardo Orabona
Leonardo Orabona
Italy
TOPIC STARTER
I almost got it... Feb 13, 2022

Samuel Murray wrote:

Stax doesn't have an XML filter, as far as I'm aware.
The documentation of the Okapi XML filter suggests that it, too, can only translate text that is outside of any tags:
https://okapiframework.org/wiki/index.php/XML_Filter

OmegaT is not utterly incapable of being programmed to do this (for example, its HTML filter does allow one to translate certain HTML-specific attributes), but it just hasn't been programmed yet.

I would *not* recommend changing the XML file to a pseudo-HTML file, because OmegaT's HTML filter also makes additional changes to the HTML code upon saving (which is fine for HTML, but not for other types of XML).


I created a custom filter by inserting this:
< its:translateRule selector="//*/@Text" translate="yes"/ >.
Now I don't know if it is due to the Filters-Stax filter or to this but it seems to work partially.

However, I didn't understand why it omits some lines before the comments and now I'm really stuck...

[Modificato alle 2022-02-13 11:21 GMT]


 
Milan Condak
Milan Condak  Identity Verified
Local time: 18:48
English to Czech
My playing with filters Feb 14, 2022

Leonardo Orabona wrote:

Milan Condak wrote:
You can play with setting of Okapi filters and Stax-Filters


I'm not quite sure what you mean....


Turn-off all filters in OmegaT and turn-on ONLY ONE filter its name contain XML, step-by-step. You can change the order in list of filters.

Microsof Open XML
Wordfast TXML
XML Spreadsheet 2003
XML files (Okapi - XML Filter¨
OpenXML files (Okapi)
Wordfast Pro TXML files (Okapi)
XML files (Okapi - XML Stream Filter)

I am not a programmer or coder, I am ONLY a user who chooses a dish (filter) from the menu.

Okapi and Stax filters have authors who can write programs. So does Samuel.

Milan


 
Samuel Murray
Samuel Murray  Identity Verified
Netherlands
Local time: 18:48
Member (2006)
English to Afrikaans
+ ...
@Milan Feb 14, 2022

Milan Condak wrote:
Turn-off all filters in OmegaT and turn-on ONLY ONE filter its name contain XML.

Yes. Unfortunately, OmegaT's filter section dialog is a bit underdeveloped, and the only way to force OmegaT to use one specific XML filter, you have to disable other XML filters in that list.

Also Infix and Flash XML deal with XML files. It's quite annoying that one has to go to each and every filter and click "Edit" to see which file types it applies to.

You can change the order in list of filters.

No, you can't. You can change the order of segmentation rules, but not the order of filters. In fact, I'm not even sure how OmegaT decides which filter to use (i.e. whether OmegaT really traverses the list from top to bottom).

Okapi and Stax filters have authors who can write programs. So does Samuel.

I can only write mini-programs in AutoIt, which is generally not suitable for OmegaT.

[Edited at 2022-02-14 08:09 GMT]


 
Samuel Murray
Samuel Murray  Identity Verified
Netherlands
Local time: 18:48
Member (2006)
English to Afrikaans
+ ...
@Leonardo Feb 14, 2022

Leonardo Orabona wrote:
Also there are some texts that wrap over multiple lines while OmegaT keeps them in a single line when creating the translated document.

Yes, this is what happens when using a generic XML filter. In XML, line breaks are considered spaces, unless the XML file specifically indicates otherwise. So, unless your XML file specifically contains code that tells the XML reader that line breaks are to be "preserved", XML readers (including that filter in OmegaT) will assume that the line break should be changed into a space when writing the final file.

The lesson here is that OmegaT is fine with translating highly specific file formats, but not generic XML. Unless you're a programmer, don't try to translate XML-like files with OmegaT.


 


There is no moderator assigned specifically to this forum.
To report site rules violations or get help, please contact site staff »


OmegaT does not read an .xml file






Trados Business Manager Lite
Create customer quotes and invoices from within Trados Studio

Trados Business Manager Lite helps to simplify and speed up some of the daily tasks, such as invoicing and reporting, associated with running your freelance translation business.

More info »
CafeTran Espresso
You've never met a CAT tool this clever!

Translate faster & easier, using a sophisticated CAT tool built by a translator / developer. Accept jobs from clients who use Trados, MemoQ, Wordfast & major CAT tools. Download and start using CafeTran Espresso -- for free

Buy now! »