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

Michael torhan
United States
Local time: 20:22
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]


Epameinondas Soufleros  Identity Verified
Local time: 06:22
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]


Endre Both  Identity Verified
Local time: 05:22
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.



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

Anycount & Translation Office 3000
Translation Office 3000

Translation Office 3000 is an advanced accounting tool for freelance translators and small agencies. TO3000 easily and seamlessly integrates with the business life of professional freelance translators.

More info »
SDL Trados Studio 2019 Freelance
The leading translation software used by over 250,000 translators.

SDL Trados Studio 2019 has evolved to bring translators a brand new experience. Designed with user experience at its core, Studio 2019 transforms how new users get up and running, helps experienced users make the most of the powerful features, ensures new

More info »

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