Manual:generateJsonI18n.php
From Linux Web Expert
MediaWiki ファイル: generateJsonI18n.php | |
---|---|
場所: | maintenance/ |
ソース コード: | master • 1.41.1 • 1.40.3 • 1.39.7 |
クラス: | GenerateJsonI18n |
詳細
MediaWiki バージョン: | <translate> ≥</translate> 1.23 Gerrit change 102171 |
generateJsonI18n.php file is a maintenance script to generate JSON-formatted i18n files from legacy PHP array-based MediaWiki i18n files.
使用法
php maintenance/generateJsonI18n.php phpfile jsondir
where:
- phpfile - PHP file defining a $messages array. Required unless
--extension
is provided. - jsondir - directory to write the JSON files to. Will default to
$phpfile/i18n
.
スクリプト固有のパラメーター
オプション/パラメーター | 説明 |
---|---|
--langcode="lang" | 言語コード。コアの i18n ファイルを変換する場合のみ必要。 |
--extension | 1.24 Perform default conversion on an extension. If you use this parameter, don't specify the phpfile argument. It will make phpfile be set as "$IP/extensions/$extension/$extension.i18n.php" , and targetfolder will be set to i18n
|
--shim-only | Only create or update the backward-compatibility shim |
--supplementary | Find supplementary i18n files in subdirs and convert those |
例
cd core/extensions/YourExtension
mkdir i18n
php ../../maintenance/generateJsonI18n.php ExtensionName.i18n.php i18n
MediaWiki バージョン: | <translate> ≥</translate> 1.24 Gerrit change 122659 |
Alternate way for extensions, since Gerrit change 122659: This example performs the default conversions in $IP/extensions/WikiLove/
, replacing the WikiLove.i18n.php
file with a backwards-compatibility shim and porting messages to the WikiLove/i18n/
directory.
php maintenance/generateJsonI18n.php --extension WikiLove
Suggested migration process
If your extension has not been converted already:
- Make sure you have the latest code
- Create the
i18n
directory
- Run the script
- Update your extension's entry file to add
$wgMessagesDirs ['YourExtension'] = __DIR__ . '/i18n'
;
- Commit it to Gerrit if the extension is hosted there
- Wait for review and all should go smoothly
関連項目
- Requests for comment/Localisation format for background