Extension:UniversalLanguageSelector

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.

Usage
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.
 * 2) Selection can be based on geographical region based browsing, searching.
 * 3) Search can be based on ISO language code, language name written in current user interface language or in its own script(autonym)
 * 4) Cross language search - search language names using any script
 * 5) Autocompletion of language names
 * 6) Auto correction of spelling mistakes in search strings
 * 7) Geo IP based language suggestions
 * 8) Language selection based on users browser/OS language
 * 9) Input methods
 * 10) An easily selectable input method collection, readily available in every editable field
 * 11) Provides a large set of input methods for wide range of languages
 * 12) * An outdated list is available at Extension:Narayam
 * 13) Per-language input method preferences
 * 14) Webfonts
 * 15) A large collection of fonts to choose for each language to use as embedded font for the page
 * 16) * An outdated list is available at Extension:WebFonts
 * 17) Per-language font preferences



Adding support for a new languages fonts
Follow the instructions on the WebFonts page, but file requests in the UniversalLanguageSelector bugzilla component.

Adding support for a new key mapping (input method)
Follow the instructions on the Narayam page, but file requests in the UniversalLanguageSelector bugzilla component.

Updating LanguageNameIndex
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
The following variables are created automatically during initialization and can be used from JavaScript using mw.config.get( NAME ):
 * - an associative array where the keys are language codes and the values are language names in English.
 * - an array of language codes from the user's Accept-Language value. These are the languages selected in the user's browser preferences.
 * - 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 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: