Extension:Babel

From MediaWiki.org
Jump to navigation Jump to search
This page is a translated version of the page Extension:Babel and the translation is 82% complete.
Outdated translations are marked like this.
Other languages:
Deutsch • ‎English • ‎Lëtzebuergesch • ‎Sassaresu • ‎Scots • ‎asturianu • ‎dansk • ‎español • ‎français • ‎italiano • ‎lietuvių • ‎magyar • ‎polski • ‎português • ‎português do Brasil • ‎sicilianu • ‎български • ‎русский • ‎हिन्दी • ‎中文 • ‎日本語 • ‎ꯃꯤꯇꯩ ꯂꯣꯟ • ‎조선말 • ‎한국어
MediaWiki extensions manual
OOjs UI icon advanced.svg
Babel
Release status: stable
Babel-extension-screenshot.png
Implementation Parser extension
Description Eiks ae parser function fer tae inform ither uisers aneat leid profeeciencie an categerise uisers o the same levels an leids.
Author(s) Robert Leverington (RobertLtalk)
Latest version Continuous updates
MediaWiki 1.30+
Database changes Yes
Composer mediawiki/babel
Tables babel
License GNU General Public License 2.0 or later
Download Included in Language Extension Bundle
Example Translatewiki.net
  • $wgBabelCategorizeNamespaces
  • $wgBabelCategoryNames
  • $wgBabelMainCategory
  • $wgBabelDefaultLevel
  • $wgBabelUseUserLanguage
  • $wgBabelUseDatabase
  • $wgBabelCentralDb
  • $wgBabelCentralApi
Translate the Babel extension if it is available at translatewiki.net
Check usage and version matrix.
Issues Open tasks · Report a bug

The Babel extension eiks ae parser function tae replace the auld Babel system that compleatlie relied apon templates. Gif aen onrecognised leid guidein is speceefied, it will see gif thaur's aen exeestin template wi the name an incluid thon.

Oan Wikimedia waurks, the noon Babel (reeferencin the Tower o Babel) refers tae the texs oan uiser pages aidin monieleidic communication bi makin it easier tae contact somebodie that speaks ae giein leid. The idea wis born in the Wikimedia Commons an haes been implemented oan monie ither wikis an aw.

Dounlaid

The extension can be retrieved directly from Git [?]:

  • Browse code
  • Some extensions have tags for stable releases.
  • Each branch is associated with a past MediaWiki release. There is also a "master" branch containing the latest alpha version (might require an alpha version of MediaWiki).

Extract the snapshot and place it in the extensions/Babel/ directory of your MediaWiki installation.

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

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

Instawation

  • Download and place the file(s) in a directory called Babel in your extensions/ folder.

To users running MediaWiki 1.25 or earlier:

The instructions above describe the new way of installing this extension using wfLoadExtension(). If you need to install this extension on these earlier versions (MediaWiki 1.25 and earlier), instead of wfLoadExtension( 'Babel' );, you need to use:

require_once "$IP/extensions/Babel/Babel.php";
  • The CSS is found in the file resources/ext.babel.css. Ye can change the style whaniver ye want bi owerridin thaim in the page MediaWiki:Common.css.
  • Gif the CLDR extension is foond than leid names ar taen fae that (whaur owersets ar no available), itherwise built in MediaWiki leid names an Ingils defauts ar uised.

Uissage

