-
Notifications
You must be signed in to change notification settings - Fork 657
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
[css-text] Allow alias for language hyphenation #5270
Comments
That seems very reasonable to me, although I'd suggest a syntax more like: :lang(pli) { hyphenate-language-fallback: la; } I would have gone with |
Oh yes, that looks much better, thanks! And yes, a comma separated list would be ideal. |
Labelling this to get feedback from internationalization experts, but I agree that this sounds like a good proposal. We definitely don't want authors to hack around with incorrect language tags just to get hyphenation! |
Wouldn't it make more sense to build this information into CLDR and have the aliasing built into the browser? |
@fantasai I'm not really sure how all this works, but my concern would be that this should be left up to the site designer. It's hard to say that X language hyphenation will be an adequate fallback for Y language in all cases; whereas it is, I think, possible to say that it will work in this case. As with most typographic refinements, there are pluses and minuses, and the site designer would need to weigh them up. |
@sujato One way to solve this issue is to come up with a reasonable default set of aliases (if possible) and add the aliases to the user agent style sheet (or just add them to css-text as the default hyphenation behavior), and the author can override them in their own style sheet. |
Sure, that might work, so long as it is possible to override the defaults. Personally I prefer to let people opt in, but I will leave that to the experts! |
The CSS spec provides for hyphenation of text, leaving the choice of language up to the UA:
https://www.w3.org/TR/css-text-4/#hyphenation
Currently Firefox offers the best support, but even they only support fairly small subset of the world's languages.
https://developer.mozilla.org/en-US/docs/Web/CSS/hyphens
The thing is, it is sometimes better to have imperfect hyphenation than none at all. No hyphenation can result in a broken UI and unreadable text, whereas imperfect hyphenation might work fine, or at worst be merely inelegant.
I work with texts in Pali and Sanskrit, which can have very long words formed by compounding. There is no browser support for hyphenation for these, nor is there likely to be. Surely these are not the only languages affected. Here is a typical example, rendered in firefox:
It is possible to hack around this by activating hyphens and setting
lang='la'
:This is identical to the result that a proper Pali hyphenation would produce. Note that in tradition Indic orthography, there is no concept of a correct breakpoint; scribes merely wrote to the end of the line and continued on the next line. Thus the traditional practice would agree with the idea that sometimes any breakpoint is better than none.
However, it's obviously not a good idea to deliberately set a false language. Hence my proposal:
Allow the CSS to declare a language alias for hyphenation.
So the text language is unaffected, and the HTML does not change. But the user can declare via CSS something like:
Meaning: "for the purpose of hyphenation, Latin and Pali may be substituted."
Such substitution would apply only if explicit support for that language is missing. So if
lang='pli'
is set on the HTML, then if one UA has support for Pali hyphens, that is used, if not, it looks for support for Latin.The text was updated successfully, but these errors were encountered: