diff --git a/check-locales.php b/check-locales.php index 496906919dfac6bb7874452b2eb49046f48581a3..9e66e85a36be0f30fcb5ba55fbec6ecef93292f8 100644 --- a/check-locales.php +++ b/check-locales.php @@ -1,4 +1,20 @@ 1){ + $refLang = $argv[1]; + echo <<
+ + + + +

Output all "{$refLang}' language strings

+
+HEADER; + foreach ($langStrings['en'] as $k => $v){ - if (!isset($langStrings[$lang][$k])){ - echo "* In '$lang' missing locale '$k'\n"; - } else if (substr_count($langStrings['en'][$k], '%s') != substr_count($langStrings[$lang][$k], '%s')){ - echo "* In '$lang' the number of substitutions (%s) differ for '$k': "; - echo substr_count($langStrings['en'][$k], '%s').' vs '.substr_count($langStrings[$lang][$k], '%s'); - echo "\n"; + echo "
String: ".$k."
\n
\n"; + + echo "[en]: "; + if (substr_count($langStrings['en'][$k], '%s') > 0) { + echo sprintf($langStrings['en'][$k], 'https://example.value/1', 'https://example.value/2'); + } else { + echo $langStrings['en'][$k]; + } + echo "
\n"; + + echo "[".$refLang."]: "; + if (isset($langStrings[$refLang][$k]) && substr_count($langStrings[$refLang][$k], '%s') > 0){ + echo sprintf($langStrings[$refLang][$k], 'https://example.value/1', 'https://example.value/2'); + } elseif (isset($langStrings[$refLang][$k])) { + echo $langStrings[$refLang][$k]; + } else { + echo "---Missing---"; } + echo "\n
\n"; } + - foreach ($langStrings[$lang] as $k => $v){ - if (!isset($langStrings['en'][$k])){ - echo "In $lang obsolete locale $k\n"; + echo <<