Translate extension for MediaWiki
 
Loading...
Searching...
No Matches
MediaWiki\Extension\Translate\MessageGroupProcessing\CsvTranslationImporter Class Reference

Parse, validate and import translations from a CSV file. More...

Public Member Functions

 __construct (private readonly WikiPageFactory $wikiPageFactory,)
 
 parseFile (string $csvFilePath)
 Parse and validate the CSV file.
 
 importData (array $messagesWithTranslations, UserIdentity $user, string $comment, ?callable $progressReporter=null)
 Import the data returned from the parseFile method.
 

Detailed Description

Parse, validate and import translations from a CSV file.

Since
2022.06 @license GPL-2.0-or-later
Author
Abijeet Patro

Definition at line 24 of file CsvTranslationImporter.php.

Constructor & Destructor Documentation

◆ __construct()

MediaWiki\Extension\Translate\MessageGroupProcessing\CsvTranslationImporter::__construct ( private readonly WikiPageFactory $wikiPageFactory)

Definition at line 26 of file CsvTranslationImporter.php.

Member Function Documentation

◆ importData()

MediaWiki\Extension\Translate\MessageGroupProcessing\CsvTranslationImporter::importData ( array $messagesWithTranslations,
UserIdentity $user,
string $comment,
?callable $progressReporter = null )

Import the data returned from the parseFile method.

Parameters
array<int,array{messageTitle:string,translations:array<string,string>}>$messagesWithTranslations
UserIdentity$user
string$comment
null|callable(Title,PageUpdateStatus[],int,int):void$progressReporter If not null, called with the current message title, the per-language import results for that message, the number of messages to import and the number of messages imported so far

Definition at line 142 of file CsvTranslationImporter.php.

◆ parseFile()

MediaWiki\Extension\Translate\MessageGroupProcessing\CsvTranslationImporter::parseFile ( string $csvFilePath)

Parse and validate the CSV file.

Returns
StatusValue<array<int,array{messageTitle:string,translations:array<string,string>}>|null>

Definition at line 36 of file CsvTranslationImporter.php.


The documentation for this class was generated from the following file: