Topic on Talk:Universal Language Selector

How can I provide a more focussed way of changing the interface language?

2
Larrydberg (talkcontribs)

Background: I am using ULS on a bilingual wiki (English/Hebrew, not that it matters). Some page content is in Hebrew, some in English. I want to give users the ability to change the interface language, but all I really care about is switching between these two languages. Is there any way I can, say, put in the sidebar a link called "English" that just changes the interface language to English, and one called עברית that just changes the interface language to Hebrew? The full power of the ULS "Languages" tool is way overkill for me.

Barring this, is there any way I can set the initial choices in the "Languages" tool? Right now people looking for Hebrew for the first time must do a search, etc. If I could at least be sure that the two languages I care about are presented initially, it would be a good start.

Thanks very much.

http://horawiki.org/

MediaWiki 1.21.1

Larrydberg (talkcontribs)

OK, I managed this one myself, and I'll record the solution here in case it helps anyone else. The goal is to provide links that switch interface language without changing the current page. I put these links at the top of the sidebar; you can see them at http://horawiki.org/ (a link "עברית" that switches to Hebrew) and http://horawiki.org.il/ (a link "English" that switches to English).

1) On MediaWiki:sidebar, add line "switchlanguage|otherlanguage"

2) MediaWiki:otherlanguage contains the word "עברית", MediaWiki:otherlanguage/he contains the word "English"

3) MediaWiki:switchlanguage contains "{{canonicalurl:{{FULLPAGENAME}}|setlang=he}}", and MediaWiki:switchlanguage/he is the same except with setlang=en

4) To make the system access language-dependent versions of MediaWiki:switchlanguage, put "$wgForceUIMsgAsContentMsg = array('switchlanguage');" into LocalSettings.php

This seems to do it. Improvements or suggestions gratefully accepted.

The initial language choices in the Languages tool can be manipulated with a tiny modification to routine getFrequentLanguageList in UniversalLanguageSelector/resources/js/ext.uls.init.js, but this is a terrible idea since changes there are overwritten with the next release.

Reply to "How can I provide a more focussed way of changing the interface language?"