Extension:UniversalLanguageSelector

From MediaWiki.org
Jump to: navigation, search
MediaWiki extensions manual - list
Crystal Clear action run.png
UniversalLanguageSelector

Release status: stable

Implementation User interface, Skin
Description Tool that allows users to select a language and configure its support in an easy way.
Author(s) (Santhosh.thottingaltalk)
MediaWiki 1.20.4 or later
License GNU General Public Licence 2.0 or later, MIT license
Download Included in Language Extension Bundle

Not compatible with Internet Explorer 7 or lower.

Check usage and version matrix; stats
Bugs: list open list all report

The Universal Language Selector is a tool that allows users to select a language and configure its support in an easy way. Where used, it also ships the functionality of both WebFonts and Narayam extensions. See Universal Language Selector for background and additional information.

Contents

Usage[edit]

The primary aim is to allow users to select a language and configure its support in an easy way.

The extension provides the following features:

  1. Flexible and easy way to select a language from a large set of languages.
    1. Selection can be based on geographical region based browsing, searching.
    2. Search can be based on ISO language code, language name written in current user interface language or in its own script(autonym)
    3. Cross language search - search language names using any script
    4. Autocompletion of language names
    5. Auto correction of spelling mistakes in search strings
    6. Geo IP based language suggestions
    7. Language selection based on users browser/OS language
  2. Input methods
    1. An easily selectable input method collection, readily available in every editable field
    2. Provides a large set of input methods for wide range of languages
    3. Per-language input method preferences
  3. Webfonts
    1. A large collection of fonts to choose for each language to use as embedded font for the page
    2. Per-language font preferences
Universal Language Selector with geoip based language suggestion for a user from Spain
ULS language settings

Adding support for a new languages fonts[edit]

Follow the instructions on the WebFonts page, but file requests in the UniversalLanguageSelector bugzilla component.

Adding support for a new key mapping (input method)[edit]

Follow the instructions on the Narayam page, but file requests in the UniversalLanguageSelector bugzilla component.

Download[edit]

You can download the extension directly from the MediaWiki source code repository (browse code). You can get:

One of the extensions tags

Not all extensions have tags. Some extensions have tags for each release, in which case those tags have the same stability as the release. To download a tag

  • Go to the tags list
  • Click the name of the tag you want to download
  • Click "snapshot"
The latest version of one of the extensions branches

Each extension has a master branch containing the latest code (might be unstable). Extensions can have further branches as well.

  • Go to the branches list
  • Click the branch name
  • Click "snapshot"
A snapshot made during the release of a MediaWiki version.

This might be unstable and is not guaranteed to work with the associated MediaWiki version.

After you've got the code, save it into the extensions/UniversalLanguageSelector directory of your wiki.

If you are familiar with git and have shell access to your server, you can obtain the extension, with all its tags and branches, as follows:

cd extensions
git clone https://gerrit.wikimedia.org/r/p/mediawiki/extensions/UniversalLanguageSelector.git

Installation[edit]

  • Download and extract the files in a directory called "UniversalLanguageSelector" in your extensions/ folder.
  • Add the following code to your LocalSettings.php (at the bottom)
require_once( "$IP/extensions/UniversalLanguageSelector/UniversalLanguageSelector.php" );
  • Yes check.svg Done – Navigate to "Special:Version" on your wiki to verify that the extension is successfully installed.

Updating LanguageNameIndex[edit]

For performing cross language search, searching autonyms, language data needs to be populated. ULS comes with a pre-populated language name index(data/langnames.ser). In case you want to update it, install Extension:CLDR and update the data with the following command.

php ULS/data/LanguageNameIndexer.php

and verify that langnames.ser file gets generated in ULS/data/ folder.

Configuration[edit]

The following variables are created automatically during initialization and can be used from JavaScript using mw.config.get( NAME ):

  • wgULSLanguages - an associative array where the keys are language codes and the values are language names in English.
  • wgULSAcceptLanguageList - an array of language codes from the user's Accept-Language value. These are the languages selected in the user's browser preferences.
  • wgULSGeoService - a address to geolocation service. Defaults to http://freegeoip.net/json/ and expects the same format. Set false to disable. Geolocation can still be provided by populating window.Geo.country.

ULS uses jquery.i18n to load translation in JSON format with XHR. If your $wgExtensionAssetsPath is on different server this means it will attempt CORS (which means it is only supported on modern browsers). You need to configure Access-Control-Allow-Origin on your assets domain for this to work.

For serving fonts, you might want to add the following mime types to your webserver if not already there. This guide might help.

  • application/x-font-woff .woff
  • application/vnd.ms-fontobject .eot
  • application/x-font-ttf .ttf

The following variables can also be configured:

  • $wgULSGeoService
  • $wgULSEnable
  • $wgULSAnonCanChangeLanguage
  • $wgULSIMEEnabled
  • $wgULSPosition

See also[edit]