Jump to content

User:Krinkle/Scripts/AnonymousI18N

From Meta, a Wikimedia project coordination wiki
A suggestion notice on Wikimedia Commons.

Languages: EnglishNederlands

Description

[edit]

Suggests, presents, stores and applies uselang for anonymous users. Works on any Wikimedia wiki. The language code of the choosen language is globally available in the wgAnonUserLanguage variable.

By checking the browser language it presents the user a choise to 'switch' to that language. The user can hide the notice so that it won't show again. In the sidebar the language can be changed at any one.

Whenever a lanuage is choosen it is maintained through any anchorlink (both in the article and in the interface, including dynamically added links such as Toolbox-links and extra tabs). Also form submissions are accounted for (except for the main search function, the search function in <inputbox> is covered by this script).

Although made for Wikimedia wikis, could easily be customized to work on other wiki (farm) by changing the if-check around line 250.

Install

[edit]
  • Paste this code in common.js on your local wiki, or in global.js on Meta to use it everywhere you go:
The [[File:Krinkle_AnonymousI18N.js]] line is used for statistics.
  • Done :-)

If you encounter any issues, please let me know!

Screenshot

A suggestion notice on Wikimedia Commons.

Known issues / planned features

  • The main search doesn't get uselang in the results, the search itself works though and, if not declined, has the notice on top suggesting the settings's language.
  • Interwiki => Implemented in r?, links from the current wiki to other wmf-wikis also get uselang-appended so that, if the script is active there too, it just keeps on passing it.
  • Links that are overriden by javascript (ie. watch-star) are hijacked and are no longer ajax-ish but degrading to normal (since AnonymousI18N sets location.href directly).


See also

[edit]