Modify standard HTML filter so it picks up some attributes in other tags?
Thread poster: Michael torhan

Michael torhan
United States
Local time: 14:43
Spanish to English
+ ...
Jul 27, 2015


I just finished (well, almost) a large website and there are a few items that I see still need to be translated, but they were never presented to me in DVX3.

It turns out that for the HTML "input" tag has an optional attribute "placeholder=", and this attribute was never picked up as a translatable item.

I'm a former tech guy, so maybe there is a way to tweak the standard HTML filter so that it picks up this attribute? I'd rather not have to go into the affected DVX3-generated HTML files and manually do the translation because I won't be able to easily repeat the process later when the client makes changes.

Is there a way to pick up this attribute? Or a reason why it was omitted?

Thanks. Mike

[Edited at 2015-07-27 19:18 GMT]

[Edited at 2015-07-27 19:19 GMT]

Direct link Reply with quote

Epameinondas Soufleros  Identity Verified
Local time: 00:43
Member (2008)
English to Greek
+ ...
DejaVu's HMTL filter is awful Jul 27, 2015

According to my experience, DejaVu has a terrible HTML filter. In my case, when exporting an HTML translated into Greek, it exports every single character as an HTML entity... Even if I haven't checked the corresponding option in the export settings!

So, I doubt it can do what you need, which is more 'sophisticated'.

[Edited at 2015-07-27 22:41 GMT]

Direct link Reply with quote

Endre Both  Identity Verified
Local time: 23:43
Member (2002)
English to German
Try the XML filter Jul 28, 2015

DéjáVu's HTML filter unfortunately has virtually no options, in particular none to import specific attributes. The options I see are as follows:

You convert the placeholder attribute to an alt attribute whose text the HTML filter imports (at least in certain types of tags: img and input yes, p no). You'd have to make sure you have a way of converting the alt attributes back to placeholder after export. If you don't have any other alt attributes in the file, a simple regex search and replace is sufficient, but if you have (mostly in img tags), you might have to analyse the HTML tree structure to only convert back the alt attributes in the input tags, not img tags. You'd have to do some programming for that.

Use the XML filter. You can create XML filters from scratch that give you fine-grained control over what attributes to import. But the HTML file would have to be in XHTML format for that. The XML filter chokes for example on the unclosed input tags typical of HTML that is not XML-compliant.

Do some preprocessing on the input files to extract the attributes to a (temporary) tag that is picked up by the HTML filter. Again, this would require programming.

All of the above is only really practical for future files, not already imported ones as you'd have to reimport and retranslate them from the TM.

For already imported files, what you can do is edit the tags (which contain the attributes) manually (highlight the code and hit Shift-F6). Not very convenient but if you have only very few occurrences in an otherwise huge file that would be a pain to reimport and retranslate, then maybe it could be done.


Direct link Reply with quote

To report site rules violations or get help, contact a site moderator:

Moderator(s) of this forum
Pavel Tsvetkov[Call to this topic]

You can also contact site staff by submitting a support request »

Modify standard HTML filter so it picks up some attributes in other tags?

Advanced search

PerfectIt consistency checker
Faster Checking, Greater Accuracy

PerfectIt helps deliver error-free documents. It improves consistency, ensures quality and helps to enforce style guides. It’s a powerful tool for pro users, and comes with the assurance of a 30-day money back guarantee.

More info »
Wordfast Pro
Translation Memory Software for Any Platform

Exclusive discount for users! Save over 13% when purchasing Wordfast Pro through Wordfast is the world's #1 provider of platform-independent Translation Memory software. Consistently ranked the most user-friendly and highest value

More info »

  • All of
  • Term search
  • Jobs
  • Forums
  • Multiple search