Extension:Babel
Babel Release status: stable |
|
---|---|
Implementation | Parser function |
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 (RobertLtauk) |
Latest version | Continuous updates |
Compatibility policy | Master maintains backward compatibility. |
MediaWiki | >= 1.43.0 |
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 |
|
|
Quarterly downloads | 85 (Ranked 63rd) |
Public wikis using | 2,416 (Ranked 192nd) |
Translate the Babel extension if it is available at translatewiki.net | |
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.
Instawation
- Download and move the extracted
Babel
folder to yourextensions/
directory.
Developers and code contributors should install the extension from Git instead, using:cd extensions/
git clone https://gerrit.wikimedia.org/r/mediawiki/extensions/Babel - Add the following code at the bottom of your LocalSettings.php file:
wfLoadExtension( 'Babel' );
- Run the update script which will automatically create the necessary database tables that this extension needs.
- Configure as required.
- Done – Navigate to Special:Version on your wiki to verify that the extension is successfully installed.
- The CSS is found in the file
resources/ext.babel.css
. Ye can change the style whaniver ye want bi owerridin thaim in the pageMediaWiki: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
orxx-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.
Parameters
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.
To hide categories, use the nocat=1
parameter as the first parameter, e.g., {{#babel: nocat=1 | babelcode1 | babelcode2 | ... }}
.
Please note that only one of the parameters above is allowed.
At the moment, it is not possible to use both parameters; for example, {{#babel: nocat=1 | plain=1 | babelcode1 | babelcode2 | ... }}
will not work.
Categorization
If categorization is enabled, the extension creates categories using the Babel AutoCreate bot with the text specified in MediaWiki:babel-autocreate-text-levels and MediaWiki:babel-autocreate-text-main. With basic settings, the categories that the bot creates are not categorized, and to fix this, it is recommended to do the following:
- Create a template {{Babel category }} that will generate categories.
- Replacing text on MediaWiki:babel-autocreate-text-levels with
{{Babel category|level=$1|language=$2|ISO=$3}}
- Replacing text on MediaWiki:babel-autocreate-text-main with
{{Babel category|language=$1|ISO=$2}}
This will allow you to categorize categories automatically, and if something happens, you can simultaneously replace the categorization and text in all categories.
Confeeguration
Configuration parameters
Babel haes sax confeeguration variables that can be modified in LocalSettings.php
.
$wgBabelLanguageCodesCdb
- ; $var : (string) the path o the leid code database file, the defaut shoud dae.
$wgBabelLanguageNamesCdb
- ; $var : (string) the path o the leid name database file, the defaut shoud dae.
$wgBabelCategoryNames
- ; $var : (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
- ; $var : (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
- ; $var : (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
- ; $var : (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.
$wgBabelCategorizeNamespaces
- Array of namespaces to only add automatic categorization to. For example, if
$wgBabelCategorizeNamespaces = [ NS_USER ];
, then Babel will only add categories to pages in the user namespace. The default is null, which means categorizing all namespaces. $wgBabelCategoryOverride
- Whether to allow Babel categories to be overridden on the wiki using MediaWiki:Babel-category-override
$wgBabelAutoCreate
- Whether to auto-create categories.
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 "
"
- The format o the tairget o the airtin fae the leid code. Set to the empty string to not link the language 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 Set to
-
to not display a header. - MediaWiki:babel-url "
Project:Babel
" - The pagename whaur information aneat the babel extension can be foond Set to
-
to display no link in the header. - MediaWiki:Babel-footer "
Uisers bi leid
" - The footer o the babel kist Set to
-
to not display a footer. - MediaWiki:babel-footer-url "
:Categerie:Babel - Uisers bi leid
" - The page tae airt tae in the footer o the babel kist
- MediaWiki:Babel-category-override "
$1
" - Overrides any automatically-generated Babel categories. Parameters:
$1 = the category that would be generated normally.
$2 = the language code
$3 = the babel level.
Any categories overridden using this method will not be auto-created to reduce the risk of vandalism or mistaken edits to that page.
API
meta=babel (bab)
- This module requires read rights.
- Source: Babel
- License: GPL-2.0-or-later
Get information about what languages the user knows
- babuser
User to get information about
- This parameter is required.
- Type: user, by any of username, IP, Temporary user, IP range and interwiki name (e.g. "prefix>ExampleName")
- Get the Babel information for user Example
- api.php?action=query&meta=babel&babuser=Example [open in sandbox]
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. |
This extension is included in the following wiki farms/hosts and/or packages: This is not an authoritative list. Some wiki farms/hosts and/or packages may contain this extension even if they are not listed here. Always check with your wiki farms/hosts or bundle to confirm. |