【发布时间】:2020-01-01 09:06:21
【问题描述】:
我有一个 MediaWiki 1.33.0 网站,只有一个扩展名 → ContactPage,我可以通过它获得一个简单的联系表格。
使用HTMLForms template engine(其中写有default form-template for ContactPage),我扩展了默认表单以包含一个选择菜单。
我的问题
此选择菜单的选择列表数组键和值在 LocalSettings.php 内用英文编写,但我的网站主要不是 LTR 英语,而是 RTL 希伯来语,我希望它们出现在我的为最终用户提供网站的母语。
我自己的代码模式
wfLoadExtension( 'ContactPage' );
$wgContactConfig['default'] = array(
'RecipientUser' => 'Admin', // Must be the name of a valid account which also has a verified e-mail-address added to it.
'SenderName' => 'Contact Form on ' . $wgSitename, // "Contact Form on" needs to be translated
'SenderEmail' => null, // Defaults to $wgPasswordSender, may be changed as required
'RequireDetails' => true, // Either "true" or "false" as required
'IncludeIP' => false, // Either "true" or "false" as required
'MustBeLoggedIn' => false, // Check if the user is logged in before rendering the form
'AdditionalFields' => array(
'omgaselectbox' => [
'class' => 'HTMLSelectField',
'label' => 'Select an option',
'options' => [
'X' => 'X',
'Y' => 'Y',
'Z' => 'Z',
],
],
),
// Added in MW 1.26
'DisplayFormat' => 'table', // See HTMLForm documentation for available values.
'RLModules' => array(), // Resource loader modules to add to the form display page.
'RLStyleModules' => array(), // Resource loader CSS modules to add to the form display page.
);
可能的解决方案
1) 用希伯来语编写选择列表数组键和值(由于 LTR-RTL 冲突,这可能有点混乱):
'options' => [
'ס' => 'ס',
'ט' => 'ט',
'ז' => 'ז',
],
2) 用一些类似的代码在客户端 JavaScript 中翻译英文选择列表数组键和值:
document.getElementById('select').selectedIndex = 0;
document.getElementById('select').value = 'Default';
我的愿望
我想要一种有序的后端方式来做到这一点,如果有的话,而不是没有扩展
In this discussion,MediaWiki 社区成员推荐使用system message transclution,但处理它的章节对我来说非常不清楚;我不明白这是怎么回事,这对我的情况有何帮助。
我的问题
在 MediaWiki 中从“后端”进行翻译的可能方式有哪些?
【问题讨论】:
标签: php html forms translation mediawiki