Browse Source

Use `strftime` instead of `date` in `format_date`.

pull/401/head
Stefan Björk 5 years ago
parent
commit
2318ecfa48
1 changed files with 16 additions and 12 deletions
  1. +16
    -12
      system/includes/functions.php

+ 16
- 12
system/includes/functions.php View File

@ -3207,22 +3207,26 @@ function get_language()
$langID = config('language'); $langID = config('language');
$langFile = 'lang/'. $langID . '.ini'; $langFile = 'lang/'. $langID . '.ini';
$local = $langID;
// Settings for the language // Settings for the language
if (!isset($langID) || config('language') === 'en') {
if (!isset($langID) || config('language') === 'en' || !file_exists($langFile)) {
i18n('source', 'lang/en.ini'); // Load the English language file i18n('source', 'lang/en.ini'); // Load the English language file
setlocale(LC_ALL, 'en_US'); // Change time format to English
setlocale(LC_ALL, 'en_US', 'en_US.utf8', 'English'); // Change locale to English
} else { } else {
if (file_exists($langFile)) {
i18n('source', $langFile);
setlocale(LC_ALL, $local);
} else {
i18n('source', 'lang/en.ini'); // Load the English language file
setlocale(LC_ALL, 'en_US'); // Change time format to English
i18n('source', $langFile);
// Locales are known under different names on different systems; I don't know any other way
// to handle this than to add a list of locale names for each language.
if ($langID === 'de') {
setlocale(LC_ALL, 'de_DE', 'de_DE.utf8', 'German');
}
elseif ($langID === 'sv') {
setlocale(LC_ALL, 'sv_SE', 'sv_SE.utf8', 'Swedish');
}
elseif ($langID === 'pl') {
setlocale(LC_ALL, 'pl_PL', 'pl_PL.utf8', 'Polish');
} }
} }
} }
function format_date($date) function format_date($date)
@ -3231,9 +3235,9 @@ function format_date($date)
$date_format = config('date.format'); $date_format = config('date.format');
if (!isset($date_format) || empty($date_format)) { if (!isset($date_format) || empty($date_format)) {
return date('d F Y', $date);
return strftime('%e %B %Y', $date);
} else { } else {
return date($date_format, $date);
return strftime($date_format, $date);
} }
} }

Loading…
Cancel
Save