A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://www.mediawiki.org/wiki/Special:MyLanguage/Extension:UniversalLanguageSelector below:

Extension:UniversalLanguageSelector - MediaWiki

The Universal Language Selector is a tool that allows users to select a language and easily configure its support. Where used, it also ships the functionality of both the former WebFonts and Narayam extensions (both of which have been deprecated in favor of Universal Language Selector). See Universal Language Selector for background and additional information.

Usage

The primary aim is to allow users to select a language and easily configure its support.

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, and 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
    See Help:Extension:UniversalLanguageSelector/Input methods for complete instructions.
    1. An easily selectable input method collection, readily available in every editable field
    2. Provides a large set of input methods for a 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 an embedded font for the page
    2. Per-language font preferences
Universal Language Selector with geoip based language suggestion for a user from India Language settings allow a registered user accessing English Wikipedia to change the UI to their native language. A Bengali user is able to read content from the Bengali Wikipedia despite the lack of fonts in their computer. Web fonts are provided automatically for non-Latin scripts for which an open-source font is available. The user can decide to use their system fonts on a per-language basis. A Hindi speaker without a Hindi keyboard configures input methods so that they can type in their language. When searching a user can switch between English and Hindi.

Adding fonts

Supporting more languages is only a matter of including the proper fonts in the code. However, please note that we will only add support for open-source licensed fonts, such as those licensed under GNU GPL, SIL OFL, etc. An example directory of such open-source fonts is Google Fonts [1] (not yet fully examined/exploited by the authors of this extension); see also the Open Font Library.

First of all, you need to find or produce such a open-source font (this is the most essential part, and you have to do it yourself); then, it has to be converted to the woff2 format, you can file a request in Phabricator for the font to be added to the extension.

Preparing webfonts

This section explains how to convert the fonts: basic knowledge about GNU/Linux-based operating system is required; if you have difficulty in doing this, you can skip this step and ask someone else to do it for you on the same Phabricator request (of course this will slow down the process).

Creating .woff2:

Use https://github.com/google/woff2 to generate woff2 from ttf. This will produce a compressed woff2 file. Modern browsers support this format.

Create a font.ini file. Here's an example:

[AbyssinicaSIL]
languages=am*, ti*
version=1.200
license=OFL 1.1
licensefile=OFL.txt
url=http://scripts.sil.org/AbyssinicaSIL
request-url=https://phabricator.wikimedia.org/[Task Number]
woff2=AbyssinicaSIL.woff2
bold=AbyssinicaSIL Bold

[AbyssinicaSIL Bold]
woff2=AbyssinicaSIL-Bold.woff2
fontweight=bold

An asterisk (*) after a language code means that this font will be the default font for that language. Don't use the asterisk if you want the option to use this font for that language.

After creating the files, do the following:

  1. Create a directory for the font under data/fontrepo/fonts.
  2. Put the woff2 and font.ini files in that directory and add them to the source repository (git add).
  3. Go to the scripts/ directory and run php compile-font-repo.php.
  4. Commit the changes to the repository (git commit -a) and submit them according to the Git workflow.

Adding support for a new key mapping (input method)

Follow the instructions on the jquery.ime GitHub wiki, but file requests in the Wikimedia-extensions-UniversalLanguageSelector Phabricator product.

Installation


Vagrant installation:

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 UniversalLanguageSelector/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 ):

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

AddType font/woff2 .woff2

The following variables can also be configured:

Position of ULS trigger

It is also possible to have a ULS trigger anywhere on the screen. An element with uls-settings-trigger will act as a ULS trigger.

Overriding default fonts

ULS has a large font repository to serve as webfonts. Sometimes, there are multiple fonts for a language, and there is a default font for each language/script. The order of fonts or default font can be overridden as follows using global scripts (MediaWiki:Common.js) or personal scripts (Special:MyPage/common.js):

$.webfonts.repository.languages.languageCode = ["system", "FontA", "FontB"];

Here, languageCode should be a valid langauge code(eg: en, hi, nl). FontA and FontB are fonts available in font repository. In the above example for languageCode, we set a font available in local computer as default font. ie No default webfont.

Caching configuration

To ensure that the web fonts files are cached on the clients' machines, font file types must be added to the web server configuration. In Apache2 this consists of:

<FilesMatch "\.(gif|jpe?g|png|css|js|woff2|svg)$">
AddType font/woff2 .woff2

For a full example see the caching configuration update done for the Wikimedia cluster.

Page translation

UniversalLanguageSelector is one of the dependencies of the Translate extension, which uses it for several language selection features. One of it is the MyLanguage system for links, which depends on the interface language of the user, but more can be configured: see Page translation feature.

Using Webfonts

Users can choose web fonts for a language from the Language settings -> Display settings. The first font in that menu will be applied to the wiki by default. A user can change the font to be remembered across the pages. Optionally, the user can disable the font embedding by selecting the system font.

If the font is available in the user's local system, the font will not be downloaded from the MediaWiki server. It will be taken from the user's computer. Otherwise, the font will be downloaded from the server only once, when the user selects the font the first time. From then on, the font will be taken from the local cache.

Alternate ways to load fonts

By specifying font-family

Inside the wiki text <span style="font-family:'YourFontName';">YourText</span>, webfonts extension will check whether the font is available with the extension, if so it will download it to the client. So the reader will not face any difficulty reading the text even if the specified font is not available on their computer.

By specifying language

Inside the wiki text <span lang="my">YourText</span>, the web fonts extension will check whether any font is available for the given language with the extension and if so, it will download it to the client. So the reader will not face any difficulty reading the text even if the specified font is not available on their computer. The default font will be used if there are multiple fonts for the language. If the default font is not preferred, use the font-family approach to specify the font. If the tag has both lang and font-family definitions, font-family gets precedence.

Example:

<span lang=sux>𒄖𒉈𒅁𒌨𒅎</span>

gives the text rendered in Cuneiform using Akkadian font

𒄖𒉈𒅁𒌨𒅎

See also

This extension is being used on one or more Wikimedia projects. This probably means that the extension is stable and works well enough to be used by such high-traffic websites. Look for this extension's name in Wikimedia's CommonSettings.php and InitialiseSettings.php configuration files to see where it's installed. A full list of the extensions installed on a particular wiki can be seen on the wiki's Special:Version page.

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4