Help:Extension:Translate/Import Translations via CSV/zh
本頁說明的功能可以讓翻譯者透過CSV檔向系統管理員提交他們的翻譯、並將其匯入。 T309517
步骤
导出CSV檔
首先确定您希望通过CSV檔提交翻译的页面。 示例页面:开发指南。
前往Special:ExportTranslations並將該頁面以法文(fr)的CSV格式匯出。
匯出的CSV檔案格式如下:
- 圖片中的紅圈1--來源語言中定義的訊息
- 圖片中的紅圈2--被匯出語言的翻譯,在本例中為法文。
添加翻译到CSV檔
可以修改上一步中导出的文件以更新现有翻译或添加更多翻译。
请参见CSV檔中的下图,该文件添加了西班牙语(ES)和荷兰语(NL)的翻译:
然后,可以将该文件提供给管理员,以便将翻译导入系统。
注意
- 空的翻譯會被忽略。 如果CSV檔中的單元格為空白,翻譯實際上不會被移除。
- 如果未對翻譯進行修改,則不會在翻譯變更歷史中添加新條目。
通过CSV导入翻译
從翻譯者接收到的檔案可透過翻译importTranslationsFromCsv.php
中提供的命令列指令碼匯入:
指令碼預期會有下列參數:
- CSV 檔案的路徑
--user
- 執行匯入的使用者名稱--summary
- 在更新翻譯時所使用的編輯摘要--really
- 實際執行匯入。如果沒有這個選項,則會進行試運行。
執行範例
首先,進行試運行,看看會匯入什麼:
$ php extensions/Translate/scripts/importTranslationsFromCsv.php ~/Projects/html/mediawiki/groups/page-Development\ Guidelines_to_import.csv --user Admin --summary "Importing translations from CSV"
* 3 translation(s) to import for Translations:Development Guidelines/Page display title/en
* 2 translation(s) to import for Translations:Development Guidelines/1/en
* 2 translation(s) to import for Translations:Development Guidelines/2/en
* 2 translation(s) to import for Translations:Development Guidelines/3/en
* 2 translation(s) to import for Translations:Development Guidelines/4/en
* 2 translation(s) to import for Translations:Development Guidelines/5/en
Use option --really to perform the import.
現在執行實際匯入:
$ php ./extensions/Translate/scripts/importTranslationsFromCsv.php ~/Projects/html/mediawiki/groups/page-Development\ Guidelines_to_import.csv --user Admin --summary "Importing translations from CSV" --really
* 3 translation(s) to import for Translations:Development Guidelines/Page display title/en
* 2 translation(s) to import for Translations:Development Guidelines/1/en
* 2 translation(s) to import for Translations:Development Guidelines/2/en
* 2 translation(s) to import for Translations:Development Guidelines/3/en
* 2 translation(s) to import for Translations:Development Guidelines/4/en
* 2 translation(s) to import for Translations:Development Guidelines/5/en
Proceeding with import...
(1/6) Imported translations for Translations:Development Guidelines/Page display title/en with 0 failure(s) and 3 successful import(s) ...
(2/6) Imported translations for Translations:Development Guidelines/1/en with 0 failure(s) and 2 successful import(s) ...
(3/6) Imported translations for Translations:Development Guidelines/2/en with 0 failure(s) and 2 successful import(s) ...
(4/6) Imported translations for Translations:Development Guidelines/3/en with 0 failure(s) and 2 successful import(s) ...
(5/6) Imported translations for Translations:Development Guidelines/4/en with 0 failure(s) and 2 successful import(s) ...
(6/6) Imported translations for Translations:Development Guidelines/5/en with 0 failure(s) and 2 successful import(s) ...
Success: Import done
You might have to flush the job queue in order to be able to see the translated pages immediately:
$ php maintenance/run.php runJobs