From d0f6eafd1f93fd16731c637ad3d2bbc72949561a Mon Sep 17 00:00:00 2001
From: EV-soft ';
-
+ $arrTrans= []; $arrCode= [];
+ $content = file_get_contents('translation.json');
+ if($content !== FALSE) {
+ $lng = json_decode($content, TRUE);
+ foreach ($lng["language"] as $key => $value) {
+ $code = $value["code"];
+ $lang_list[$code] = $value["name"];
+ $arrTrans[$code] = $value["translation"];
+ $arrCode[]= $code;
+ }
+ }
+ echo ' ';
echo '
".'Projektscann: '."
";
echo "
".'Scanning for prefix: "lng(\'" '." in .php/.htm files in current folder,";
echo "
and create a complete list of language texts that you can translate";
echo '
';
+ if ($count>0) $buff[] = 'Total: '.$count.' found : "'.$search.'" in file '.$dir.''.$source.'
';
}
}
}
@@ -47,7 +68,7 @@
$arrStrings= array_unique($arrStrings, SORT_REGULAR);
// sort($arrStrings, SORT_NATURAL | SORT_FLAG_CASE);
sort($arrStrings);
- echo '
Sorted list without duplicates:';
+ echo '
Sorted list without duplicates for code: '.$compareCode;
echo '
{
@@ -55,16 +76,20 @@ echo '
"version": "2.4.6",
"language": [
{
- "name": "Fill: English name for the language",
- "code": "Fill: language ISO code",
+ "name": "Fill: English name for the language",
+ "code": "Fill: language ISO code",
"translation": {';
- foreach ($arrStrings as $string)
- {if (strlen($string[0])>3)
- echo '
'.str_repeat(" ",8).$string[0].':'.
- str_repeat(" ",$longest+3-strlen(utf8_decode(substr($string[0],0)))).
- '"Missing_native_translated_string",';
- };
-echo ' <- REMOVE THIS LAST COMMA !
+ foreach ($arrStrings as $string) {
+ if (strlen($string[0])>3) {
+ echo '
'.str_repeat(" ",8).$string[0].':'.
+ str_repeat(" ",$longest+3-strlen(utf8_decode(substr($string[0],0))));
+ if (array_key_exists(trim($string[0],'"'),$arrTrans[$compareCode])) {
+ echo '"'.$arrTrans[$compareCode][trim($string[0],'"')].'",';
+ $miss++;
+ }
+ else echo '"Missing_native_translated_string",';
+ }};
+echo ' <- REMOVE THIS LAST COMMA !
}
},
{... Insert all other languages here ...}
@@ -74,5 +99,6 @@ echo ' <- REMOVE THIS LAST COMMA !
echo '