Thank you very much. It definitely works. And it works outside Wikimedia
wikis too, I just checked it on two Patch Demo wikis with opposite
directions. And yes, I'm pretty sure it comes from Mediawiki core. But I'm
not sure it's a good idea to run dozens of API calls at once, when even one
is discouraged. I hope I will be able to get this information from some
core variable or function that are used by this API call. In this case it
will be great. Otherwise, I don't think anybody will allow me to use it.
Thanks again.
Igal

בתאריך יום ו׳, 19 בדצמ׳ 2025, 00:23, מאת Leszek Manicki ‏<
[email protected]>:

> Hey Igal,
> I'm not sure if this is a helpful answer, as I don't quite understand how
> "slow" the solution might be to be acceptable for you.
> It seems that meta=siteinfo API might be of use (
> https://www.mediawiki.org/wiki/API:Siteinfo)
> With "general" option (https://www.mediawiki.org/wiki/API:Siteinfo#General)
> it seems to include a potentially relevant field in the API response: "rtl:
> This will be emitted if the wiki's language reads right-to-left"
> If I understand correctly it is a standard Mediawiki API (not registered
> by an extension) so you might be able to call it for each wiki in a wiki
> farm.
>
> Compare for example the response for
> https://en.wikipedia.org/w/api.php?action=query&meta=siteinfo&siprop=general
> vs
> https://he.wikipedia.org/w/api.php?action=query&meta=siteinfo&siprop=general
>
> hope this helps.
> cheers
>
>
>
> ‪On Thu, 18 Dec 2025 at 08:12, ‫יגאל חיטרון‬‎ <[email protected]>
> wrote:‬
>
>> The answer to both of you. The extension GlobalWatchlist needs to know
>> for every wikisite in a wikifarm, if it's LTR or RTL. This is because the
>> Special Page shows many sections, each from different wiki, on this wiki's
>> language. So, we need a function, that gets 'en.wikipedia.org' as a
>> parameter and returns 'ltr'. For now, there is a hardcoded list of rtl
>> language codes there, as regex, which for my sake is worse that using API,
>> just IMHO. It was always a bad solution, but when I implemented it years
>> ago, we didn't know other choice. Now I'm aware of the SiteMatrix
>> extension, which evaluates this mapping on runtime, and I can use the API
>> call to retrieve the relevant information. I looked a lot for a way to
>> avoid it. I think I found a way to get a direction from the language code,
>> but I still can't get the language code from the URL. I can guess it from '
>> en.wikipedia.org', but not from 'commons.wikimedia.org', and not from '
>> abcdefgh.catalyst.wmcloud.org'. So, as for now, I don't see another way
>> except for the API call.
>> Igal
>> https://phabricator.wikimedia.org/T412505
>>
>>
>> בתאריך יום ה׳, 18 בדצמ׳ 2025, 00:30, מאת John ‏<[email protected]
>> >:
>>
>>> One of the rules I’ve always used when proving support is don’t tell me
>>> how you want to do something. Tell me the goal, and we can get a solution.
>>> The method you are trying to use may or may not be optimal.
>>>
>>>
>>> On Wed, Dec 17, 2025 at 5:13 PM Brian Wolff <[email protected]> wrote:
>>>
>>>> Generally speaking, calling the action api externally is strongly
>>>> discouraged. Typically there is a backend function that is prefered 
>>>> instead.
>>>>
>>>> Whether that is actually true in your case depends on what you are
>>>> doing. Whether or not your case would be an acceptable exception to the
>>>> general rule would depend on the specifics of what you are doing and if
>>>> there really is no other reasonable option.
>>>>
>>>> --
>>>> Brian/bawolff
>>>>
>>>>
>>>> On Wednesday, 17 December 2025, יגאל חיטרון <[email protected]>
>>>> wrote:
>>>>
>>>>> Well, I started to think, after reading a lot of documentation and a
>>>>> lot of gerrit code, that my previous knowledge was wrong, and I have no
>>>>> choice but calling API from inside Mediawiki php, despite the words in
>>>>> Mediawiki developers guide "If you use an API call in Mediawiki php code,
>>>>> you're doing something wrong." Looks like I have no other choice. If 
>>>>> nobody
>>>>> here says I can't do this, I'll start to write. Thank you.
>>>>> Igal
>>>>>
>>>>>
>>>>>
>>>>> <http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
>>>>> Virus-free.www.avg.com
>>>>> <http://www.avg.com/email-signature?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail>
>>>>> <#m_6555271635706650392_m_-5060977879796860839_m_4594427892869767432_m_-1276708365409787417_m_6372061225327250602_m_1407805277756859967_DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
>>>>>
>>>>> ‫בתאריך יום ד׳, 17 בדצמ׳ 2025 ב-19:21 מאת יגאל חיטרון <‪
>>>>> [email protected]‬‏>:‬
>>>>>
>>>>>> Thanks, but I'm not so sure. I already saw this line. The API returns
>>>>>> something with more than 10000 lines.
>>>>>> https://www.mediawiki.org/w/api.php?action=sitematrix&format=json&smsiteprop=url%7Cdbname%7Ccode%7Csitename%7Clang&formatversion=2.
>>>>>> I wanted just to call the API from PHP, until read in developers guide 
>>>>>> "If
>>>>>> you call API you're doing something wrong".
>>>>>> Igal
>>>>>>
>>>>>> בתאריך יום ד׳, 17 בדצמ׳ 2025, 19:16, מאת Brian Wolff ‏<
>>>>>> [email protected]>:
>>>>>>
>>>>>>> It should be defined at
>>>>>>> https://gerrit.wikimedia.org/g/operations/mediawiki-config/+/df0f99e231a682f63f82e4b4a00ecce52bd22ed9/wmf-config/CommonSettings.php#1324
>>>>>>> . As far as i can tell its not set dynamiclly so should have the same 
>>>>>>> value
>>>>>>> at all wikimedia wikis.
>>>>>>>
>>>>>>> --
>>>>>>> Bawolff
>>>>>>>
>>>>>>> On Wednesday, 17 December 2025, יגאל חיטרון <[email protected]>
>>>>>>> wrote:
>>>>>>>
>>>>>>>> I've made a Gerrit change for a Phabricator task that uses the
>>>>>>>> $wgSiteMatrixSites variable, which is created at runtime. How can I 
>>>>>>>> view
>>>>>>>> its value on Meta?
>>>>>>>>
>>>>>>>> The issue is that this variable seems to have a different structure
>>>>>>>> on each site, depending on the available data. I’ve written traversal 
>>>>>>>> code
>>>>>>>> designed to handle any possible structure, but I can’t confirm if it 
>>>>>>>> works
>>>>>>>> correctly for Meta.
>>>>>>>>
>>>>>>>> If I could get the Meta value—or even just the first few pages—it
>>>>>>>> would be very helpful.
>>>>>>>>
>>>>>>>> Thank you in advance.
>>>>>>>> Igal (User:Ikhitron)
>>>>>>>>
>>>>>>> _______________________________________________
>>>>>>> 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/
>>>
>>> _______________________________________________
>>> 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/
>
>
>
> --
> Wikimedia Deutschland e. V. | Tempelhofer Ufer 23-24 | 10963 Berlin
> <https://www.google.com/maps/search/Tempelhofer+Ufer+23-24+%7C+10963+Berlin?entry=gmail&source=g>
> Phone: +49 30 5771162-0
> https://wikimedia.de
>
> Keep up to date! Current news and exciting stories about Wikimedia,
> Wikipedia and Free Knowledge in our newsletter (in German): Subscribe now.
>
> Imagine a world in which every single human being can freely share in the
> sum of all knowledge. Help us to achieve our vision!
> https://spenden.wikimedia.de
>
> Wikimedia Deutschland — Gesellschaft zur Förderung Freien Wissens e. V.
> Eingetragen im Vereinsregister des Amtsgerichts Charlottenburg, VR 23855 B.
> Als gemeinnützig anerkannt durch das Finanzamt für Körperschaften I Berlin,
> Steuernummer 27/029/42207. Geschäftsführende Vorständin: Franziska Heine.
> _______________________________________________
> 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