Using HTML element's ID attribute as segment ID property

11 views
Skip to first unread message

Manuel Souto Pico

unread,
Jul 28, 2021, 7:12:35 PM7/28/21
to okapi-users
Hi there,

When I use the HTML filter from the Okapi plugin in OmegaT, text units get a generic ID such as tu1_0, tu2_0, etc.

image.png

Assuming all the elements containing translatable text units in my source HTML have an ID (as HTML attribute), would it be possible to use this ID as the segment ID?

Maybe with some option in the filter configuration?

If there's no such option, would this be a feasible enhancement?

Thanks.

Cheers, Manuel


Mihai Nita

unread,
Jul 29, 2021, 11:17:39 PM7/29/21
to Manuel Souto Pico, okapi-users
The id in html is used to generate the trans-unit resname, not the ID
That seems like correct behavior for xliff.

It is pretty rare that all elements in an html have IDs, so we would end up with a mixture of generated + from-the-html IDs
And generating IDs can't be avoided because certain items in HTML can't have IDs.
For example the attributes (area, alt, label, prompt, title, summary) are all localizable, generate separate text units, and don't have IDs.

I didn't play much (if at all) with OmegaT, but resname should also be visible there, no?
It is a pretty important xliff attribute.

Mihai


--
You received this message because you are subscribed to the Google Groups "okapi-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to okapi-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/okapi-users/CABm46bY3H_5Y5wZfAYDwcPRuOxkO7TELrBEO_nnuGAdaD_qfFA%40mail.gmail.com.

Manuel Souto Pico

unread,
Jul 30, 2021, 3:01:49 AM7/30/21
to Mihai Nita, okapi-users
Hi Mihai,

Thanks for your reply.

I'm not using XLIFF, I'm importing the HTML file directly in OmegaT, using Okapi's HTML filter (provided by the Okapi filters plugin for OmegaT).

How can I map the <div>'s id to the text unit's resname? Is that an option in the filter configuration file? I don't see it captured by default.

I understand what you mean about the HTML attributes. My HTML file is created specifically for the purpose of translation, something like this:

<body>
    <div class='cell' id='973' translate='yes'>foo</div>
    <div class='cell hide' id='974' translate='no'>no foos</div>
    <div class='cell hide' id='976' translate='no'>bar</div>
    <div class='cell' id='1522' translate='yes'>baz</div>
<body>

plus some CSS and some Javascript to enhance the preview. The client sends this HTML content in an Excel file, I convert it to HTML so as to be able to use the right HTML filter.

The translator need to see the <div>'s id in OmegaT, that's why I would like to have it displayed.

Cheers, Manuel




Reply all
Reply to author
Forward
0 new messages