html icon indicating copy to clipboard operation
html copied to clipboard

support title element containing partially translatable text

Open Zhang-Junzhi opened this issue 3 years ago • 2 comments

As a title element's content model is Text-only, a page title can only be in completely translate-enabled state, or completely no-translate state, according to the title's translate mode. There's no way to make a page partially translatable.

There's vital use cases where it makes sense to make a page title partially translatable. For example, I am writing a web glyph editor's page, whose title's format is: <char> HexUnicode some translatable text, where char is the character the glyph editor user is currently editing.

It obviously doesn't make sense to make char translatable while it does so for other parts of the title.

If some element is allowed to be contained in the title, then it will become possible to achieve the partially translatable feature(Let's just take <span> for example):

<title><span translate="no">&lt;字&gt;</span> U+5B57 ...</title>

Any thoughts? Hope to hear from you.

Zhang-Junzhi avatar Aug 01 '22 07:08 Zhang-Junzhi

For what it's worth, the i18n WG also advises against creating any plain text elements when they may contain translatable text, because it may also be necessary to vary the language and direction of the text content inline. We successfully persuaded the XHTML2 folks to change their approach, but were unable to convince the HTML folks. You instead need to fiddle with Unicode formatting characters (if you know what they are) to apply direction.


Btw, you are likely to encounter other problems with your example. If you take the case where the code point referred to is from a RTL script, such as Hebrew, Chrome will analyse the direction of the title content by examining the first directionally strong character (in this case a RTL character), and set the display direction accordingly. That is, for a page written in English (LTR):

<title>א U+05D0 HEBREW LETTER ALEF</title>

will be displayed as

Screenshot 2022-08-01 at 10 49 27

rather than keeping the character itself on the left and truncating on the right. Adding dir to the title element doesn't seem to help.

r12a avatar Aug 01 '22 09:08 r12a

@r12a Good point. It might be better to clarify the dir attribute's effect to the displayed page title in the spec, though it seems more of an UA implementation thing.

Furthermore, the idea of supporting bidi-directional elements, such as <bdi>, <bdo>, in a title element came to my mind. It might be better these issues can be resolved together.

I am going to file a new issue in this regrad, and then reference it to this issue.

Zhang-Junzhi avatar Aug 01 '22 10:08 Zhang-Junzhi