View of /mambo/branches/4.6/administrator/components/com_languages/actions/apply.action.php
Parent Directory
|
Revision Log
Revision 561 -
(download)
(annotate)
Thu Jun 8 09:17:26 2006 UTC (6 years, 11 months ago) by csouza
File size: 2039 byte(s)
Thu Jun 8 09:17:26 2006 UTC (6 years, 11 months ago) by csouza
File size: 2039 byte(s)
<?php
class applyAction extends Action
{
function execute(&$controller, &$request)
{
$domain = $_POST['domain'];
$textdomain = $_POST['textdomain'];
$lang = $_POST['lang'];
$catalog = new PHPGettext_catalog($domain, $textdomain);
$catalog->setproperty('mode', 'po');
$catalog->setproperty('lang', $lang);
$catalog->load();
$catalog->setComments($_POST['comments']);
$catalog->setHeaders($_POST['headers']);
foreach ($_POST as $key => $value) {
if (preg_match('/^([a-z]+)[_]?([0-9]+)?_([0-9]+)$/', $key, $matches)) {
switch ($matches[1])
{
case 'msgid':
$messages[$matches[3]]['msgid'] = $value;
break;
case 'msgid_plural':
$messages[$matches[3]]['msgid_plural'] = $value;
break;
case 'msgstr':
if ($matches[2] != '') {
$messages[$matches[3]]['msgstr'][$matches[2]] = stripslashes($value);
} else {
$messages[$matches[3]]['msgstr'] = stripslashes($value);
}
break;
case 'fuzzy':
$messages[$matches[3]]['fuzzy'] = $value == 'true' ? true : false;
break;
}
}
}
foreach ($messages as $index => $arr) {
if (strcmp($catalog->strings[$index]->msgid, $arr['msgid']) == 0) {
$catalog->strings[$index]->setmsgstr($arr['msgstr']);
if ($arr['fuzzy']) {
$catalog->strings[$index]->setfuzzy($arr['fuzzy']);
}
}
}
$catalog->save();
if ($request->get('act') == 'catalogs') {
$request->set('domain', $domain);
}
$controller->view('edit');
}
}
?>| ViewVC Help | |
| Powered by ViewVC 1.0.0 |

