-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpushPotEntries.php
executable file
·39 lines (33 loc) · 1.19 KB
/
pushPotEntries.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<?php
// Check that all required arguments were passed
if (count($argv) < 4)
{
echo 'Syntax is "php pushPotEntries.php repoName potfile.pot sourceDocName"' . "\n";
echo 'e.g. php pushPotEntries.php trunk.elms trunk.elms.pot sourceDocName' . "\n";
exit("Missing parameters");
}
require_once('conf.php');
require_once('ZanataPHPToolkit.php');
$zanataUrl = $GLOBALS['conf']['zanata']['url'];
$user = $GLOBALS['conf']['zanata']['user'];
$apiKey = $GLOBALS['conf']['zanata']['apiKey'];
$projectSlug = '';
$iterationSlug = '';
// Extract the repo name and POT file path from the parameters
$repoName = $argv[1];
$potFilePath = $argv[2];
$sourceDocName = $argv[3];
// Attempt to find the repo name in the config.ini file
if (isset($GLOBALS['conf']['repos'][$repoName]))
{
$projectSlug = $GLOBALS['conf']['repos'][$repoName]['projectSlug'];
$iterationSlug = $GLOBALS['conf']['repos'][$repoName]['iterationSlug'];
}
else
{
exit("Unknown project, no section $repoName in conf.php file");
}
// Update the source entries on Zanata!
$zanataToolkit = new ZanataPHPToolkit($user, $apiKey, $projectSlug, $iterationSlug, $zanataUrl, true);
exit($zanataToolkit->pushPotEntries($potFilePath, $sourceDocName, 'en-GB'));
?>