手册:$wgNamespaceAliases
Appearance
Outdated translations are marked like this.
| 命名空间: $wgNamespaceAliases | |
|---|---|
| 为名字空间提供其他名称。 |
|
| 引进版本: | 1.10.0 (r21720) |
| 移除版本: | 仍在使用 |
| 允许的值: | (字符串数组) |
| 默认值: | [] |
| 其他设置: 按首字母排序 | 按功能排序 | |
详情
这些是主要本地化名字空间名称的备用名称,它们由$wgExtraNamespaces和语言文件定义。[需要澄清]
如果请求具有此类前缀的页面,则请求将重定向到主名称。
将其设置为从命名空间名称到ID的映射。
示例:
$wgNamespaceAliases = [
'Wikipedian' => NS_USER,
'Wikipedian_talk' => NS_USER_TALK,
'Our_wiki' => 4,
'Our_wiki_talk' => 5,
];
| 在命名空间名称中使用下划线而不是空格。 “My Namespace”是无效的名称,请改用“My_Namespace”。 (When used later on the wiki in links and searches, either spaces or underscores can be used.) |
在MediaWiki 1.17之前,无法为NS_MAIN创建别名。
Namespace names, including aliases, are case-insensitive. 'Wikipedian', 'wikipedian', and 'WIKIPEDIAN' are all the same alias.
Notice how aliases are being defined here for two namespaces and their corresponding talk namespaces. Including similar aliases for talk namespaces is not strictly necessary, but not doing so can be confusing to users.
要添加单个别名:
$wgNamespaceAliases['WP'] = NS_PROJECT;
$wgNamespaceAliases['WPT'] = NS_PROJECT_TALK;
$wgNamespaceAliases['WP_talk'] = NS_PROJECT_TALK;
This illustrates how multiple aliases can be used for the same namespace.
如果此设置设置为不存在的命名空间(例如,命名空间尚未添加到$wgExtraNamespaces但已定义常量),则别名将重定向到主空间。