Open pols12 opened 2 years ago
That bit in Lists is about the value, not how the value is represented in text. It just means that host languages with some notion of counters, like HTML's ol
, should handle this by using the list-item
counter. How that counter value is displayed is an entirely separate issue.
I'm not opposed to a counter-style that varies its display depending on the language of the element, but we'd need to do some work mapping the styles (and choosing a default for a given language, when there are multiple that could apply). Note that directional mapping is already well-defined by Unicode data, so we didn't have to do any extra work there.
Importantly, we also need a concrete use-case - is there a page that this would help you on, where you're currently working around it manually by varying the counter style?
Note that directional mapping is already well-defined by Unicode data, so we didn't have to do any extra work there.
Do you have a link to that map, please? That would help me to implement workaround for this issue.
Importantly, we also need a concrete use-case - is there a page that this would help you on, where you're currently working around it manually by varying the counter style?
I work on page internationalization on Wikimedia Meta-Wiki. For a given source page with a custom stylesheet (“templateStyles”), all translation pages use the same stylesheet. Since inline-start
is not well supported by browser, MediaWiki uses CSSJanus to flip left
into right
. However we currently don’t have any “magical” workaround for list-style-type
property.
On that page (partially) translated in Hindi, I would expect upper-alpha
markers to be readable by Hindi speakers, that is, even being decimals instead of letters (probably devanagari
).
A more generic use case, in MediaWiki core: https://phabricator.wikimedia.org/source/mediawiki/browse/master/resources/src/mediawiki.skinning/i18n-ordered-lists.less
Do you have a link to that map, please? That would help me to implement workaround for this issue.
It's based on the unicode bidi algorithm, not a direct script mapping. Individual characters can have a directionality, and you can then obtain a direction for text based on analyzing the characters used. I think all the details are in Unicode TR9.
I work on page internationalization on Wikimedia Meta-Wiki. For a given source page with a custom stylesheet (“templateStyles”), all translation pages use the same stylesheet.
Oh, interesting! All right, sounds reasonable to me at least. ^_^
Agenda+ to discuss the possibility of adding a "localized numeric" value, that maps to one of the predefined numeric types based on the element language.
(How should I ping the i18n WG for feedback on this? @r12a ?)
lower-alpha as an alias of lower-latin on English pages, hiragana on Japanese pages…
This specific suggestion doesn't work because lower-alpha
is already a value that means the same thing as lower-latin
.
lower-alpha
is already a value that means the same thing aslower-latin
This seems me a bit latin-script centered. We could specify that alias as deprecated for a while, but we may indeed want another (temporary or not) name to avoid confusion in documents which mention some items with their respective alpha symbol.
Yeah, a lot of the web is latin-centric, unfortunately.
That alias has been around for literally 20 years, tho. It's not getting deprecated.
(That said, using "alpha" to refer to hiragana is incorrect too; it's not an alphabet, it's a syllabary. Having "alpha" refer specifically to the latin alphabet does exclude other alphabetic languages, but at least it's by a huge amount the most commonly used alphabet in the world.)
I just read this thread, and here are some thoughts off the top of my head...
It may indeed be useful to have some generic keywords, but i expect that the mapping from counter-styles to keywords is something the author should be able to do – rather than expecting a registry or depending on the browser implementers to create the mappings.
That would mean creating a syntax that allows authors to map keywords to particular styles, themselves. This would also give authors the ability to specify their own custom styles, which i think will be a major advantage - not only for allowing alternate styling (such as for affixes), but allowing them to use completely new styles (there are certainly more than we have documented so far - in fact i'm about to add a bunch to the ready-made cs doc).
Presumably the styles assigned to a keyword would need to be associated with BCP47 language tags to apply the right style to the content.
That syntax could also allow authors to define their own keywords, rather than requiring them to squeeze their view of the world into some standardised set, which is likely to always be not quite what's needed, or biased towards Latin, or this or that.
It may be helpful, however, to suggest some keywords, such as numeric
, alphabetic
, additive
– these being types of enumeration. We may, though, need to allow a combination of keywords to define a set, such as "alphabetic uppercase" - which would produce the intersection of those two definitions – though that may be going a bit too far.
@r12a You seem to describe actual @counter-style
specifications. And I’m not sure to understand how it is related to this issue.
A few thoughts:
If I am working with Hindi data and I require Devanagari digits when programming I have to use the language identifier hi-IN-u-nu-deva when working with the data.
Personally, I would refer the developer specifying the counter (as is currently the practice) or having browsers switch counter systems if the language tag specifies a number system to use.
@r12a You seem to describe actual @counter-style specifications. And I’m not sure to understand how it is related to this issue.
I may be mistaken, but i think you are asking for the ability to use a generic keyword which will trigger the application of a particular type of counter style, dependent on the context (usually language). For example, list-item-type:digits
might apply the arabic-indic
counter style for text in Arabic, the bengali
style if the text is labelled as Bengali, the myanmar
style for Burmese text, and so on. (And presumably default to the decimal
style if there is no defined digit-based counter style for the language of the text.)
So then i was thinking around how we would define those generic keywords, and how we would map actual counter style definitions to them.
So we might end up with a declaration something like (off the top of my head):
generic-counter-style: "digits" {
'ar':'arabic-indic',
'bn':'bengali',
'my':'myanmar',
'az-arab':'arabic-indic',
'suz':'my-own-sunuwar-style',
.... }
Is that what you were thinking of?
Is that what you were thinking of?
Yes. Thank you, for your detailed explanations! I indeed want to use the same style sheet for the same text translated in several languages.
i expect that the mapping from counter-styles to keywords is something the author should be able to do – rather than expecting a registry or depending on the browser implementers to create the mappings.
I understand through your various comments, including andjc’s one, that mapping would be hard to define precisely. However, that would much help if i18n standard experts like you provide a basic mapping usable by browsers, rather than leaving each web developer trying to create their own one gathering community snippets on the web. OK, not many websites expect to support multilingual texts as Wikimedia do. But still useful, though, in my opinion.
The CSS Working Group just discussed [css-counter-styles-3] Support automatically localized counters
.
Proposed grammar:
/* generically */
@generic-counter-style <generic-family-name> [ <lang-tag> <counter-style-name> ]#;
/* specific examples */
@generic-counter-style numbers "en" decimal, "zh" cjk-decimal;
@generic-counter-style letters /* same stuff */;
The generic names are predefined, like generic font families. I think "numbers" is reasonable as a name but we'd probably want to come up with a better name for "letters".
These generic names would be added to the list of non-overrideable names. Multiple occurrences of the rule for a given generic family cascade together; you can override a given language's associated style. Language tags already have a notion of hierarchy, so we'd apply that here a la shorthands - "en" trinary
would override a preceding "en"
, but also all preceding "en-US"
, "en-GB"
, etc pairs.
If there's no matching language tag we fall back to a basic maximally-compatible one: numbers
defaults to decimal
, letters
defaults to lower-alpha
.
I did at one point wonder whether the generic family names should be the same as our counter style types: ie. numeric
, additive
, alphabet
, fixed
... But then i thought that people may actually want to mix and match the types if one style is more common than another for certain languages.
The same might be true when using numbers
and letters
as the keywords. So then i started thinking that perhaps that keyword should just be user defined.
So the generic family name could be numbers
if you wanted and expected only to use numeric styles, but it could be wikipedia-styles
if you liked, so that you could use additive styles for some languages, alphabetic for others, and numeric for the rest.
Only issue with making the namespace user-defined is we need to define what happens when a counter style is defined both by @counter-styles
and @generic-counter-style
. Presumably generic would win, but that's not clear.
Similarly to
inline-start
keyword which may mean “right” or “left” depending on the language, I think we should supportdigits
as an alias ofdecimal
on English pages,arabic-indic
on Arabic pages,armenian
on Armenian pages…lower-alpha
as an alias oflower-latin
on English pages,hiragana
on Japanese pages…bullet
as an alias ofdisc
on English pages… (because I suppose the list bullet is also culture-dependant).With these generic keywords, the user agent should use the counter symbols which are the most appropriate given content language and user preferences.
Affected: https://www.w3.org/TR/css-counter-styles-3/#predefined-counters
That would also extend and simplify the following css-list-3 recommendation: