User:Krinkle/Scripts/AnonymousI18N

From Meta, a Wikimedia project coordination wiki
Jump to: navigation, search
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]

  • or monobook.js: Please don't use this in Monobook. It won't work, it is especially made for Vector.
Please leave the [[File:Krinkle_AnonymousI18N.js]] in for statistics+
  • Yes check.svg Done :-)

If nothing appears, be sure to verify that you've put the above code on the wiki you use the tool on, not per se here on Meta. Note that this tool is optimized for WebKit (Safari, Chrome) browsers. It should also work fine in Mozilla (Firefox). Internet Explorer will not be supported.
Also clear your cache and do a hard refresh. If you encounter any issues, please let me know!

How to clear cache

Note: After saving, you may have to bypass your browser's cache to see the changes. Mozilla / Firefox / Safari: hold down Shift while clicking Reload, or press Ctrl-Shift-R (Cmd-Shift-R on Apple Mac); IE: hold Ctrl while clicking Refresh, or press Ctrl-F5; Konqueror: simply click the Reload button, or press F5; Opera users may need to completely clear their cache in Tools→Preferences.

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]

Check also my other Tools and Scripts here.