public function run($userId, $mode = 'test')
 {
     $testMode = $mode != 'run';
     $message = "Import Other Language Semantic Domain Projects\n\n";
     $languages = array('es', 'fa', 'hi', 'id', 'km', 'ko', 'ne', 'pt', 'ru', 'te', 'th', 'ur', 'zh-CN');
     //$languages = array('es', 'fa');
     $languageData = new LanguageData();
     $languageData->read();
     foreach ($languages as $lang) {
         $projectCode = SemDomTransProjectModel::projectCode($lang);
         $languageName = $languageData->getLanguage($lang)->name;
         $projectName = SemDomTransProjectModel::projectName($lang, $languageName);
         $existingProject = new SemDomTransProjectModel();
         $existingProject->readByCode($lang);
         if ($existingProject->id->asString() != '') {
             $message .= "{$projectName} already exists!  Removing...\n";
             if (!$testMode) {
                 $existingProject->remove();
             }
         }
         if (!$testMode) {
             $projectId = self::_createEmptyProject($lang, $languageName, $userId);
             $projectModel = ProjectModel::getById($projectId);
             $xmlFilePath = APPPATH . "resources/languageforge/semdomtrans/LocalizedLists-{$lang}.xml";
             $projectModel->importFromFile($xmlFilePath);
         }
         $message .= "Finished importing the {$projectName} \n";
     }
     return $message;
 }
 public function testLanguageData_DataExists()
 {
     $languages = new LanguageData();
     $this->assertTrue($languages->count() >= 7725);
     $this->assertEquals('English', $languages['eng']->name);
     $this->assertEquals('English', $languages['en']->name);
     $this->assertEquals('Maori', $languages['mri']->name);
     $this->assertEquals('Maori', $languages['mi']->name);
     $this->assertEquals('Unlisted Language', $languages['qaa']->name);
 }
 public function testLanguageData_DataExists()
 {
     $languages = new LanguageData();
     $this->assertTrue($languages->count() >= 7725);
     $this->assertEqual($languages['eng']->name, "English");
     $this->assertEqual($languages['en']->name, "English");
     $this->assertEqual($languages['mri']->name, "Maori");
     $this->assertEqual($languages['mi']->name, "Maori");
     $this->assertEqual($languages['qaa']->name, "Unlisted Language");
 }
 /**
  * Adds an input system if it doesn't already exist
  * @param string $tag
  * @param string $abbr
  * @param string $name
  */
 public function addInputSystem($tag, $abbr = '', $name = '')
 {
     static $languages = null;
     if (!array_key_exists($tag, $this->inputSystems)) {
         if (!$abbr) {
             $abbr = $tag;
         }
         if (!$name) {
             $name = $tag;
             if (!$languages) {
                 $languages = new LanguageData();
             }
             $languageCode = LanguageData::getCode($tag);
             if (array_key_exists($languageCode, $languages)) {
                 $name = $languages[$languageCode]->name;
             }
         }
         $this->inputSystems[$tag] = new InputSystem($tag, $name, $abbr);
     }
 }