use propper language names

This commit is contained in:
Uwe Steinmann 2023-03-01 12:16:41 +01:00
parent 05b95bd0ed
commit 198dc8c730

View File

@ -1,7 +1,7 @@
<?php <?php
/* Determine all languages keys used in the php files */ /* Determine all languages keys used in the php files */
$output = array(); $output = array();
if(exec('sgrep -o "%r\n" \'"tMLText(\"" __ "\""\' */*.php|sort|uniq -c', &$output)) { if(exec('sgrep -o "%r\n" \'"tMLText(\"" __ "\""\' */*.php|sort|uniq -c', $output)) {
$allkeys = array(); $allkeys = array();
foreach($output as $line) { foreach($output as $line) {
$data = explode(' ', trim($line)); $data = explode(' ', trim($line));
@ -10,7 +10,7 @@ if(exec('sgrep -o "%r\n" \'"tMLText(\"" __ "\""\' */*.php|sort|uniq -c', &$outpu
} }
/* Reading languages */ /* Reading languages */
foreach(array('English', 'German', 'Italian', 'Slovak', 'Czech') as $lang) { foreach(array('en_GB', 'de_DE', 'it_IT', 'sk_SK', 'cs_CZ') as $lang) {
include('languages/'.$lang.'/lang.inc'); include('languages/'.$lang.'/lang.inc');
ksort($text); ksort($text);
$langarr[$lang] = $text; $langarr[$lang] = $text;
@ -20,7 +20,7 @@ foreach(array('English', 'German', 'Italian', 'Slovak', 'Czech') as $lang) {
echo "List of missing keys\n"; echo "List of missing keys\n";
echo "-----------------------------\n"; echo "-----------------------------\n";
foreach(array_keys($allkeys) as $key) { foreach(array_keys($allkeys) as $key) {
foreach(array('English', 'German', 'Italian', 'Slovak', 'Czech') as $lang) { foreach(array('en_GB', 'de_DE', 'it_IT', 'sk_SK', 'cs_CZ') as $lang) {
if(!isset($langarr[$lang][$key])) { if(!isset($langarr[$lang][$key])) {
echo "Missing key '".$key."' in language ".$lang."\n"; echo "Missing key '".$key."' in language ".$lang."\n";
} }
@ -31,7 +31,7 @@ echo "\n";
/* Check for phrases not used anymore */ /* Check for phrases not used anymore */
echo "List of superflous keys\n"; echo "List of superflous keys\n";
echo "-----------------------------\n"; echo "-----------------------------\n";
foreach(array('English', 'German', 'Italian', 'Slovak', 'Czech') as $lang) { foreach(array('en_GB', 'de_DE', 'it_IT', 'sk_SK', 'cs_CZ') as $lang) {
$n = 0; $n = 0;
foreach($langarr[$lang] as $key=>$value) { foreach($langarr[$lang] as $key=>$value) {
if(!isset($allkeys[$key])) { if(!isset($allkeys[$key])) {
@ -45,8 +45,8 @@ foreach(array('English', 'German', 'Italian', 'Slovak', 'Czech') as $lang) {
exit; exit;
$fpout = fopen('php://stdout', 'w'); $fpout = fopen('php://stdout', 'w');
foreach(array_keys($langarr['English']) as $key) { foreach(array_keys($langarr['en_GB']) as $key) {
$data = array($key, $langarr['English'][$key], $langarr['German'][$key]); $data = array($key, $langarr['en_GB'][$key], $langarr['de_DE'][$key]);
fputcsv($fpout, $data); fputcsv($fpout, $data);
} }
?> ?>