Last modified: 2013-12-05 08:48:57 UTC
It would be useful to have the languages that MediaWiki supports be aware of the alphabet in which they are written. ISO 15924 writing systems code can be used for the most part, so it will be "latn" for English, French, Vietnamese, etc.; "cyrl" for Russian, Udmurt, etc.; "deva" for Hindi, Marathi, etc. - and so on. This is useful for applying special styles that are common to all languages written in a script. For example the notorious line-height fix is applied in shared.css by element name and language code, and it could be greatly simplified by using the relevant script codes so instead of having selectors for bh, bho, hi, ks, mr, mai, ne, new, pi and sa, there would only be one selector for class deva. Of course, it will have to take into account language variants (Serbian Cyrillic / Latin, Kazakh Cyrillic / Latin / Arabic etc.) and also special cases not covered by ISO 15924, such as the internal differences between styles of Arabic (so Arabic may use "arab" and Urdu may use something like "arab-nastaleeq"). An easy way to implement this would be to add a variable to each Messages file, similarly to $rtl. (In fact, this can make $rtl obsolete, because the direction is inherent in the writing system.) Comment 1: In this bug, "writing system", "script" and "alphabet" are synonyms. I mentioned all to make it easier to find. Comment 2: I vaguely recall that there is a bug for this, but I cannot find it. If there is one, please mark this one as a dupe.
Where do you think adding these CSS classes? If I understand correctly the structure of the page, the <html> tag has the language and directionality of the user interface language and the <div id="mw-content-text"> tag has the language and directionality of the page language. Adding these CSS classes on these two places? Interwikis could perhaps also be considered.
(In reply to comment #1) > Where do you think adding these CSS classes? If I understand correctly the > structure of the page, the <html> tag has the language and directionality of > the user interface language and the <div id="mw-content-text"> tag has the > language and directionality of the page language. Adding these CSS classes on > these two places? > > Interwikis could perhaps also be considered. Actually, any place where we currently use lang and dir. <html>, <div id="mw-content-text">, interlanguage links, ULS, various elements of the Translate and Wikibase extensions. Some Day Soon, when VisualEditor will have full support for marking pieces of text in another language, then there, too. (It's already a beta feature.) Many of these are not in the core, but they will need it just as well, so there probably should be core PHP and JS functions that make it easy to add them everywhere.
(In reply to comment #2) Some Day Soon, when VisualEditor > will > have full support for marking pieces of text in another language, then there, > too. (It's already a beta feature.) ... Just checked, and it doesn't seem to be deployed anywhere in Wikimedia. But it has been in development for months already.
I have two points related to this bug: 1/ Is the information of the "ISO 15924 <-> language code" somewhere in MediaWiki? I quickly searched and didn’t find. 2/ Rethinking about the CSS classes, there is a problem in adding multiple levels of CSS classes: if there is <html class="writing-Latn"><div class="writing-Cyrl">здесь</div></html> then the inner <div> is affected by the classes "writing-Latn" and "writing-Cyrl", and there is no mean to know what is the most inner class between the two.
(In reply to comment #4) > I have two points related to this bug: > > 1/ Is the information of the "ISO 15924 <-> language code" somewhere in > MediaWiki? I quickly searched and didn’t find. Not in core, but it's available in the UniversalLanguageSelector extension's "langdb" feature. Its most readable version can be found here: https://github.com/wikimedia/jquery.uls/blob/master/data/langdb.yaml (It's tracked in GitHub and periodically updated in Gerrit.) I occasionally fantasize about separating the langdb into an independent jQuery library and adding it to core.
Slightly related: Bug 56908