Thank you, A smart kitten.
Bryan, as far as I know these work for current wiki, but what we need is
URLs of many wiki checked in the code that is running on Meta.
Igal


בתאריך יום ה׳, 11 בדצמ׳ 2025, 11:04, מאת Bryan Davis ‏<[email protected]>:

> On Thu, Dec 11, 2025 at 7:46 AM Igal Khitron <[email protected]> wrote:
> >
> > Thank you, Bryan. Actually, I wrote you just to explain that there are
> parts that do no work. But if you're interested, here are some details.
> > 1) About the language.
> > The extension has the code
> > // Get RTL/LTR direction for the site. We can't use
> String.prototype.startsWith, since
> > // that is unavailable in IE11, and doesn't take multiple values anyway.
> Use
> > // String.prototype.match with a list of the language codes that should
> be RTL
> > // this.siteID is based on the URL form of the wiki, and we assume that
> wikis that are
> > // meant to be RTL are in the form `⧼rtl language code⧽.*`, and any URL
> that does not
> > // match this is for an LTR wiki. See T274602 and T274313
> > const isRTL = this.siteID.match(
> > /^(ar|azb|ckb|dv|fa|glk|he|ks|lrc|mzn|nqo|pnb|ps|sd|ug|ur|yi)_/
> > );
> > // mw-content-ltr and -rtl classes are not enough to ensure that the
> text is formatted
> > // in the correct direction, so add a manual direction attribute. See
> T287649
> > // We still add those classes because they are also used by
> jQuery.makeCollapsible
> > // to know if the collapse button should be on the right or left.
> > this.$feedDiv = $( '<div>' )
> > .attr( 'id', 'ext-globalwatchlist-feed-site-' + this.siteID )
> > .attr( 'dir', isRTL ? 'rtl' : 'ltr' )
> > .addClass( 'ext-globalwatchlist-feed-site' )
> > .addClass( isRTL ? 'mw-content-rtl' : 'mw-content-ltr' )
> > .append(
> > headerTemplate.render( headerParams ),
> > $content
> > );
> > This is how it decides which wiki is shown in ltr div, and which wiki in
> rtl div. It's not ideal, of course, but we coudn't find the better way back
> than. And since the Patch Demo wiki URL does not have such a match for a
> language code, it shows everything in ltr.
>
> This business logic in the extension is very specific to the wiki farm
> implementation that is used by the Wikimedia project's content wikis
> like en.wikipedia.org. A potentially more robust way to detect the
> content language is via the `mw.config.get("wgContentLanguage")` (full
> site) or `mw.config.get("wgPageContentLanguage")` (current page)
> javascript lookups. [0][1] Similarly user's chosen interface language
> should be available from `mw.config.get("wgUserLanguage")`.
>
> [0]:
> https://www.mediawiki.org/wiki/ResourceLoader/Core_modules#mediaWiki.config
> [1]: https://www.mediawiki.org/wiki/Manual:Interface/JavaScript#mw.config
>
> Bryan
> --
> Bryan Davis                                        Wikimedia Foundation
> Principal Software Engineer                               Boise, ID USA
> [[m:User:BDavis (WMF)]]                                      irc: bd808
> _______________________________________________
> Wikitech-l mailing list -- [email protected]
> To unsubscribe send an email to [email protected]
> https://lists.wikimedia.org/postorius/lists/wikitech-l.lists.wikimedia.org/
_______________________________________________
Wikitech-l mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://lists.wikimedia.org/postorius/lists/wikitech-l.lists.wikimedia.org/

Reply via email to