Extension:Babel/zh
![]() Category:Stable extensions/zh |
|
---|---|
![]() |
|
Category:Parser function extensions/zh | |
描述 | |
作者 | Robert Leverington (RobertL留言) |
最新版本 | 持续更新 |
MediaWiki | >= 1.43.0 |
是 | |
Composer | mediawiki/babelCategory:Extensions supporting Composer/zh |
表 | babel |
GNU通用公眾授權條款2.0或更新版本 | |
下載 | Category:Extensions in Wikimedia version control/zh |
Translatewiki.net | |
|
|
|
|
前往translatewiki.net翻譯Babel | |
問題 | 开启的任务 · |
Babel解析器函数以替換掉完全依賴模板的“舊”语文系統。如果指定了某個無法識別的語言參數,則它將查看是否存在具有該名稱的現有模板然後將它包括進來。 This information can then additionally be stored via categories, allowing others to find users who speak any particular language.
在维基媒体项目中,名词Babel(巴別)(參考自巴別塔)指的是用户页面上的文本,它帮助人们更容易地与说某种语言的人联系,从而帮助多语言交流。 这个想法起源于維基媒體共享資源,并已在许多其他wiki上实现。
The Babel extension still makes use of templates: if an unrecognized language parameter is specified, the extension will see if there is an existing template with that name and include that if so.
- 下载,并将解压后的
Babel
移动到extensions/
目录中。
开发者和代码贡献人员应从Git安装扩展,输入:cd extensions/ git clone https://gerrit.wikimedia.org/r/mediawiki/extensions/Babel
- 将下列放置在您的LocalSettings.php 的底部:
wfLoadExtension( 'Babel' );
- 更新脚本,它将自动此必须的数据库表。
完成 – 在您的wiki上至Special:Version,以验证已成功安装。
- CSS位于文件
resources/ext.babel.less
中。可以通过在MediaWiki:Common.css
页中重写样式,將它们改变成你想要的。 - 如果找到了 扩展,语言名称将取自该扩展(在翻译不可用的情况下),否则将使用内置的MediaWiki语言名称和英语默认值。
用法
#babel
解析器函数的语法如下:
{{#babel: babelcode1 | babelcode2 | ... }}
为您所说或理解的每种语言添加以下代码之一,以|
分隔,其中xx
是该语言的MediaWiki语言代码、ISO 639-1或ISO 639-3代码。 每个代码级别的一般用法如下:
xx-0
:如果您对此种语言一窍不通。xx-1
:初级水平——您对此种语言的文章或簡單会话略懂一二。xx-2
:中等水平——足以进行编辑或讨论。xx-3
:高等水平——尽管你可以毫无问题地用这种语言写作,但仍難免有些小錯。xx-4
:近母语水平——虽然此种语言不是你的母语,但你基本可以达到母语者的水平。xx-5
:专业水平。xx
或xx-N
:您是这种语言的母语用户,您天生就可以使用该语言的俗话和/或俚语。
要包含任何其他的模板,只需添加该模板的名称,例如,如果要包含Template:User CSS
,请User CSS
。 根据本地配置,可以将前缀或后缀添加到模板名称(例如,User
)中。这可用于限制选择和缩短参数的长度;例如,CSS
可以包括Template:User CSS
,如果以这种方式配置的话。
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, CSS
could include Template:User CSS
if configured in such a way.
For example in the mentioned case of CSS (Cascading Style Sheets), it might collide with the ISO code for Southern Ohlone language.
In such case, to enforce the usage of a local template, simply prefix the parameter with an underscore (_
).
E.g. … html-3|_css-2|js-1 …
参数
要删除页眉和页脚,请使用plain=1
作为第一个参数,例如{{#babel: plain=1 | babelcode1 | babelcode2 | ... }}
。
这就能使Babel更方便地将其与其他用户框配合使用。
To hide categories, use the nocat=1
parameter as the first parameter, e.g., {{#babel: nocat=1 | babelcode1 | babelcode2 | ... }}
.
请注意,上述参数只允许使用一个。
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.
语文有六个可以在LocalSettings.php
中修改的配置参数。
$wgBabelLanguageCodesCdb
- (字符串)语言代码数据库文件的路径,默认值应该足够了。
$wgBabelLanguageNamesCdb
- (字符串)语言代码数据库文件的路径,默认值应该足够了。
$wgBabelCategoryNames
- (字符串或布尔数组,以字符串"1"、"2"、... "5"、"N "为索引),其中每个条目是其索引所表示的技能水平的类别名称,可能的变量元素是:
%code%
(语言代码),%wikiname%
(维基内容语言中的语言名称),%nativename%
(其语言中的语言名称)。要禁止为某一级别添加类别,请将相应的值设置为false。
- 例如:
$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',
];
- 将使用"Category:User en-0"和"Category:User fr-N"等分类。默认值是"Category:Fr-N",依此类推。
$wgBabelMainCategory
- (字符串)每种语言的主要(非级别)分类的名称,该语言的所有用户都被添加到该分类中。设置为false表示禁用;默认格式为 "Category:Fr"。它接受的格式与上面的
$wgBabelCategoryNames
相同。例如:$wgBabelMainCategory = 'User %code%';
$wgBabelDefaultLevel
- (字符串)当没有指定任何的能力之时,使用的默认能力级别,应该是一个从
$wgBabelCategoryNames
开始的索引,是"1","2", ... "5","N"中的一个字符串。默认为"N"。 $wgBabelUseUserLanguage
- (布尔值)是否使用用户界面语言来表达页眉和页脚信息。如果是false(默认),将使用页面内容语言。这是因为使用用户界面语言可能会使解析器缓存碎片化。
$wgBabelCategorizeNamespaces
- 只对其添加自动分类的命名空间数组。 例如,如果配置
$wgBabelCategorizeNamespaces = [ NS_USER ];
,那么 Babel 将只向用户命名空间中的页面添加分类。 默认为null,这意味着对所有命名空间进行分类。 $wgBabelCategoryOverride
- 是否允许在wiki上用MediaWiki:Babel-category-override覆盖Babel类别
$wgBabelAutoCreate
- 是否自动创建分类页。
还可以使用MediaWiki命名空间自定义一些系统消息。
- MediaWiki:babel-template "
Template:User $1
" - 当包含一个模板时,模板名称的格式。
- MediaWiki:babel-portal "
"
- 来自语言代码的链接目标的格式。 设置为空字符串以不链接语言代码。
- MediaWiki:Babel-autocreate-user "
Babel AutoCreate
" - 用于自动创建Babel相关类别的用户名
- MediaWiki:babel-autocreate-text-levels "
此分类中的用户表示他们具有$2的$1级能力。 $4
" - 用于插入不同语言级别的自动创建的类别中的文本。如果你想让它们自动归入各自语言的主要类别(
$wgBabelMainCategory
),你必须改变这个。 - MediaWiki:babel-autocreate-text-main "
此分类中的用户能理解$1。 $3
" - 在自动创建的类别中插入非级别类别的文本。如果你想让它们在所有语言的父类中自动归类,你必须改变这个。
- MediaWiki:babel "
用户巴别信息
" - babel框的页顶 设置为
-
将会不显示标题。 - MediaWiki:babel-url "
Project:巴别
" - 可以找到有关Babel扩展信息的页面名称 设置为
-
可在标题中不显示任何链接。 - MediaWiki:Babel-footer "
用户(按语言)
" - babel框的页脚。 设置为
-
将不显示页脚。 - MediaWiki:babel-footer-url "
:Category:巴别-用户(按语言)
" - 在巴别框的页脚中链接到的页面
- MediaWiki:Babel-category-override "
$1
" - 覆盖任何自动生成的Babel类别。
$1 = 正常生成的分类。
$2 = 语言代码
$3 = babel 级别。
使用这种方法覆盖的任何类别将不会被自动创建,以减少对该页面的破坏或错误编辑的风险。
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]
![]() | 此用于一个或多个维基媒体项目。 这可能意味着足够稳定、运作足够良好,可以用在这样的高流量的网站上。 请在维基媒体的CommonSettings.php和InitialiseSettings.php中查找此的名称以查看哪些网站安装了该。 特定wiki上的已安装的的完整列表位于Special:Version页面。 |
![]() | 此在以下wiki农场/托管网站和/或软件包中提供: 這不是一份權威名單。 即使某些wiki农场/托管网站和/或软件包未在这里列出,它们也可能提供此。 请检查你的wiki农场/托管网站或软件包以确认提供情况。 |