Under Community Review

Enable general rules for embedded content processor

In HTML5 every element can have an attribute 'translate' (https://html.spec.whatwg.org/multipage/dom.html#the-translate-attribute). If this attribute has the value 'no' an element is not to be translated.

Studio's embedded content processor for HTML allows you to define that a specific element with attribute translate="no", but not a general rule for all elements with that attribute.

For example, this rule is is possible for element 'a':

a[@translate="no"]

But you can't define a general XPath rule for all elements. This is not possible:

*[@translate="no"]

Currently, to fully support the translate="no" attribute, you have to add a separate rule for each of the 100+ elements in HTML5.

  • Hi Paul,

    Thanks for looking into this. I should have provided an example.

    Our XML file contains an element, inside which there is CDATA with HTML. For the HTML, we would like to make a HTML elements with attribute translate="no" not translatable. As far as I can see, the parser rules for XML can't be used for this because all the HTML is CDATA in the same XML element. Here's a simplified example of the source file:

    <xml>
    <Locale>en</Locale>
    <Body><![CDATA[<a href="https://orderform.com">Place your order now</a>. For more details, click on <a href="https://productname.com" translate="no">MyProductName</a>. Use promo code <span translate="no">DISCOUNT10</span>.]]>
    </Body>
    <xml>

    The relevant text is all in the body element. The first link does not have translate="no" so its text should be translatable. The second link and the span have translate="no" so should not be translatable.

    In the HTML embedded content processor, we can define rules for individual elements, such as 
    a[@translate="no"]
    span[@translate="no"]

    But since we don't know all the HTML elements for which our authors might define translate="no" in any given file, we'd like to set a generic rule using *[@translate="no"]

    In the parser rules, that generic Xpath works, but it doesn't in the embedded content processor.

  • That somehow seems an odd thing to even think about.  If you want to have *[@translate="no"] why not simply remove the parser rule in the main XML file that you would have applied the HTML embedded content processor to?  It seems pointless to create a rule to use the embedded processor and then tell it not to translate anything.

    Or perhaps I'm missing something from your explanation?