memid = $user->id; $projects->find(false); while($projects->fetch()) $proj[$projects->id] = $projects->short; $form = new HTML_QuickForm('frmTest', 'post'); $form->addElement('header', 'hdrTesting', 'testing form'); $form->addElement('select', 'project', _("Project Name").":", $proj); $form->addElement('select', 'editlanguage', _("Project Language").":", $languages); $form->addElement('select', 'fileformat', _("File Format").":", array("HTML Entities", "UTF-8")); $form->addElement('submit', 'submit', _("Export File")); $lang = "en_AU"; if($_GET['editlanguage'] != "") $lang = $_GET['editlanguage']; if($_POST['editlanguage'] != "") $lang = $_POST['editlanguage']; $form->setDefaults(array("project" => intval($_GET['pid']), "editlanguage" => $lang)); $renderer =& new HTML_QuickForm_Renderer_ArraySmarty($smarty); $form->accept($renderer); $smarty->assign('form', $renderer->toArray()); $process = 0; if($form->validate()) $process = 1; if($process == 1) { $pid = $form->exportValue('project'); $lang = $form->exportValue('editlanguage'); $format = $form->exportValue('fileformat'); $base =& new DataObject_Projects(); $base->id = $pid; $base->find(false); $base->fetch(); header("Content-Type: text/plain"); echo "# translation of messages.po to $lang.po\n"; echo "# This file is distributed under the same license as the PACKAGE package.\n"; echo "# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER.\n\n"; echo "msgid \"\"\n"; echo "msgstr \"\"\n"; echo "\"Project-Id-Version: de\\n\"\n"; echo "\"Report-Msgid-Bugs-To: \\n\"\n"; echo "\"POT-Creation-Date: $base->created+0000\\n\"\n"; echo "\"PO-Revision-Date: ".gmdate("Y-m-d H:i:s")."+0000\\n\"\n"; echo "\"Last-Translator: Someone \\n\"\n"; echo "\"Language-Team: \\n\"\n"; echo "\"MIME-Version: 1.0\\n\"\n"; echo "\"Content-Type: text/plain; charset=UTF-8\\n\"\n"; echo "\"Content-Transfer-Encoding: 8bit\\n\"\n"; echo "\"X-Generator: http://www.TransLingo.org\\n\"\n"; $proj =& new DataObject_Base(); $proj->pid = $pid; $proj->find(false); while($proj->fetch()) { $trans =& new DataObject_Translations(); $trans->pid = $pid; $trans->baseid = $proj->id; $trans->language = $lang; $trans->find(false); $trans->fetch(); if($format == "0") { echo "\n"; echo $proj->comment; echo "msgid \""; if(strstr($proj->string, "\n")) echo "\"\n\""; echo str_replace("\n", "\"\n\"", $proj->string)."\"\n"; echo "msgstr \""; if(strstr($trans->string, "\n")) echo "\"\n\""; echo str_replace("\n", "\"\n\"", $trans->string)."\"\n"; } else { echo "\n"; echo recode("html..utf-8", $proj->comment); echo "msgid \""; if(strstr($proj->string, "\n")) echo "\"\n\""; echo str_replace("\n", "\"\n\"", recode("html..utf-8", $proj->string))."\"\n"; echo "msgstr \""; if(strstr($trans->string, "\n")) echo "\"\n\""; echo str_replace("\n", "\"\n\"", recode("html..utf-8", $trans->string))."\"\n"; } } exit; } $smarty->display('lheader.tpl'); $smarty->display('export.tpl'); $smarty->display('lfooter.tpl'); ?>