Last modified: 2013-12-05 08:48:57 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T59045, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 57045 - Add CSS classes based on writing system code
Add CSS classes based on writing system code
Status: NEW
Product: MediaWiki
Classification: Unclassified
Internationalization (Other open bugs)
unspecified
All All
: Normal enhancement (vote)
: ---
Assigned To: Nobody - You can work on this!
: i18n
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2013-11-14 06:32 UTC by Amir E. Aharoni
Modified: 2013-12-05 08:48 UTC (History)
9 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Amir E. Aharoni 2013-11-14 06:32:41 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.
Comment 1 Seb35 2013-12-03 23:03:43 UTC
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.
Comment 2 Amir E. Aharoni 2013-12-04 06:34:15 UTC
(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.
Comment 3 Amir E. Aharoni 2013-12-04 06:36:50 UTC
(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.
Comment 4 Seb35 2013-12-04 14:03:32 UTC
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.
Comment 5 Amir E. Aharoni 2013-12-04 14:24:41 UTC
(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.
Comment 6 Derk-Jan Hartman 2013-12-05 08:48:57 UTC
Slightly related: Bug 56908

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links