diff --git a/system/includes/functions.php b/system/includes/functions.php index 45f2e0f..9e8cfd6 100644 --- a/system/includes/functions.php +++ b/system/includes/functions.php @@ -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); } }