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

Avoid human text in attributes #3

Closed
michael-n-cooper opened this issue Jul 13, 2017 · 4 comments
Closed

Avoid human text in attributes #3

michael-n-cooper opened this issue Jul 13, 2017 · 4 comments
Assignees
Labels
action required i18n-tracker Group bringing to attention of Internationalization, or tracked by i18n but not needing response.

Comments

@michael-n-cooper
Copy link
Member

An internationalization principle is that text should not be in attributes. Properties should be structured in a way not to use that design.

@johnfoliot
Copy link
Contributor

"...[human] text should not be in attributes"

Not sure what you mean here:

  • @alt="Government of Canada / Gouvernement du Canada" (English/French: https://www.canada.ca/home.html)

  • @aria-label="Print this document" | aria-label"このドキュメントを印刷する" (English version, Japanese version)

Attributes and elements are always written in English. When attributes require author-supplied strings, they are traditionally in the language of the document. However, because they are flat text strings, they cannot be formatted, nor can additional attributes be applied to those values, so for example in the first Canadian example, pronunciation of the text string will be impacted by the native language of the document (lang="en"), so screen readers may struggle with properly pronouncing 'Gouvernement' (en francais).

@michael-n-cooper michael-n-cooper added the i18n-tracker Group bringing to attention of Internationalization, or tracked by i18n but not needing response. label Aug 31, 2021
@michael-n-cooper
Copy link
Member Author

Asking I18N to weigh in, MC will defer to their opinion

@xfq
Copy link
Member

xfq commented Sep 1, 2021

FWIW, this is mentioned in i18n WG's guidance for spec developers.

@r12a
Copy link

r12a commented Sep 2, 2021

It's not clear to me what is the context that gave rise to the initial comment by @michael-n-cooper, so it's difficult to know what to say here.

@xfq 's link certainly provides useful guidance. We strongly recommend that when designing markup you avoid creating attributes which contain text that a user will read. Unfortunately, although we made progress on this for XHTML2, we were unable to convince the HTML5 folks to provide better alternatives for alt, title, etc. Which means that examples such as those @johnfoliot provides above are problematic because you can't identify language correctly when (a) it changes within the attribute value, and (b) if the attribute value is in a different language than the element text. (Similar issues for directionality.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
action required i18n-tracker Group bringing to attention of Internationalization, or tracked by i18n but not needing response.
Projects
None yet
Development

No branches or pull requests

6 participants