'; // print_r($_POST); // die; include_once('../init.php'); $iso = Tools::getValue('iso'); if (Tools::isSubmit('submitTranslations')) { if (!file_exists('../langs/'.$iso.'/install.php')) die('translation file does not exists'); $translated_content = include('../langs/'.$iso.'/install.php'); unset($_POST['iso']); unset($_POST['submitTranslations']); foreach ($_POST as $post_key => $post_value) if (!empty($post_value)) $translated_content['translations'][my_urldecode($post_key)] = $post_value; $new_content = " $value1) { $new_content .= "\t'".just_quotes($key1)."' => array(\n"; foreach ($value1 as $key2 => $value2) $new_content .= "\t\t'".just_quotes($key2)."' => '".just_quotes($value2)."',\n"; $new_content .= "\t),\n"; } $new_content .= ");"; file_put_contents('../langs/'.$iso.'/install.php', $new_content); echo 'Translations Updated

'; } $regex = '/->l\(\'(.*[^\\\\])\'(, ?\'(.+)\')?(, ?(.+))?\)/U'; $dirs = array('classes', 'controllers', 'models', 'theme'); $languages = scandir('../langs'); $files = $translations = $translations_source = array(); foreach ($dirs as $dir) { $files = array_merge($files, Tools::scandir('..', 'php', $dir, true)); $files = array_merge($files, Tools::scandir('..', 'phtml', $dir, true)); } foreach ($files as $file) { $content = file_get_contents('../'.$file); preg_match_all($regex, $content, $matches); $translations_source = array_merge($translations_source, $matches[1]); } $translations_source = array_map('stripslashes', $translations_source); if ($iso && (file_exists('../langs/'.$iso.'/install.php'))) { $translated_content = include('../langs/'.$iso.'/install.php'); $translations = $translated_content['translations']; } echo '
'; foreach ($translations_source as $translation_source) echo ' '; echo '
Source Your translation
'.htmlspecialchars($translation_source, ENT_NOQUOTES, 'utf-8').'
'; function just_quotes($s) {return addcslashes($s, '\\\'');} function my_urlencode($s) {return str_replace('.', '_dot_', urlencode($s));} function my_urldecode($s) {return str_replace('_dot_', '.', urldecode($s));}