public function action_admin_update() { if (false === ($this->request->getRequestMethod() == 'POST')) { return; } Clansuite_Debug::dump($this->request->getPost(), false); $locale_msgstr_array = $this->request->getParameterFromPost('locale_form'); $locale = $this->request->getParameterFromPost('locale'); $module = $this->request->getParameterFromPost('module'); var_dump($locale_msgstr_array); /** * Fetch the po file data of the target locale. */ include ROOT_FRAMEWORK . 'gettext/po.gettext.php'; $target_locale_pofile = $this->getModulePOFilename($module, $locale); $target_locale_data = Gettext_PO_File::read($target_locale_pofile); /** * $locale_msgstr_array is the following relation: * * msgid is the string in english as an identifier. * msgstr is the translation string to use for the identifier. * * msgid = 'house' (english) * msgstr = 'haus' (german) */ $added_counter = 0; $updated_counter = 0; foreach ($locale_msgstr_array as $msgid => $msgstr) { // only add something, if we got a translation string for this msgid if ($msgstr != '') { // if the msgstr already exists, then it's an update if (true === isset($target_locale_data[$msgid])) { $updated_counter = $updated_counter + 1; } else { // a new language string is added $added_counter = $added_counter + 1; } $target_locale_data[$msgid]['msgid'] = $msgid; $target_locale_data[$msgid]['msgstr'] = $msgstr; // @todo add plural strings #$target_locale_data[$msgid]['msgstr'] = array(0 => $msgstr); } } Clansuite_Debug::dump($target_locale_data); /*$msg = sprintf('Locale %s of Module %s updated. Added %s new language items. Updated %s language items.', $locale, $module, $added_counter, $updated_counter); $this->setFlashmessage('success', $msg);*/ }