issue #39: changing language files to represent their respective
locales, change date format to use strftime(%x %X), making %e usage windows compatible, and fixing yesterday_format and other_format, updating language filename in READMEpull/38/merge
parent
3e68040fb5
commit
f6926334ce
|
@ -12,7 +12,7 @@
|
|||
- Added user profile page.
|
||||
- Added history tracking of server uptime.
|
||||
- Added history graphs of server uptime and latency (thanks to Jérôme Cabanis).
|
||||
- Date format is taken from language file and localized per language (thanks to Jérôme Cabanis).
|
||||
- Date and time formats are taken from language file and localized per language (thanks to Jérôme Cabanis).
|
||||
- When checking a website, the updater will now follow 302 Location headers.
|
||||
- String/pattern search on websites did not work for websites with compression turned on.
|
||||
- Switched from mysql_* to PDO.
|
||||
|
|
|
@ -134,7 +134,7 @@ If you would like to contribute a patch or feature, please fork the develop bran
|
|||
### Changing the email or text message
|
||||
|
||||
Go to the folder "src/lang", open the language file that corresponds to the selected language
|
||||
(default is English ("en.lang.php")). Scroll all the way to the bottom until you spot this line:
|
||||
(default is English ("en_US.lang.php")). Scroll all the way to the bottom until you spot this line:
|
||||
|
||||
'notifications' => array(
|
||||
|
||||
|
|
|
@ -93,5 +93,5 @@ if($db->status() && (!defined('PSM_INSTALL') || !PSM_INSTALL)) {
|
|||
die();
|
||||
}
|
||||
}
|
||||
$lang = psm_get_conf('language', 'en');
|
||||
$lang = psm_get_conf('language', 'en_US');
|
||||
psm_load_lang($lang);
|
||||
|
|
|
@ -63,8 +63,8 @@ function psm_load_lang($lang) {
|
|||
$lang_file = PSM_PATH_LANG . $lang . '.lang.php';
|
||||
|
||||
if(!file_exists($lang_file)) {
|
||||
// If the file have been removed, we use the english one
|
||||
$en_file = PSM_PATH_LANG . 'en.lang.php';
|
||||
// If the file has been removed, we use the english one
|
||||
$en_file = PSM_PATH_LANG . 'en_US.lang.php';
|
||||
if(!file_exists($en_file)) {
|
||||
// OK, nothing we can do
|
||||
die('unable to load language file: ' . $lang_file);
|
||||
|
@ -73,10 +73,8 @@ function psm_load_lang($lang) {
|
|||
}
|
||||
|
||||
require $lang_file;
|
||||
if(isset($sm_lang['locale']))
|
||||
{
|
||||
setlocale(LC_TIME, $sm_lang['locale']);
|
||||
}
|
||||
$locale = basename($lang_file, '.lang.php');
|
||||
setlocale(LC_TIME, $locale);
|
||||
|
||||
$GLOBALS['sm_lang'] = $sm_lang;
|
||||
}
|
||||
|
@ -98,17 +96,15 @@ function psm_get_langs() {
|
|||
if(file_exists($file)) {
|
||||
require $file;
|
||||
}
|
||||
if(isset($sm_lang['name']))
|
||||
{
|
||||
if(isset($sm_lang['name'])) {
|
||||
$name = $sm_lang['name'];
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
$name = $key;
|
||||
}
|
||||
$langs[$key] = $name;
|
||||
unset($sm_lang);
|
||||
}
|
||||
ksort($langs);
|
||||
return $langs;
|
||||
}
|
||||
|
||||
|
@ -274,14 +270,19 @@ function psm_curl_get($href, $header = false, $body = true, $timeout = 10, $add_
|
|||
* Source: http://www.interactivetools.com/forum/forum-posts.php?postNum=2208966
|
||||
* @param string $time
|
||||
* @return string
|
||||
* @todo add translation to timespan messages
|
||||
*/
|
||||
function psm_timespan($time) {
|
||||
if(empty($time) || $time == '0000-00-00 00:00:00')
|
||||
return psm_get_lang(system, 'never');
|
||||
if(empty($time) || $time == '0000-00-00 00:00:00') {
|
||||
return psm_get_lang('system', 'never');
|
||||
}
|
||||
if ($time !== intval($time)) { $time = strtotime($time); }
|
||||
if ($time < strtotime(date('Y-m-d 00:00:00')) - 60*60*24*3) {
|
||||
$format = psm_get_lang('system', (date('Y') !== date('Y', $time)) ? 'long_day_format' : 'short_day_format');
|
||||
// Check for Windows to find and replace the %e
|
||||
// modifier correctly
|
||||
if (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN') {
|
||||
$format = preg_replace('#(?<!%)((?:%%)*)%e#', '\1%#d', $format);
|
||||
}
|
||||
return strftime($format, $time);
|
||||
}
|
||||
$d = time() - $time;
|
||||
|
@ -302,13 +303,12 @@ function psm_timespan($time) {
|
|||
* Get a localised date from MySQL date format
|
||||
* @param string $time
|
||||
* @return string
|
||||
* @todo add translation
|
||||
*/
|
||||
function psm_date($time)
|
||||
{
|
||||
if(empty($time) || $time == '0000-00-00 00:00:00')
|
||||
return psm_get_lang(system, 'never');
|
||||
return date(psm_get_lang('system', 'date_time_format'), strtotime($time));
|
||||
function psm_date($time) {
|
||||
if(empty($time) || $time == '0000-00-00 00:00:00') {
|
||||
return psm_get_lang('system', 'never');
|
||||
}
|
||||
return strftime('%x %X', strtotime($time));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -26,8 +26,7 @@
|
|||
**/
|
||||
|
||||
$sm_lang = array(
|
||||
'name' => 'Български',
|
||||
'locale' => 'bg_BG', // Language code (ISO 639-1) + Contry code (ISO_3166-1)
|
||||
'name' => 'Български - Bulgarian',
|
||||
'system' => array(
|
||||
'title' => 'Server Monitor',
|
||||
'install' => 'Инсталация',
|
||||
|
@ -46,13 +45,11 @@ $sm_lang = array(
|
|||
'update_available' => 'Налична е нова версия. Може да я свалите от <a href="http://www.phpservermonitor.org" target="_blank">тук</a>.',
|
||||
'back_to_top' => 'Нагоре',
|
||||
'go_back' => 'Go back',
|
||||
|
||||
'date_time_format' => 'd.m.Y H:i:s', // date/time format according the date php function format parameter http://php.net/manual/function.date.php
|
||||
|
||||
'short_day_format' => '%B %e', // date/time format according the strftime php function format parameter http://php.net/manual/function.strftime.php
|
||||
// date/time format according the strftime php function format parameter http://php.net/manual/function.strftime.php
|
||||
'short_day_format' => '%B %e',
|
||||
'long_day_format' => '%B %e, %Y',
|
||||
'yesterday_format' => 'Yesterday at %l:%Ma',
|
||||
'other_day_format' => '%A at g:ia',
|
||||
'yesterday_format' => 'Yesterday at %k:%M',
|
||||
'other_day_format' => '%A at %k:%M',
|
||||
'never' => 'Never',
|
||||
'hours_ago' => '%d hours ago',
|
||||
'an_hour_ago' => 'about an hour ago',
|
|
@ -26,8 +26,7 @@
|
|||
**/
|
||||
|
||||
$sm_lang = array(
|
||||
'name' => 'Dutch',
|
||||
'locale' => 'de_DE', // Language code (ISO 639-1) + Contry code (ISO_3166-1)
|
||||
'name' => 'Deutsch - German',
|
||||
'system' => array(
|
||||
'title' => 'Server Monitor',
|
||||
'install' => 'Install',
|
||||
|
@ -46,13 +45,11 @@ $sm_lang = array(
|
|||
'update_available' => 'Ein neues Update ist verfügbar auf <a href="http://www.phpservermonitor.org" target="_blank">http://www.phpservermonitor.org</a>.',
|
||||
'back_to_top' => 'Back to top',
|
||||
'go_back' => 'Go back',
|
||||
|
||||
'date_time_format' => 'd.m.Y H:i:s', // date/time format according the date php function format parameter http://php.net/manual/function.date.php
|
||||
|
||||
'short_day_format' => '%B %e', // date/time format according the strftime php function format parameter http://php.net/manual/function.strftime.php
|
||||
// date/time format according the strftime php function format parameter http://php.net/manual/function.strftime.php
|
||||
'short_day_format' => '%B %e',
|
||||
'long_day_format' => '%B %e, %Y',
|
||||
'yesterday_format' => 'Yesterday at %l:%Ma',
|
||||
'other_day_format' => '%A at g:ia',
|
||||
'yesterday_format' => 'Gestern um %k:%M',
|
||||
'other_day_format' => '%A um %k:%M',
|
||||
'never' => 'Never',
|
||||
'hours_ago' => '%d hours ago',
|
||||
'an_hour_ago' => 'about an hour ago',
|
|
@ -27,7 +27,6 @@
|
|||
|
||||
$sm_lang = array(
|
||||
'name' => 'English',
|
||||
'locale' => 'en_US', // Language code (ISO 639-1) + Contry code (ISO_3166-1)
|
||||
'system' => array(
|
||||
'title' => 'Server Monitor',
|
||||
'install' => 'Install',
|
||||
|
@ -46,13 +45,11 @@ $sm_lang = array(
|
|||
'update_available' => 'A new update is available from <a href="http://www.phpservermonitor.org" target="_blank">http://www.phpservermonitor.org</a>.',
|
||||
'back_to_top' => 'Back to top',
|
||||
'go_back' => 'Go back',
|
||||
|
||||
'date_time_format' => 'Y-m-d g:i:sa', // date/time format according the date php function format parameter http://php.net/manual/function.date.php
|
||||
|
||||
'short_day_format' => '%B %e', // date/time format according the strftime php function format parameter http://php.net/manual/function.strftime.php
|
||||
// date/time format according the strftime php function format parameter http://php.net/manual/function.strftime.php
|
||||
'short_day_format' => '%B %e',
|
||||
'long_day_format' => '%B %e, %Y',
|
||||
'yesterday_format' => 'Yesterday at %l:%Ma',
|
||||
'other_day_format' => '%A at g:ia',
|
||||
'yesterday_format' => 'Yesterday at %k:%M',
|
||||
'other_day_format' => '%A at %k:%M',
|
||||
'never' => 'Never',
|
||||
'hours_ago' => '%d hours ago',
|
||||
'an_hour_ago' => 'about an hour ago',
|
|
@ -26,8 +26,7 @@
|
|||
**/
|
||||
|
||||
$sm_lang = array(
|
||||
'name' => 'Français',
|
||||
'locale' => 'fr_FR', // Language code (ISO 639-1) + Contry code (ISO_3166-1)
|
||||
'name' => 'Français - French',
|
||||
'system' => array(
|
||||
'title' => 'Server Monitor',
|
||||
'install' => 'Installer',
|
||||
|
@ -46,10 +45,8 @@ $sm_lang = array(
|
|||
'update_available' => 'Une nouvelle version est disponible à l\'adresse <a href="http://www.phpservermonitor.org" target="_blank">http://www.phpservermonitor.org</a>.',
|
||||
'back_to_top' => 'Haut de page',
|
||||
'go_back' => 'Retour',
|
||||
|
||||
'date_time_format' => 'd/m/Y H:i:s', // date/time format according the date php function format parameter http://php.net/manual/function.date.php
|
||||
|
||||
'short_day_format' => 'Le %e %B', // date/time format according the strftime php function format parameter http://php.net/manual/function.strftime.php
|
||||
// date/time format according the strftime php function format parameter http://php.net/manual/function.strftime.php
|
||||
'short_day_format' => 'Le %e %B',
|
||||
'long_day_format' => 'Le %e %B %Y',
|
||||
'yesterday_format' => 'Hier à %kh%M',
|
||||
'other_day_format' => '%A à %kh%M',
|
|
@ -26,8 +26,7 @@
|
|||
**/
|
||||
|
||||
$sm_lang = array(
|
||||
'name' => '한국',
|
||||
'locale' => 'ko_KR', // Language code (ISO 639-1) + Contry code (ISO_3166-1)
|
||||
'name' => '한국 - Korean',
|
||||
'system' => array(
|
||||
'title' => 'Server Monitor',
|
||||
'install' => 'Install',
|
||||
|
@ -46,13 +45,11 @@ $sm_lang = array(
|
|||
'update_available' => '새로운 업데이트가 있습니다. 다음사이트를 방문 해 주십시오. <a href="http://www.phpservermonitor.org" target="_blank">http://www.phpservermonitor.org</a>.',
|
||||
'back_to_top' => 'Back to top',
|
||||
'go_back' => 'Go back',
|
||||
|
||||
'date_time_format' => 'Y-m-d H:i:s', // date/time format according the date php function format parameter http://php.net/manual/function.date.php
|
||||
|
||||
'short_day_format' => '%B %e', // date/time format according the strftime php function format parameter http://php.net/manual/function.strftime.php
|
||||
// date/time format according the strftime php function format parameter http://php.net/manual/function.strftime.php
|
||||
'short_day_format' => '%B %e',
|
||||
'long_day_format' => '%B %e, %Y',
|
||||
'yesterday_format' => 'Yesterday at %l:%Ma',
|
||||
'other_day_format' => '%A at g:ia',
|
||||
'yesterday_format' => 'Yesterday at %X',
|
||||
'other_day_format' => '%A at %X',
|
||||
'never' => 'Never',
|
||||
'hours_ago' => '%d hours ago',
|
||||
'an_hour_ago' => 'about an hour ago',
|
|
@ -26,8 +26,7 @@
|
|||
**/
|
||||
|
||||
$sm_lang = array(
|
||||
'name' => 'Nederlands',
|
||||
'locale' => 'nl_NL', // Language code (ISO 639-1) + Contry code (ISO_3166-1)
|
||||
'name' => 'Nederlands - Dutch',
|
||||
'system' => array(
|
||||
'title' => 'Server Monitor',
|
||||
'install' => 'Install',
|
||||
|
@ -46,25 +45,23 @@ $sm_lang = array(
|
|||
'update_available' => 'Een nieuwe update is beschikbaar op <a href="http://www.phpservermonitor.org" target="_blank">http://www.phpservermonitor.org</a>.',
|
||||
'back_to_top' => 'Terug naar boven',
|
||||
'go_back' => 'Terug',
|
||||
|
||||
'date_time_format' => 'd-m-Y H:i:s', // date/time format according the date php function format parameter http://php.net/manual/function.date.php
|
||||
|
||||
'short_day_format' => '%B %e', // date/time format according the strftime php function format parameter http://php.net/manual/function.strftime.php
|
||||
// date/time format according the strftime php function format parameter http://php.net/manual/function.strftime.php
|
||||
'short_day_format' => '%B %e',
|
||||
'long_day_format' => '%B %e, %Y',
|
||||
'yesterday_format' => 'Yesterday at %l:%Ma',
|
||||
'other_day_format' => '%A at g:ia',
|
||||
'never' => 'Never',
|
||||
'hours_ago' => '%d hours ago',
|
||||
'an_hour_ago' => 'about an hour ago',
|
||||
'minutes_ago' => '%d minutes ago',
|
||||
'a_minute_ago' => 'about a minute ago',
|
||||
'seconds_ago' => '%d seconds ago',
|
||||
'a_second_ago' => 'a second ago',
|
||||
'yesterday_format' => 'Gisteren om %k:%M',
|
||||
'other_day_format' => '%A om %k:%M',
|
||||
'never' => 'Nooit',
|
||||
'hours_ago' => '%d uren geleden',
|
||||
'an_hour_ago' => 'een uur geleden',
|
||||
'minutes_ago' => '%d minuten geleden',
|
||||
'a_minute_ago' => 'een minuut geleden',
|
||||
'seconds_ago' => '%d seconden geleden',
|
||||
'a_second_ago' => 'een seconde geleden',
|
||||
),
|
||||
'menu' => array(
|
||||
'config' => 'Config',
|
||||
'server' => 'Servers',
|
||||
'server_history' => 'History',
|
||||
'server_history' => 'Geschiedenis',
|
||||
'server_log' => 'Log',
|
||||
'server_status' => 'Status',
|
||||
'server_update' => 'Update',
|
||||
|
@ -114,7 +111,7 @@ $sm_lang = array(
|
|||
'type_website' => 'Website',
|
||||
'type_service' => 'Service',
|
||||
'pattern' => 'Zoek voor tekst/regex',
|
||||
'pattern_description' => 'If this pattern is not found on the website, the server will be marked offline. Regular expressions are allowed.',
|
||||
'pattern_description' => 'Als dit patroon niet gevonden wordt op de website, zal de server als offline gemarkeerd worden. Regular expressions zijn toegestaan.',
|
||||
'last_check' => 'Laatst gecontroleerd',
|
||||
'last_online' => 'Laatst online',
|
||||
'monitoring' => 'Monitoring',
|
||||
|
@ -128,7 +125,7 @@ $sm_lang = array(
|
|||
'day' => 'Day',
|
||||
'hour' => 'Hour',
|
||||
'warning_threshold' => 'Warning threshold',
|
||||
'warning_threshold_description' => 'Number of failed checks required before it is marked offline.',
|
||||
'warning_threshold_description' => 'Aantal mislukte pogingen voordat de server als offline gemarkeerd wordt.',
|
||||
|
||||
// Charts date format according jqPlot date format http://www.jqplot.com/docs/files/plugins/jqplot-dateAxisRenderer-js.html
|
||||
'chart_long_date_format' => '%d-%m-%Y %H:%M:%S',
|
|
@ -26,8 +26,7 @@
|
|||
**/
|
||||
|
||||
$sm_lang = array(
|
||||
'name' => 'Portugês - Brasil',
|
||||
'locale' => 'pt_BR', // Language code (ISO 639-1) + Contry code (ISO_3166-1)
|
||||
'name' => 'Português - Brazilian portuguese',
|
||||
'system' => array(
|
||||
'title' => 'Server Monitor',
|
||||
'install' => 'Install',
|
||||
|
@ -46,13 +45,11 @@ $sm_lang = array(
|
|||
'update_available' => 'Uma atualização disponível em <a href="http://www.phpservermonitor.org" target="_blank">http://www.phpservermonitor.org</a>.',
|
||||
'back_to_top' => 'Voltar ao topo',
|
||||
'go_back' => 'Go back',
|
||||
|
||||
'date_time_format' => 'd/m/Y H:i:s', // date/time format according the date php function format parameter http://php.net/manual/function.date.php
|
||||
|
||||
'short_day_format' => '%B %e', // date/time format according the strftime php function format parameter http://php.net/manual/function.strftime.php
|
||||
// date/time format according the strftime php function format parameter http://php.net/manual/function.strftime.php
|
||||
'short_day_format' => '%B %e',
|
||||
'long_day_format' => '%B %e, %Y',
|
||||
'yesterday_format' => 'Yesterday at %l:%Ma',
|
||||
'other_day_format' => '%A at g:ia',
|
||||
'yesterday_format' => 'Yesterday at %k:%M',
|
||||
'other_day_format' => '%A at %k:%M',
|
||||
'never' => 'Never',
|
||||
'hours_ago' => '%d hours ago',
|
||||
'an_hour_ago' => 'about an hour ago',
|
|
@ -248,6 +248,15 @@ class Installer {
|
|||
*/
|
||||
protected function upgrade220() {
|
||||
$queries = array();
|
||||
// language is now stored as language code (ISO 639-1) + country code (ISO 3166-1)
|
||||
$queries[] = "UPDATE `" . PSM_DB_PREFIX . "config` SET `value`='bg_BG' WHERE `key`='language' AND `value`='bg';";
|
||||
$queries[] = "UPDATE `" . PSM_DB_PREFIX . "config` SET `value`='de_DE' WHERE `key`='language' AND `value`='de';";
|
||||
$queries[] = "UPDATE `" . PSM_DB_PREFIX . "config` SET `value`='en_US' WHERE `key`='language' AND `value`='en';";
|
||||
$queries[] = "UPDATE `" . PSM_DB_PREFIX . "config` SET `value`='fr_FR' WHERE `key`='language' AND `value`='fr';";
|
||||
$queries[] = "UPDATE `" . PSM_DB_PREFIX . "config` SET `value`='ko_KR' WHERE `key`='language' AND `value`='kr';";
|
||||
$queries[] = "UPDATE `" . PSM_DB_PREFIX . "config` SET `value`='nl_NL' WHERE `key`='language' AND `value`='nl';";
|
||||
$queries[] = "UPDATE `" . PSM_DB_PREFIX . "config` SET `value`='pt_BR' WHERE `key`='language' AND `value`='br';";
|
||||
|
||||
$queries[] = "ALTER TABLE `" . PSM_DB_PREFIX . "log` CHANGE `log_id` `log_id` INT( 11 ) UNSIGNED NOT NULL AUTO_INCREMENT;";
|
||||
$queries[] = "ALTER TABLE `" . PSM_DB_PREFIX . "log` CHANGE `server_id` `server_id` INT( 11 ) UNSIGNED NOT NULL;";
|
||||
|
||||
|
|
Loading…
Reference in New Issue