Syntax fer the #babel parser function is as follaes:

 {{#babel: babelcode1 | babelcode2 | ... }}

Eik yin o the follaein codes fer ilka leid that ye speak or unnerstaunnd, separatit bi |, whaur xx is the MediaWiki leid code, ISO 639-1 code, or ISO 639-3 code fer the leid. The general uissage o ilka code level is aes follaes:

xx-0
Gif ye dinna unnerstaunnd the leid at aw.
xx-1
Baseec abeelitie/first steps - enouch tae unnerstaaund wrutten material or simple speirins in this leid.
xx-2
Midlin abeelitie - enooch fer eeditin or tauks.
xx-3
Advaunced level/vera guid - awthooch ye can write in this leid wi nae proablem, some smaa mistaks micht happen.
xx-4
"Neur-nateeve" level - awthooch it's no yer first leid fae birth, yer abeelitie is closs tae bit no quite lik ae nateeve speaker.
xx-5
Profeessional profeeciencie.
xx or xx-N
Nateeve speakers that uise ae leid aw days an hae ae firm haunnle oan it, incluidin colloquialeesms an eedioms.

Tae incluid onie ither template, juist eik the name o the template, e.g. eik Uiser fae Glasgae gif ye want tae incluid Template:Uiser fae Glasgae. Ae prefix or suffix can be eikit tae template names (e.g. User at the beginning) dependin oan the local confeeguration, this can be uised tae restreect the selection an reduce the langth o boundins; fer exaumple fea Glasgae coud incluid Template:Uiser fae Glasgae gif confeegured in lik that.

To remove the header and footer, use plain=1 as the first parameter, e.g. {{#babel: plain=1 | babelcode1 | babelcode2 | ... }}. This makes it easier to use babel with other userboxes.

Confeeguration

Configuration parameters

Babel haes sax confeeguration variables that can be modified in LocalSettings.php .

$wgBabelLanguageCodesCdb 
(string) the path o the leid code database file, the defaut shoud dae.
$wgBabelLanguageNamesCdb 
(string) the path o the leid name database file, the defaut shoud dae.
$wgBabelCategoryNames 
(array o string or boolean, indexet bi the strings "1", "2", … "5", "N") whaur ilka entrie is the name o ae categerie fer the skill level indicated bi its index, possible variable elements ar: %code% (the leid code), %wikiname% (the name o the leid in the wiki's content leid), an %nativename% (the name o the leid in the leid itsel). Tae disable the eikin o ae categerie fer ae pairteecular level, set the correspondin value tae fause.
Fer exaumple:
$wgBabelCategoryNames = [
	'0' => 'User %code%-0',
	'1' => 'User %code%-1',
	'2' => 'User %code%-2',
	'3' => 'User %code%-3',
	'4' => 'User %code%-4',
	'5' => 'User %code%-5',
	'N' => 'User %code%-N',
];
will uise categeries lik "Category:User en-0" an "Category:User fr-N". The defaut is juist "Category:Fr-N" an sae oan.
$wgBabelMainCategory 
(string) Name o the main (non-level) categerie fer ilka leid, that aw uisers o that leid ar eikit tae. Set tae fause tae disable; defauts tae format "Category:Fr". It accepts the same format aes $wgBabelCategoryNames abuin. Exaumple:
$wgBabelMainCategory = 'User %code%';
$wgBabelDefaultLevel 
(string) Defaut abeelitie level tae uise whan yin is no speceefied, shoud be aen index fae $wgBabelCategoryNames, that is yin o the strings "1", "2", … "5", "N". Defaut is "N".
$wgBabelUseUserLanguage 
(boolean) Whather tae uise the uiser interface leid fer the heider an footer message. Gif fause (the defaut), it will be in the page content leid. This is cause uisin the uiser interface leid micht fragment the parser cache.

System messages

Several customisations can be makit an aw, uisin MediaWiki namespace messages.

MediaWiki:babel-template "Template:User $1"
The format o the template names whan yin is bein incluided.
MediaWiki:babel-portal "⧼babel-portal⧽"
The format o the tairget o the airtin fae the leid code.
MediaWiki:Babel-autocreate-user "Babel AutoCreate"
Uisername tae be uised fer autaecreaution o the Babel relatit categeries
MediaWiki:babel-autocreate-text-levels "Uisers in this categerie indicate that thay'v skill level $1 fer the leid $2."
Tex tae insert intae autae-creautit categeries fer different leid levels. Ye hae tae change this gif ye want thaim tae be autae-categerised in the main categerei o the respecteeve leid ($wgBabelMainCategory).
MediaWiki:babel-autocreate-text-main "Uisers in this categerie indicate that thay'v knawledge o the leid $1."
Tex tae insert intae autae-creautit categeries fer non-level categeries. Ye hae tae change this gif ye want thaim tae be autae-categerised in ae paurent categery fer aw leids.
MediaWiki:babel "Babel uiser information"
The heider o the babel kist
MediaWiki:babel-url "Project:Babel"
The pagename whaur information aneat the babel extension can be foond
MediaWiki:Babel-footer "Uisers bi leid"
The footer o the babel kist
MediaWiki:babel-footer-url " :Categerie:Babel - Uisers bi leid"
The page tae airt tae in the footer o the babel kist

API

meta=babel (bab)

(main | query | babel)

Get information about what languages the user knows

Parameter:
babuser

User to get information about

This parameter is required.
Type: user name
Example:
Get the Babel information for user Example
api.php?action=query&meta=babel&babuser=Example [open in sandbox]