Skip to content

Commit b3cf2ef

Browse files
Merge pull request hestiacp#740 from Flatta/improve-translation
Improve translation
2 parents 8a4b446 + aa470de commit b3cf2ef

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+4131
-1742
lines changed

web/add/web/index.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060
$aliases = implode(",",$aliases_arr);
6161
$aliases = escapeshellarg($aliases);
6262

63-
// Define proxy extentions
63+
// Define proxy extensions
6464
$v_proxy_ext = $_POST['v_proxy_ext'];
6565
$proxy_ext = preg_replace("/\n/", ",", $v_proxy_ext);
6666
$proxy_ext = preg_replace("/\r/", ",", $proxy_ext);
@@ -272,7 +272,7 @@
272272
$fp = fopen($v_ftp_password, "w");
273273
fwrite($fp, $v_ftp_user_data['v_ftp_password']."\n");
274274
fclose($fp);
275-
exec (VESTA_CMD."v-add-web-domain-ftp ".$user." ".$v_domain." ".$v_ftp_user." ".$v_ftp_password . " " . $v_ftp_path, $output, $return_var);
275+
exec (VESTA_CMD."v-add-web-domain-ftp ".$user." ".$v_domain." ".$v_ftp_user." ".$v_ftp_password . " " . $v_ftp_path, $output, $return_var);
276276
check_return_code($return_var,$output);
277277
unset($output);
278278
unlink($v_ftp_password);

web/edit/web/index.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@
222222
$restart_proxy = 'yes';
223223
}
224224

225-
// Change proxy template / Update extention list
225+
// Change proxy template / Update extension list
226226
if ((!empty($_SESSION['PROXY_SYSTEM'])) && (!empty($v_proxy)) && (!empty($_POST['v_proxy'])) && (empty($_SESSION['error_msg']))) {
227227
$ext = preg_replace("/\n/", " ", $_POST['v_proxy_ext']);
228228
$ext = preg_replace("/,/", " ", $ext);

web/inc/i18n.php

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,25 +10,30 @@ function _translate() {
1010
global $LANG;
1111

1212
$args = func_get_args();
13+
1314
$l = $args[0];
15+
if (empty($l)) return 'NO LANGUAGE DEFINED';
1416

15-
if (!$l) return 'NO LANGUAGE DEFINED';
1617
$key = $args[1];
18+
if (empty($key)) return '';
1719

18-
if (!isset($LANG[$l])) {
19-
require_once($_SERVER['DOCUMENT_ROOT'].'/inc/i18n/'.$l.'.php');
20+
// No translation needed
21+
if (!preg_match('/[a-z]/i', $key)) {
22+
return $key;
2023
}
2124

22-
if (!isset($LANG[$l][$key])) {
23-
$text=$key;
24-
} else {
25-
$text=$LANG[$l][$key];
25+
// Load language file (if not loaded yet)
26+
if (!isset($LANG[$l])) {
27+
require_once($_SERVER['DOCUMENT_ROOT']."/inc/i18n/$l.php");
2628
}
2729

30+
//if (!isset($LANG[$l][$key])) file_put_contents('/somewhere/something.log', "$key\n", FILE_APPEND);
31+
$text = isset($LANG[$l][$key]) ? $LANG[$l][$key] : $key;
32+
2833
array_shift($args);
29-
if (count($args)>1) {
34+
if (count($args) > 1) {
3035
$args[0] = $text;
31-
return call_user_func_array("sprintf",$args);
36+
return call_user_func_array('sprintf', $args);
3237
} else {
3338
return $text;
3439
}
@@ -42,8 +47,8 @@ function _translate() {
4247
*/
4348
function __() {
4449
$args = func_get_args();
45-
array_unshift($args,$_SESSION['language']);
46-
return call_user_func_array("_translate",$args);
50+
array_unshift($args, $_SESSION['language']);
51+
return call_user_func_array('_translate', $args);
4752
}
4853

4954
/**

web/inc/i18n/ar.php

Lines changed: 134 additions & 31 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)