XarayaTranslationMemory  1.6
export.php
Go to the documentation of this file.
1 #!/usr/bin/php
2 <?php
3 /***************************************************************************
4  * Copyright (C) 2005-2020 by Ferenc Veres *
5  * lion@netngine.hu *
6  * *
7  * This program is free software; you can redistribute it and/or modify *
8  * it under the terms of the GNU General Public License as published by *
9  * the Free Software Foundation; either version 3 of the License, or *
10  * (at your option) any later version. *
11  * *
12  * This program is distributed in the hope that it will be useful, *
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
15  * GNU General Public License for more details. *
16  * *
17  * You should have received a copy of the GNU General Public License *
18  * along with this program. If not, see <http://www.gnu.org/licenses/>. *
19  ***************************************************************************/
20 if(empty($argc))
21 {
22  exit;
23 }
24 include_once('config.inc.php');
25 include_once('export/ExporterFactory.php');
26 include_once('lib/Common.php');
27 
28 $DB = NewADOConnection(GetConfigVar('db_software'));
29 $DB->Connect(GetConfigVar('db_host'), GetConfigVar('db_username') , GetConfigVar('db_password'), GetConfigVar('db_database'));
30 $DB->Execute("SET NAMES utf8");
31 CacheIndexes();
32 
33 // To export a translaiton
34 
35 if($argc != 3 || empty(TranslationProject::$LocaleIDCache[$argv[1]]))
36 {
37  echo "Usage: export.php localename projecttype\n";
38 
39  echo "Known locales:\n";
40  foreach(TranslationProject::$LocaleIDCache as $name => $id)
41  {
42  echo " $name\n";
43  }
44 
45  echo "Known project types:\n";
46  if($argc >= 2 && !empty(TranslationProject::$LocaleIDCache[$argv[1]]))
47  {
48  $locale = TranslationProject::$LocaleIDCache[$argv[1]];
49  foreach(TranslationProject::GetRoots($locale) as $id => $proj)
50  {
51  echo " ".$proj->GetName()."\n";
52  }
53  }
54  else
55  {
56  echo " (please specify locale name to list)\n";
57  }
58 
59  exit;
60 }
62 $proc = $factory->NewExporter($argv[2]);
63 $proc->Export($argv[1]);
64 
65 ?>
CacheIndexes()
Definition: Common.php:94
if($argc !=3||empty(TranslationProject::$LocaleIDCache[$argv[1]])) $factory
Definition: export.php:61
$proc
Definition: export.php:62
GetConfigVar($varName)
Definition: Common.php:84
$DB
Definition: export.php:28
static GetRoots($localeID)