Page MenuHomePhabricator

Allow translate attribute in wikitext content
Open, Needs TriagePublic

Description

The translate attribute is a global attribute in HTML5 to indicate whether that part should be translated. E.g. this first sentence could be written as The <code translate="no">translate</code> attribute ... to prevent automated translators from translating the name of the attribute along with the text when presenting this in a different language. In particular, text containing source code when translated into right-to-left languages will often contain errors if the translate attribute is ignored. For documentation, see:

https://www.w3.org/tr/html/dom.html#the-translate-attribute

https://developer.mozilla.org/docs/web/html/global_attributes/translate/

As always with attributes, browsers without support will just ignore it, so there shouldn't be compatibility issues.

Currently the parser (well, the sanitizer) will reject this attribute as unknown. But allowing this attribute will enable editors to improve the content of a wiki for automated translation.

Event Timeline

There are only two values permitted: yes and no.

The wikitext input should be trimmed and downcased. If it is matching the expected values, that attribute shoud be issued.

Benevolent input of wikitext editors should be granted: "0" and "1" and "-" might be translated. Perhaps true and false as well. Also <span translate> and translate="" and translate="translate" shold be converted into translate="yes" to satisfy all our XML and HTML dialects.