if ($langs) { $lang=$langs[0]; $lang->load(); } else { $lang=new LPC_Language(); $lang->setAttr('locale_POSIX',$langData['locale_POSIX']); } $lang->setAttr('name',$langData['name']); $lang->save(); $langMapping[$langData['id']]=$lang->id; } // Messages foreach($inData['messages'] as $msgKey=>$msgData) { $ref=new LPC_I18n_reference($msgKey); if ($ref->probe()) { $ref->load(); $ref->setAttrs(array( 'comment'=>$msgData['comment'], 'system'=>$msgData['system'], )); $ref->save(); } else { $ref->setAttrs(array( 'comment'=>$msgData['comment'], 'system'=>$msgData['system'], )); $ref->insertWithId(); } foreach($msgData['translations'] as $trnData) {
static function checkReference($messageKey) { if (in_array($messageKey,self::$known_references)) return; self::$known_references[]=$messageKey; $ref=new LPC_I18n_reference($messageKey); if ($ref->probe()) return; $ref->insertWithId($messageKey); }
$msg=new LPC_I18n_message(); $msg=$msg->search( array('language','message_key'), array($_SESSION['LPC_target_lang'],$msgKey) ); if ($msg) $msg=$msg[0]; else { $msg=new LPC_I18n_message(); $msg->setAttr('language',$_SESSION['LPC_target_lang']); $msg->setAttr('message_key',$msgKey); } $ref=new LPC_I18n_reference($msgKey); if (!$ref->probe()) { $p->a("<div class='container'>← <a href='message_select.php'>Back to the message list</a></div>"); $p->a(new LPC_HTML_error("This reference message was not found in the database: [".htmlspecialchars($msgKey)."]")); $p->show(); return; $p->show(); } if (isset($_POST['delete'])) { $ref->delete(); header("Location: message_select.php"); exit; } $target_lang=new LPC_Language($_SESSION['LPC_target_lang']); $reference_lang=new LPC_Language($_SESSION['LPC_reference_lang']); if (isset($_POST['submit'])) {