aboutsummaryrefslogtreecommitdiffstats
path: root/tools/translation_analysis.php
diff options
context:
space:
mode:
authorplegall <plg@piwigo.org>2010-01-09 20:54:52 +0000
committerplegall <plg@piwigo.org>2010-01-09 20:54:52 +0000
commit38cfeceb3621fd8f16cee1e4deade40584e11244 (patch)
treea6db6c2c0e3e326e216e7a632d243a01e6c5ee02 /tools/translation_analysis.php
parent04792e79e919176a5cabe55867e65e9a8d65a717 (diff)
feature 1374 related: force to load exactly the language requested and not any
fallback language. If the language file is missing, we tell it explicitely. git-svn-id: http://piwigo.org/svn/branches/2.0@4638 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to '')
-rw-r--r--tools/translation_analysis.php44
1 files changed, 27 insertions, 17 deletions
diff --git a/tools/translation_analysis.php b/tools/translation_analysis.php
index bf5bc4120..b1a3cb77b 100644
--- a/tools/translation_analysis.php
+++ b/tools/translation_analysis.php
@@ -48,37 +48,47 @@ foreach ($languages as $language)
foreach ($file_list as $file)
{
- $missing_keys = array_diff(
- array_keys($metalang[ $page['ref_compare'] ][$file]),
- array_keys($metalang[ $language ][$file])
- );
-
- $output = '';
- foreach ($missing_keys as $key)
+ if (isset($metalang[ $language ][$file]))
{
- $print_key = str_replace("'", '\\\'', $key);
- $print_value = str_replace("'", '\\\'', $metalang[ $page['ref_default_values'] ][$file][$key]);
- $output.= '$'."lang['".$print_key."'] = '".$print_value."';\n";
- }
+ $missing_keys = array_diff(
+ array_keys($metalang[ $page['ref_compare'] ][$file]),
+ array_keys($metalang[ $language ][$file])
+ );
+
+ $output = '';
+ foreach ($missing_keys as $key)
+ {
+ $print_key = str_replace("'", '\\\'', $key);
+ $print_value = str_replace("'", '\\\'', $metalang[ $page['ref_default_values'] ][$file][$key]);
+ $output.= '$'."lang['".$print_key."'] = '".$print_value."';\n";
+ }
- if ('' != $output)
+ if ('' != $output)
+ {
+ echo '<h3>'.$file.'.lang.php</h3>';
+ echo '<textarea style="width:100%;height:150px;">'.$output.'</textarea>';
+ }
+ }
+ else
{
- echo '<h3>'.$file.'.lang.php</h3>';
- echo '<textarea style="width:100%;height:150px;">'.$output.'</textarea>';
+ echo '<h3>'.$file.'.lang.php is missing</h3>';
}
}
}
function load_metalang($language, $file_list)
{
- global $lang;
+ global $lang, $user;
$metalang = array();
foreach ($file_list as $file)
{
$lang = array();
- load_language($file.'.lang', '', array('language'=>$language));
- $metalang[$file] = $lang;
+ $user['language'] = $language;
+ if (load_language($file.'.lang', '', array('language'=>$language, 'no_fallback'=>true)))
+ {
+ $metalang[$file] = $lang;
+ }
}
return $metalang;
}