Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

translate="attributes" #10766

Open
Zhang-Junzhi opened this issue Nov 15, 2024 · 2 comments
Open

translate="attributes" #10766

Zhang-Junzhi opened this issue Nov 15, 2024 · 2 comments
Labels
addition/proposal New features or enhancements needs implementer interest Moving the issue forward requires implementers to express interest

Comments

@Zhang-Junzhi
Copy link

Zhang-Junzhi commented Nov 15, 2024

The spec says the translate attribute is used to specify whether an element's attribute values and the values of its Text node children are to be translated when the page is localized, or whether to leave them unchanged. It's all-or-nothing.

But there's middle ground use cases where we only want attributes to be translated while keeping content inside unchanged:

<!--We want the aria-label to be translatable but not the content inside the user-edited content-->
<div aria-label="something editor" contenteditable role="textbox" translate="???"></div>

So I suggest adding a new value "attributes" to the translate attribute.

@annevk annevk added addition/proposal New features or enhancements needs implementer interest Moving the issue forward requires implementers to express interest labels Nov 15, 2024
@zcorpan
Copy link
Member

zcorpan commented Nov 18, 2024

Maybe browsers could avoid translating content in editing hosts? Are there other use cases except for contenteditable?

@Zhang-Junzhi
Copy link
Author

Zhang-Junzhi commented Nov 19, 2024

Maybe browsers could avoid translating content in editing hosts? Are there other use cases except for contenteditable?

I haven't seen any spec paragraphs about the contenteditable attribute that mention translate. Conversely, the same applies.

My personal view is that perhaps enabling translation within contenteditable elements could also meet some needs(For example, the user intentionally wants to translate the content altogether after the edition is completed). So I believe it would be better not to prohibit the translation functionality of contenteditable.

The contenteditable use case I previously raised is widely used in rich media editors. So, I believe that even a sole use case like this might still be an adequate reason to support the new feature.

In response to non-contenteditable use cases: A non-contenteditable scenario that comes to my mind is: in a language learning webpage, some element displays the translation result, and this element has an aria-label attribute.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
addition/proposal New features or enhancements needs implementer interest Moving the issue forward requires implementers to express interest
Development

No branches or pull requests

3 participants