Source for file auto_translate.action.php
Documentation is available at auto_translate.action.php
* @copyright Refer to copyright.php
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
* @author Mambo Foundation Inc see README.php
defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' );
function execute(&$controller, &$request)
$domain =
$_POST['domain'];
$textdomain =
$_POST['textdomain'];
$catalog =
new PHPGettext_catalog($domain, $textdomain);
$catalog->setproperty('mode', 'po');
$catalog->setproperty('lang', $lang);
$catalog->setComments($_POST['comments']);
$catalog->setHeaders($_POST['headers']);
foreach ($_POST as $key =>
$value) {
if (preg_match('/^([a-z]+)[_]?([0-9]+)?_([0-9]+)$/', $key, $matches)) {
$messages[$matches[3]]['msgid'] =
$value;
$messages[$matches[3]]['msgid_plural'] =
$value;
$messages[$matches[3]]['msgstr'][$matches[2]] =
stripslashes($value);
$messages[$matches[3]]['fuzzy'] =
$value ==
'true' ?
true :
false;
foreach ($messages as $index =>
$arr) {
if (strcmp($catalog->strings[$index]->msgid, $arr['msgid']) ==
0) {
$catalog->strings[$index]->setmsgstr($arr['msgstr']);
$catalog->strings[$index]->setfuzzy($arr['fuzzy']);
$gettext_admin->update_translation($domain, $textdomain, $lang);
if ($request->get('act') ==
'catalogs') {
$request->set('domain', $domain);
$controller->view('edit');
Documentation generated on Mon, 05 May 2008 16:16:45 +0400 by phpDocumentor 1.4.0