private function dev_locale($die = true, $quick = false) { # Search metadata ... $terms = array(); $sourceIncluded = false; # module (model) foreach ($this->parent->modules as $modulename => &$moduleObj) { if (!in_array($modulename, $terms)) { if (!$sourceIncluded) { $terms[] = "-- Modules"; $sourceIncluded = true; } $terms[] = $modulename; } if (!$moduleObj->options[CONS_MODULE_SYSTEM]) { foreach ($moduleObj->fields as $fieldname => &$fieldObj) { if (!in_array($fieldname, $terms)) { if (!$sourceIncluded) { $terms[] = "-- Modules"; $sourceIncluded = true; } $terms[] = $fieldname; } if ($fieldObj[CONS_XML_TIPO] == CONS_TIPO_ENUM) { preg_match("@ENUM \\(([^)]*)\\).*@", $fieldObj[CONS_XML_SQL], $regs); $enums = explode(",", $regs[1]); foreach ($enums as $enum) { $enum = str_replace("'", "", $enum); if ($enum != '' && !in_array($enum, $terms)) { if (!$sourceIncluded) { $terms[] = "-- Modules"; $sourceIncluded = true; } $terms[] = $enum; } } } } } } # Search i18n translators at the template $tpl = listFiles(CONS_PATH_PAGES . $_SESSION['CODE'] . "/template/", "@.*\\.html?@i", false, false, true); foreach ($tpl as $file) { $sourceIncluded = false; $template = new CKTemplate(); $template->fetch(CONS_PATH_PAGES . $_SESSION['CODE'] . "/template/{$file}"); if ($template->errorsDetected && !$quick) { echo "Error reported on " . CONS_PATH_PAGES . $_SESSION['CODE'] . "/template/{$file}<br/>"; } $tags = $template->getAllTags(true); if (isset($tags['_t'])) { foreach ($tags['_t'] as $tag) { if ($tag != '' && !in_array($tag, $terms)) { if (!$sourceIncluded) { $terms[] = "-- /template/{$file}"; $sourceIncluded = true; } $terms[] = $tag; } } } } # Search i18n translators at plugin templates foreach ($this->parent->loadedPlugins as $pname => &$pobj) { $sourceIncluded = false; $tpl = listFiles(CONS_PATH_SYSTEM . "plugins/{$pname}/payload/template/", "@.*\\.html?@i", false, false, true); foreach ($tpl as $file) { $template = new CKTemplate(); $template->fetch(CONS_PATH_SYSTEM . "plugins/{$pname}/payload/template/{$file}"); if ($template->errorsDetected && !$quick) { echo "Error reported on " . CONS_PATH_SYSTEM . "plugins/{$pname}/payload/template/{$file}<br/>"; } $tags = $template->getAllTags(true); if (isset($tags['_t'])) { foreach ($tags['_t'] as $tag) { if ($tag != '' && !in_array($tag, $terms)) { if (!$sourceIncluded) { $terms[] = "-- Plugin {$pname} /template/{$file}"; $sourceIncluded = true; } $terms[] = $tag; } } } } } # ok $totalTerms = count($terms); # now which terms are NOT translated? $notTranslated = array(); $context = ""; $lastcontext = ""; $contexts = 0; foreach ($terms as $term) { $sourceIncluded = false; if ($term[0] != "-") { if (!isset($this->parent->template->lang_replacer[$term])) { if (!$sourceIncluded) { if ($lastcontext != $context) { $notTranslated[] = $context; } $lastcontext = $context; $contexts++; $sourceIncluded = true; } $notTranslated[] = $term; } } else { $context = $term; } } $totalNotTranslated = count($notTranslated) - $contexts; if (!$quick) { echo "i18n translators for this language: <strong>" . $_SESSION[CONS_SESSION_LANG] . "</strong><br/>"; echo "Total terms: " . $totalTerms . "<br/>"; echo "<strong>not translated terms: " . $totalNotTranslated . "</strong><br/>List of not translated:<br/>"; echo "<blockquote>"; foreach ($notTranslated as $nT) { echo $nT . "<br/>"; } echo "</blockquote>"; } if ($die) { $this->parent->close(true); die; } return $totalNotTranslated > 0 ? $notTranslated : false; }