make it work again with new language dirs

This commit is contained in:
Uwe Steinmann 2015-05-13 17:32:44 +02:00
parent 540b1ece0a
commit 359f030ddb
2 changed files with 8 additions and 7 deletions

View File

@ -1,3 +1,3 @@
#!/bin/sh
# This command retrieves the strings that need to be translated
sgrep -o "%r\n" '"getMLText(\"" __ "\""' */*.php|sort|uniq -c
sgrep -o "%r\n" '"getMLText(\"" __ "\""' */*.php views/bootstrap/*.php |sort|uniq -c

View File

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