Extension:Babel
From MediaWiki.org
|
Release status: stable |
|||
|---|---|---|---|
| Implementation | Parser extension | ||
| Description | Adds a parser function to inform other users about language proficiency and categorise users of the same levels and languages. | ||
| Author(s) | Robert Leverington (RobertLTalk) | ||
| Last Version | 1.3.0 | ||
| MediaWiki | 1.16.x or higher (r52203) | ||
| License | GNU General Public License 2.0 or later | ||
| Download | Download snapshot |
||
| Example | Translatewiki.net | ||
|
|||
|
check usage (experimental) |
|||
The Babel extension adds a parser function to replace the old Babel system that completely relied on templates. The extension is backward compatible, and supports existing templates (they simply override extension functionality).
On Wikipedia, the noun Babel (in reference to the Tower of Babel) refers to the texts on user pages aiding multilingual communication by making it easier to contact someone who speaks a certain language. The idea originated on the Wikimedia Commons and has also been implemented on many other wikis.
Contents |
[edit] Installation
- Download the latest snapshot and extract it to your extensions directory.
- Copy the code from
Babel.cssfile into your MediaWiki:Common.css—you can change it as desired. - Add
require_once( "extensions/Babel/Babel.php" );toLocalSettings.php. - Enjoy!
If the CLDR extension is found language names are taken from that (where translations are unavailable), otherwise built in MediaWiki language names and English defaults are used.
[edit] Usage
Syntax for the #babel parser function is as follows:
{{#babel: babelcode1 | babelcode2 | ... }}
Add one of the following codes for each language you speak or understand, separated by |, where xx is the MediaWiki language code, ISO 639-1 code, or ISO 639-3 code for the language. The general usage of each code level is as follows:
-
xx-0- If you don't understand the language at all.
xx-1- Basic ability - enough to understand written material or simple questions in this language.
xx-2- Intermediate ability - enough for editing or discussions.
xx-3- Advanced level - though you can write in this language with no problem, some small errors might occur.
xx-4- 'Near-native' level - although it's not your first language from birth, your ability is something like that of a native speaker.
xx-5- Professional proficiency.
xxorxx-N- Native speakers who use a language every day and have a thorough grasp of it, including colloquialisms and idioms.
To include any other template, simply add the name of the template, e.g. add User from London if you want to include Template:User from London. A prefix or suffix may be added to template names (e.g. User at the beginning) depending on the local configuration, this can be used to restrict the selection and reduce the length of parameters; for example from London could include Template:User from London if configured in such a way.
[edit] Configuration
Babel has five configuration variables which can be modified in LocalSettings.php.
$wgBabelUseLevelZeroCategory- A boolean (true or false) indicating whether users should be entered in to a category if they use
xx-0; defaults to false. $wgBabelUseSimpleCategories- A boolean (true or false) indicating whether categories for abilities should be used; defaults to false.
$wgBabelUseMainCategories- A boolean (true or false) indicating whether main categories featuring all users who specify a level for that language should be added to a
xxcategory; defaults to true. $wgBabelLanguageCodesCdb- String (path) to the language code database file, the default should suffice.
$wgBabelLanguageNamesCdb- String (path) to the language name database file, the default should suffice.
Several customizations can also be made using MediaWiki namespace messages.
- MediaWiki:babel-template-prefix and MediaWiki:babel-template-suffix
- The prefix and suffix to be prepended or appended to the template name when one is being included.
- MediaWiki:babel-portal-prefix and MediaWiki:babel-portal-suffix
- The prefix and suffix to be prepended or appended to the target of the link from the language code.
- MediaWiki:babel-category-prefix and MediaWiki:babel-category-suffix
- The prefix and suffix to be prepended or appended to the name of the categories.
- MediaWiki:Babel-autocreate-user
- Username to be used for autocreation of Babel related categories
[edit] Releases
| Version | Release date | Comments |
|---|---|---|
| 0.1 | 2008-04-19 | Initial version. |
| 0.7 | 2008-04-26 | First beta. |
| 0.9 | 2008-05 | Second beta - still some known issues. |
| 1.0 | 2008-07-02 | Now stable. |
| 1.1.0 | 2009-02-22 | Rewrite language logic. |
| 1.2.0 | 2009-02-22 | Rewrite parameter parser (all MediaWiki supported languages now work), remove options parser (gender moved to core). |
| 1.2.1 | 2009-02-22 | Gender support for 'babel' message. |
| 1.2.2 | 2009-02-22 | Change parser hook callback to be PHP 5.2.0 and lower compatible. |
| 1.2.3 | 2009-02-26 | Comment and whitespace alteration, fix possible exception by always returning null on an invalid language. |
| 1.3.0 | 2009-07-23 | Replace language code handling with CDB. |
[edit] See also
- meta:Babel extension - discussion about whether it should be implemented on Wikimedia wikis