mirror of
https://github.com/myvesta/vesta
synced 2025-08-20 21:34:12 -07:00
Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
79cf515b93
2 changed files with 23 additions and 21 deletions
|
@ -1,6 +1,5 @@
|
|||
<?php
|
||||
// Functions for internationalization
|
||||
|
||||
/**
|
||||
* Translates string to given language in first parameter, key given in second parameter (dynamically loads required language). Works like spritf from second parameter
|
||||
* @global array $LANG Associative array of language pharses
|
||||
|
@ -8,23 +7,18 @@
|
|||
*/
|
||||
function _translate() {
|
||||
global $LANG;
|
||||
|
||||
$args = func_get_args();
|
||||
$l = $args[0];
|
||||
|
||||
if (!$l) return 'NO LANGUAGE DEFINED';
|
||||
$key = $args[1];
|
||||
|
||||
if (!isset($LANG[$l])) {
|
||||
require_once($_SERVER['DOCUMENT_ROOT'].'/inc/i18n/'.$l.'.php');
|
||||
}
|
||||
|
||||
if (!isset($LANG[$l][$key])) {
|
||||
$text=$key;
|
||||
} else {
|
||||
$text=$LANG[$l][$key];
|
||||
}
|
||||
|
||||
array_shift($args);
|
||||
if (count($args)>1) {
|
||||
$args[0] = $text;
|
||||
|
@ -33,7 +27,6 @@ function _translate() {
|
|||
return $text;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Translates string by a given key in first parameter to current session language. Works like sprintf
|
||||
* @global array $LANG Associative array of language pharses
|
||||
|
@ -45,7 +38,6 @@ function __() {
|
|||
array_unshift($args,$_SESSION['language']);
|
||||
return call_user_func_array("_translate",$args);
|
||||
}
|
||||
|
||||
/**
|
||||
* Detects user language from Accept-Language HTTP header.
|
||||
* @param string Fallback language (default: 'en')
|
||||
|
@ -53,10 +45,8 @@ function __() {
|
|||
*/
|
||||
function detect_user_language($fallback='en') {
|
||||
static $user_lang = '';
|
||||
|
||||
// Already detected
|
||||
if (!empty($user_lang)) return $user_lang;
|
||||
|
||||
// Check if Accept-Language header is available
|
||||
if (!isset($_SERVER) ||
|
||||
!isset($_SERVER['HTTP_ACCEPT_LANGUAGE']) ||
|
||||
|
@ -66,7 +56,6 @@ function detect_user_language($fallback='en') {
|
|||
$user_lang = $fallback;
|
||||
return $user_lang;
|
||||
}
|
||||
|
||||
// Sort Accept-Language by `q` value
|
||||
$accept_langs = explode(',', preg_replace('/\s/', '', strtolower($_SERVER['HTTP_ACCEPT_LANGUAGE'])));
|
||||
$accept_langs_sorted = [];
|
||||
|
@ -84,12 +73,10 @@ function detect_user_language($fallback='en') {
|
|||
}
|
||||
}
|
||||
arsort($accept_langs_sorted);
|
||||
|
||||
// List languages
|
||||
exec (VESTA_CMD."v-list-sys-languages json", $output, $return_var);
|
||||
$languages = json_decode(implode('', $output), true);
|
||||
unset($output);
|
||||
|
||||
// Find best matching language
|
||||
foreach ($accept_langs_sorted as $user_lang => $dummy) {
|
||||
$decision = '';
|
||||
|
@ -105,7 +92,6 @@ function detect_user_language($fallback='en') {
|
|||
return $user_lang;
|
||||
}
|
||||
}
|
||||
|
||||
// Store result for reusing
|
||||
$user_lang = $fallback;
|
||||
return $user_lang;
|
||||
|
|
|
@ -339,7 +339,7 @@ $LANG['tw'] = array(
|
|||
'first name' => '名字',
|
||||
'last name' => '姓氏',
|
||||
'account' => '帳號',
|
||||
'ssl certificate' => 'SSL 證書',
|
||||
'ssl certificate' => 'SSL 憑證',
|
||||
'ssl key' => 'SSL密鑰',
|
||||
'stats user password' => '統計使用者帳號密碼',
|
||||
'stats username' => '統計使用者名稱',
|
||||
|
@ -357,6 +357,22 @@ $LANG['tw'] = array(
|
|||
'Action' => '動作',
|
||||
'Protocol' => '協議',
|
||||
'Port' => '端口',
|
||||
'Proxy Server' => '代理伺服器',
|
||||
'Web Server' => '網頁伺服器',
|
||||
'DNS Server' => 'DNS伺服器',
|
||||
'MAIL Server' => '郵件伺服器',
|
||||
'Antivirus' => '防毒系統',
|
||||
'AntiSpam' => '防垃圾郵件',
|
||||
'Webmail URL' => '網路信箱網址',
|
||||
'MySQL Support' => 'MySQL支援',
|
||||
'phpMyAdmin URL' => 'phpMyAdmin網址',
|
||||
'Maximum Number Of Databases' => '資料庫最高可使用數量',
|
||||
'Current Number Of Databases' => '資料庫目前已使用數量',
|
||||
'PostgreSQL Support' => 'PostgreSQL支援',
|
||||
'Local backup' => '本機備份',
|
||||
'Compression level' => '壓縮程度',
|
||||
'Directory' => '路徑',
|
||||
'Remote backup' => '異地備份',
|
||||
'Comment' => '備註',
|
||||
'Banlist' => '黑名單',
|
||||
'ranges are acceptable' => '可使用範圍(例如:21-22)',
|
||||
|
@ -400,7 +416,7 @@ $LANG['tw'] = array(
|
|||
'CRON_CREATED_OK' => '任務排程 已加入成功!',
|
||||
'IP_CREATED_OK' => 'IP位置 <a href="/edit/ip/?ip=%s"><b>%s</b></a> 已加入成功!',
|
||||
'PACKAGE_CREATED_OK' => '方案 <a href="/edit/package/?package=%s"><b>%s</b></a> 已加入成功!',
|
||||
'SSL_GENERATED_OK' => 'SSL證書 已加入成功!',
|
||||
'SSL_GENERATED_OK' => 'SSL憑證 已加入成功!',
|
||||
'RULE_CREATED_OK' => 'Rule 已加入成功!',
|
||||
'Autoupdate has been successfully enabled' => '自動更新已成功啟動',
|
||||
'Autoupdate has been successfully disabled' => '自動更新已成功關閉',
|
||||
|
@ -587,7 +603,7 @@ $LANG['tw'] = array(
|
|||
'Add File to the Current Selection' => '增加檔案到已選取的列表',
|
||||
'Select All Files' => '選取所有檔案',
|
||||
'shortcuts are inspired by magnificent GNU <a href="https://www.midnight-commander.org/">Midnight Commander</a> file manager' =>
|
||||
'快捷鍵是的想法是由 magnificent GNU <a href="https://www.midnight-commander.org/">Midnight Commander</a> 檔案管理器 啟發的',
|
||||
"快捷鍵是的想法是由 magnificent GNU <a href='https://www.midnight-commander.org/'>Midnight Commander</a> 檔案管理器 啟發的<br> 繁體中文翻譯是由 <a href='https://host.clark-chen.com'>Clark's 虛擬主機服務</a> 總工程師 <a href='https://www.clark-chen.com/'>Clark Chen</a> 提供。",
|
||||
'Save' => '儲存',
|
||||
'Licence Key' => '授權金鑰',
|
||||
'Enter License Key' => '輸入授權金鑰',
|
||||
|
@ -596,7 +612,7 @@ $LANG['tw'] = array(
|
|||
'Disable and Cancel Licence' => '刪除並且取消授權',
|
||||
'Licence Activated' => '授權已啟用',
|
||||
'Licence Deactivated' => '授權已停用',
|
||||
'Restrict users so that they cannot use SSH and access only their home directory.' => '限制使用者只能在SSH中使用他們自己的資料夾',
|
||||
'Browse, copy, edit, view, and retrieve all of your web domain files using fully featured File Manager.' => '瀏覽、複製、編輯、取得你所有的網站資料使用全能的檔案管理器',
|
||||
'Restrict users so that they cannot use SSH and access only their home directory.' => '禁止使用者使用SSH,並且只能存取他們自己的資料夾',
|
||||
'Browse, copy, edit, view, and retrieve all of your web domain files using fully featured File Manager.' => '瀏覽、複製、編輯、存取你所有的網站資料使用全能的檔案管理器',
|
||||
'This is a commercial module, you would need to purchace license key to enable it.' => '這是一個付費模組,您需要購買授權金鑰才能啟動它。'
|
||||
);
|
Loading…
Add table
Add a link
Reference in a new issue