Skip to content

Commit a2873db

Browse files
committed
Merge branch 'refactor/i18n' into staging/features
2 parents 0c3ed21 + be9c7a9 commit a2873db

File tree

167 files changed

+13334
-2180
lines changed

Some content is hidden

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

167 files changed

+13334
-2180
lines changed

bin/v-change-sys-language

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ source $HESTIA/conf/hestia.conf
1919

2020

2121
is_language_valid() {
22-
if [ ! -e "$HESTIA/web/inc/i18n/$language.php" ]; then
22+
if [ ! -d "$HESTIA/web/locale/$language" ]; then
2323
echo "Error: language file $language doesn't exist"
2424
log_event "$E_NOTEXIST $ARGUMENTS"
2525
exit $E_NOTEXIST

bin/v-change-user-language

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ is_language_valid() {
2424
log_event "$E_INVALID" "$ARGUMENTS"
2525
exit $E_INVALID
2626
fi
27-
if [ ! -e "$HESTIA/web/inc/i18n/$1.php" ]; then
27+
if [ ! -d "$HESTIA/web/locale/$1" ]; then
2828
echo "Error: language $1 doesn't exist"
2929
log_event "$E_NOTEXIST" "$ARGUMENTS"
3030
exit $E_NOTEXIST

bin/v-list-sys-languages

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ csv_list() {
6262
#----------------------------------------------------------#
6363

6464
# Defining language list
65-
languages=$(ls $HESTIA/web/inc/i18n/ |cut -f 1 -d .)
65+
languages=$(ls -d $HESTIA/web/locale/*/ |awk -F'/' '{print $(NF-1)}')
6666

6767
# Listing data
6868
case $format in

src/hst_autocompile.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -339,6 +339,7 @@ if [ "$PHP_B" = true ] ; then
339339
--with-fpm-group=admin \
340340
--with-libdir=lib/x86_64-linux-gnu \
341341
--with-mysqli \
342+
--with-gettext \
342343
--with-curl \
343344
--with-zip \
344345
--with-gmp \

web/add/cron/index.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@
1616
}
1717

1818
// Check empty fields
19-
if ((!isset($_POST['v_min'])) || ($_POST['v_min'] == '')) $errors[] = __('minute');
20-
if ((!isset($_POST['v_hour'])) || ($_POST['v_hour'] == '')) $errors[] = __('hour');
21-
if ((!isset($_POST['v_day'])) || ($_POST['v_day'] == '')) $errors[] = __('day');
22-
if ((!isset($_POST['v_month'])) || ($_POST['v_month'] == '')) $errors[] = __('month');
23-
if ((!isset($_POST['v_wday'])) || ($_POST['v_wday'] == '')) $errors[] = __('day of week');
24-
if ((!isset($_POST['v_cmd'])) || ($_POST['v_cmd'] == '')) $errors[] = __('cmd');
19+
if ((!isset($_POST['v_min'])) || ($_POST['v_min'] == '')) $errors[] = _('minute');
20+
if ((!isset($_POST['v_hour'])) || ($_POST['v_hour'] == '')) $errors[] = _('hour');
21+
if ((!isset($_POST['v_day'])) || ($_POST['v_day'] == '')) $errors[] = _('day');
22+
if ((!isset($_POST['v_month'])) || ($_POST['v_month'] == '')) $errors[] = _('month');
23+
if ((!isset($_POST['v_wday'])) || ($_POST['v_wday'] == '')) $errors[] = _('day of week');
24+
if ((!isset($_POST['v_cmd'])) || ($_POST['v_cmd'] == '')) $errors[] = _('cmd');
2525
if (!empty($errors[0])) {
2626
foreach ($errors as $i => $error) {
2727
if ( $i == 0 ) {
@@ -30,7 +30,7 @@
3030
$error_msg = $error_msg.", ".$error;
3131
}
3232
}
33-
$_SESSION['error_msg'] = __('Field "%s" can not be blank.',$error_msg);
33+
$_SESSION['error_msg'] = _('Field "%s" can not be blank.',$error_msg);
3434
}
3535

3636
// Protect input
@@ -50,7 +50,7 @@
5050

5151
// Flush field values on success
5252
if (empty($_SESSION['error_msg'])) {
53-
$_SESSION['ok_msg'] = __('CRON_CREATED_OK');
53+
$_SESSION['ok_msg'] = _('CRON_CREATED_OK');
5454
unset($v_min);
5555
unset($v_hour);
5656
unset($v_day);

web/add/db/index.php

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@
1616
}
1717

1818
// Check empty fields
19-
if (empty($_POST['v_database'])) $errors[] = __('database');
20-
if (empty($_POST['v_dbuser'])) $errors[] = __('username');
21-
if (empty($_POST['v_password'])) $errors[] = __('password');
22-
if (empty($_POST['v_type'])) $errors[] = __('type');
23-
if (empty($_POST['v_host'])) $errors[] = __('host');
24-
if (empty($_POST['v_charset'])) $errors[] = __('charset');
19+
if (empty($_POST['v_database'])) $errors[] = _('database');
20+
if (empty($_POST['v_dbuser'])) $errors[] = _('username');
21+
if (empty($_POST['v_password'])) $errors[] = _('password');
22+
if (empty($_POST['v_type'])) $errors[] = _('type');
23+
if (empty($_POST['v_host'])) $errors[] = _('host');
24+
if (empty($_POST['v_charset'])) $errors[] = _('charset');
2525
if (!empty($errors[0])) {
2626
foreach ($errors as $i => $error) {
2727
if ( $i == 0 ) {
@@ -30,19 +30,19 @@
3030
$error_msg = $error_msg.", ".$error;
3131
}
3232
}
33-
$_SESSION['error_msg'] = __('Field "%s" can not be blank.',$error_msg);
33+
$_SESSION['error_msg'] = _('Field "%s" can not be blank.',$error_msg);
3434
}
3535

3636
// Validate email
3737
if ((!empty($_POST['v_db_email'])) && (empty($_SESSION['error_msg']))) {
3838
if (!filter_var($_POST['v_db_email'], FILTER_VALIDATE_EMAIL)) {
39-
$_SESSION['error_msg'] = __('Please enter valid email address.');
39+
$_SESSION['error_msg'] = _('Please enter valid email address.');
4040
}
41-
}
41+
}
4242

4343
// Check password length
4444
if (empty($_SESSION['error_msg'])) {
45-
if (!validate_password($_POST['v_password'])) { $_SESSION['error_msg'] = __('Password does not match the minimum requirements');}
45+
if (!validate_password($_POST['v_password'])) { $_SESSION['error_msg'] = _('Password does not match the minimum requirements');}
4646
}
4747

4848
// Protect input
@@ -87,17 +87,17 @@
8787
// Email login credentials
8888
if ((!empty($v_db_email)) && (empty($_SESSION['error_msg']))) {
8989
$to = $v_db_email;
90-
$subject = __("Database Credentials");
90+
$subject = _("Database Credentials");
9191
$hostname = exec('hostname');
92-
$from = __('MAIL_FROM',$hostname);
93-
$mailtext = __('DATABASE_READY',$user."_".$_POST['v_database'],$user."_".$_POST['v_dbuser'],$_POST['v_password'],$db_admin_link);
92+
$from = _('MAIL_FROM',$hostname);
93+
$mailtext = _('DATABASE_READY',$user."_".$_POST['v_database'],$user."_".$_POST['v_dbuser'],$_POST['v_password'],$db_admin_link);
9494
send_email($to, $subject, $mailtext, $from);
9595
}
9696

9797
// Flush field values on success
9898
if (empty($_SESSION['error_msg'])) {
99-
$_SESSION['ok_msg'] = __('DATABASE_CREATED_OK',htmlentities($user)."_".htmlentities($_POST['v_database']),htmlentities($user)."_".htmlentities($_POST['v_database']));
100-
$_SESSION['ok_msg'] .= " / <a href=".$db_admin_link." target='_blank'>" . __('open %s',$db_admin) . "</a>";
99+
$_SESSION['ok_msg'] = _('DATABASE_CREATED_OK',htmlentities($user)."_".htmlentities($_POST['v_database']),htmlentities($user)."_".htmlentities($_POST['v_database']));
100+
$_SESSION['ok_msg'] .= " / <a href=".$db_admin_link." target='_blank'>" . _('open %s',$db_admin) . "</a>";
101101
unset($v_database);
102102
unset($v_dbuser);
103103
unset($v_password);

web/add/dns/index.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@
2121
}
2222

2323
// Check empty fields
24-
if (empty($_POST['v_domain'])) $errors[] = __('domain');
25-
if (empty($_POST['v_ip'])) $errors[] = __('ip');
24+
if (empty($_POST['v_domain'])) $errors[] = _('domain');
25+
if (empty($_POST['v_ip'])) $errors[] = _('ip');
2626
if (!empty($errors[0])) {
2727
foreach ($errors as $i => $error) {
2828
if ( $i == 0 ) {
@@ -31,7 +31,7 @@
3131
$error_msg = $error_msg.", ".$error;
3232
}
3333
}
34-
$_SESSION['error_msg'] = __('Field "%s" can not be blank.',$error_msg);
34+
$_SESSION['error_msg'] = _('Field "%s" can not be blank.',$error_msg);
3535
}
3636

3737
// Protect input
@@ -85,7 +85,7 @@
8585

8686
// Flush field values on success
8787
if (empty($_SESSION['error_msg'])) {
88-
$_SESSION['ok_msg'] = __('DNS_DOMAIN_CREATED_OK',htmlentities($_POST['v_domain']),htmlentities($_POST['v_domain']));
88+
$_SESSION['ok_msg'] = _('DNS_DOMAIN_CREATED_OK',htmlentities($_POST['v_domain']),htmlentities($_POST['v_domain']));
8989
unset($v_domain);
9090
}
9191
}
@@ -113,7 +113,7 @@
113113
$error_msg = $error_msg.", ".$error;
114114
}
115115
}
116-
$_SESSION['error_msg'] = __('Field "%s" can not be blank.',$error_msg);
116+
$_SESSION['error_msg'] = _('Field "%s" can not be blank.',$error_msg);
117117
}
118118

119119
// Protect input
@@ -134,7 +134,7 @@
134134

135135
// Flush field values on success
136136
if (empty($_SESSION['error_msg'])) {
137-
$_SESSION['ok_msg'] = __('DNS_RECORD_CREATED_OK',htmlentities($_POST['v_rec']),htmlentities($_POST['v_domain']));
137+
$_SESSION['ok_msg'] = _('DNS_RECORD_CREATED_OK',htmlentities($_POST['v_rec']),htmlentities($_POST['v_domain']));
138138
unset($v_domain);
139139
unset($v_rec);
140140
unset($v_val);

web/add/firewall/banlist/index.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@
2222
}
2323

2424
// Check empty fields
25-
if (empty($_POST['v_chain'])) $errors[] = __('banlist');
26-
if (empty($_POST['v_ip'])) $errors[] = __('ip address');
25+
if (empty($_POST['v_chain'])) $errors[] = _('banlist');
26+
if (empty($_POST['v_ip'])) $errors[] = _('ip address');
2727
if (!empty($errors[0])) {
2828
foreach ($errors as $i => $error) {
2929
if ( $i == 0 ) {
@@ -32,7 +32,7 @@
3232
$error_msg = $error_msg.", ".$error;
3333
}
3434
}
35-
$_SESSION['error_msg'] = __('Field "%s" can not be blank.',$error_msg);
35+
$_SESSION['error_msg'] = _('Field "%s" can not be blank.',$error_msg);
3636
}
3737

3838
// Protect input
@@ -48,7 +48,7 @@
4848

4949
// Flush field values on success
5050
if (empty($_SESSION['error_msg'])) {
51-
$_SESSION['ok_msg'] = __('BANLIST_CREATED_OK');
51+
$_SESSION['ok_msg'] = _('BANLIST_CREATED_OK');
5252
unset($v_chain);
5353
unset($v_ip);
5454
}

web/add/firewall/index.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,10 @@
3939
}
4040

4141
// Check empty fields
42-
if (empty($_POST['v_action'])) $errors[] = __('action');
43-
if (empty($_POST['v_protocol'])) $errors[] = __('protocol');
44-
if (!isset($_POST['v_port'])) $errors[] = __('port');
45-
if (empty($_POST['v_ip'])) $errors[] = __('ip address');
42+
if (empty($_POST['v_action'])) $errors[] = _('action');
43+
if (empty($_POST['v_protocol'])) $errors[] = _('protocol');
44+
if (!isset($_POST['v_port'])) $errors[] = _('port');
45+
if (empty($_POST['v_ip'])) $errors[] = _('ip address');
4646
if (!empty($errors[0])) {
4747
foreach ($errors as $i => $error) {
4848
if ( $i == 0 ) {
@@ -51,7 +51,7 @@
5151
$error_msg = $error_msg.", ".$error;
5252
}
5353
}
54-
$_SESSION['error_msg'] = __('Field "%s" can not be blank.',$error_msg);
54+
$_SESSION['error_msg'] = _('Field "%s" can not be blank.',$error_msg);
5555
}
5656

5757
// Protect input
@@ -73,7 +73,7 @@
7373

7474
// Flush field values on success
7575
if (empty($_SESSION['error_msg'])) {
76-
$_SESSION['ok_msg'] = __('RULE_CREATED_OK');
76+
$_SESSION['ok_msg'] = _('RULE_CREATED_OK');
7777
unset($v_port);
7878
unset($v_ip);
7979
unset($v_comment);

web/add/firewall/ipset/index.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@
2222
}
2323

2424
// Check empty fields
25-
if (empty($_POST['v_ipname'])) $errors[] = __('Name');
26-
if (empty($_POST['v_datasource'])) $errors[] = __('Data Source');
27-
if (empty($_POST['v_ipver'])) $errors[] = __('Ip Version');
28-
if (empty($_POST['v_autoupdate'])) $errors[] = __('Autoupdate');
25+
if (empty($_POST['v_ipname'])) $errors[] = _('Name');
26+
if (empty($_POST['v_datasource'])) $errors[] = _('Data Source');
27+
if (empty($_POST['v_ipver'])) $errors[] = _('Ip Version');
28+
if (empty($_POST['v_autoupdate'])) $errors[] = _('Autoupdate');
2929

3030
if (!empty($errors[0])) {
3131
foreach ($errors as $i => $error) {
@@ -35,7 +35,7 @@
3535
$error_msg = $error_msg.", ".$error;
3636
}
3737
}
38-
$_SESSION['error_msg'] = __('Field "%s" can not be blank.',$error_msg);
38+
$_SESSION['error_msg'] = _('Field "%s" can not be blank.',$error_msg);
3939
}
4040

4141
$v_ipname = $_POST['v_ipname'];
@@ -52,7 +52,7 @@
5252

5353
// Flush field values on success
5454
if (empty($_SESSION['error_msg'])) {
55-
$_SESSION['ok_msg'] = __('IPSET_CREATED_OK');
55+
$_SESSION['ok_msg'] = _('IPSET_CREATED_OK');
5656
}
5757
}
5858

0 commit comments

Comments
 (0)