function _g($str, $comment = '') { return Simplel10n::getString($str); }
function update_lang_files($source, $dest) { $files = find_all_files($source); foreach ($files as $file) { extract_l10n_strings($file); } $files = scandir($dest); $ignore = array('.', '..'); // list locales $locales = array(); foreach ($files as $file) { if (in_array($file, $ignore)) { continue; } $split = explode('.', $file); if ($split[1] == 'lang') { $locales[] = $split[0]; } } foreach ($locales as $locale) { $status[$locale] = 0; $lang_file_path = $dest . '/' . $locale; Simplel10n::load($lang_file_path); ob_start(); foreach ($GLOBALS['english'] as $key => $val) { $warning = ''; $value = @Simplel10n::extractString($key); if ($value == $val[0]) { $status[$locale]++; $warning = ' ** String needs translation **'; } if ($val[1]) { echo '# Translation note: ' . $val[1] . $warning . "\n"; } elseif ($warning != '') { echo '# Translation note: ' . $warning . "\n"; } echo ";{$val['0']}\n"; echo $value . "\n\n\n"; } $content = ob_get_contents(); ob_end_clean(); file_put_contents($lang_file_path . '.lang', $content); unset($GLOBALS['locale']); } // Display a short status report header('Content-Type:text/plain'); echo "Number of English strings: " . count($GLOBALS['english']) . "\n"; echo "Your installation has these languages installed: " . implode(', ', $locales) . "\n"; foreach ($locales as $val) { echo $val . " has " . $status[$val] . " untranslated strings.\n"; } }