mirror of
https://github.com/danpros/htmly.git
synced 2026-04-20 12:36:23 +05:30
Use strftime instead of date in format_date.
This commit is contained in:
parent
aba9982263
commit
2318ecfa48
1 changed files with 16 additions and 12 deletions
|
|
@ -3207,22 +3207,26 @@ function get_language()
|
|||
|
||||
$langID = config('language');
|
||||
$langFile = 'lang/'. $langID . '.ini';
|
||||
$local = $langID;
|
||||
|
||||
// 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
|
||||
setlocale(LC_ALL, 'en_US'); // Change time format to English
|
||||
setlocale(LC_ALL, 'en_US', 'en_US.utf8', 'English'); // Change locale to English
|
||||
} 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)
|
||||
|
|
@ -3231,9 +3235,9 @@ function format_date($date)
|
|||
$date_format = config('date.format');
|
||||
|
||||
if (!isset($date_format) || empty($date_format)) {
|
||||
return date('d F Y', $date);
|
||||
return strftime('%e %B %Y', $date);
|
||||
} else {
|
||||
return date($date_format, $date);
|
||||
return strftime($date_format, $date);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue