Skip to content
This repository has been archived by the owner on Nov 25, 2020. It is now read-only.

Commit

Permalink
Use php INTL extension if present to translate monthes to correct lan…
Browse files Browse the repository at this point in the history
…guage. Declare locale to be used inside the core language files.
  • Loading branch information
cdujeu committed Sep 15, 2014
1 parent 73b0c1f commit 2579c36
Show file tree
Hide file tree
Showing 28 changed files with 41 additions and 19 deletions.
8 changes: 6 additions & 2 deletions core/src/core/classes/class.AJXP_Utils.php
Expand Up @@ -746,15 +746,19 @@ public static function relativeDate($time, $messages, $shortestForm = false)
}

}

$finalDate = date($messages["date_relative_date_format"], $time ? $time : time());
if(strpos($messages["date_relative_date_format"], "F") !== false && isSet($messages["date_intl_locale"]) && class_exists("IntlDateFormatter")){
$intl = IntlDateFormatter::create($messages["date_intl_locale"], IntlDateFormatter::FULL, IntlDateFormatter::FULL, null, null, "MMMM");
$localizedMonth = $intl->format($time ? $time : time());
$dateFuncMonth = date("F", $time ? $time : time());
$finalDate = str_replace($dateFuncMonth, $localizedMonth, $finalDate);
}
if(!$shortestForm || strpos($finalDate, $crtYear) !== false){
$finalDate = str_replace($crtYear, '', $finalDate);
return str_replace("DATE", $finalDate, $messages["date_relative_date"]);
}else{
return $finalDate = date("M Y", $time ? $time : time());
}
//return str_replace("DATE", $finalDate, $messages["date_relative_date"]);

}

Expand Down
1 change: 1 addition & 0 deletions core/src/plugins/core.ajaxplorer/i18n/ca.php
Expand Up @@ -24,6 +24,7 @@
"languageLabel" => "Catalan",
"date_format" => "Y/m/d H:i",
"byte_unit_symbol" => "b",
"date_intl_locale" => "ca-ES",
"0" => "Darrera veure.",
"1" => "Nom",
"2" => "Tamany",
Expand Down
1 change: 1 addition & 0 deletions core/src/plugins/core.ajaxplorer/i18n/cs.php
Expand Up @@ -22,6 +22,7 @@
"languageLabel" => "Čeština",
"date_format" => "d/m/Y H:i",
"byte_unit_symbol" => "b",
"date_intl_locale" => "cs-CZ",
"0" => "Poslední verze",
"1" => "Název souboru",
"2" => "Velikost",
Expand Down
1 change: 1 addition & 0 deletions core/src/plugins/core.ajaxplorer/i18n/da.php
Expand Up @@ -27,6 +27,7 @@
"languageLabel" => "Danish",
"date_format" => "Y/m/d H:i",
"byte_unit_symbol" => "b",
"date_intl_locale" => "da-DK",
"0" => "Aktuel Version",
"1" => "Filnavn",
"2" => "Størrelse",
Expand Down
26 changes: 9 additions & 17 deletions core/src/plugins/core.ajaxplorer/i18n/de.php
Expand Up @@ -26,15 +26,16 @@
$mess=array(
"languageLabel" => "Deutsch",
"date_format" => "Y/m/d H:i",
"date_relative_date" => "on DATE",
"date_intl_locale" => "de_DE",
"date_relative_date" => "am DATE",
"date_relative_time" => "TIME",
"date_relative_date_format" => "d. F Y",
"date_relative_date_format" => "d F Y",
"date_relative_time_format" => "H:i",
"date_relative_today" => "today at TIME",
"date_relative_yesterday" => "yesterday at TIME",
"date_relative_tomorrow" => "tomorrow at TIME",
"date_relative_days_ago" => "%s days ago",
"date_relative_days_ahead" => "in %s days",
"date_relative_today" => "Heute um TIME",
"date_relative_yesterday" => "Gestern um TIME",
"date_relative_tomorrow" => "Morgen at TIME",
"date_relative_days_ago" => "%s Tagen",
"date_relative_days_ahead" => "in %s Tagen",
"byte_unit_symbol" => "b",
"0" => "Aktuelle Version",
"1" => "Dateiname",
Expand Down Expand Up @@ -519,17 +520,8 @@
"460" => "Details",
"461" => "Zur Detailansicht wechseln",
"detail_access_key" => "D",
"date_relative_date" => "am DATE",
"date_relative_time" => "TIME",
"date_relative_date_format" => "Y/m/d",
"date_relative_time_format" => "H:i",
"date_relative_today" => "Heute um TIME",
"date_relative_yesterday" => "Gestern um TIME",
"date_relative_tomorrow" => "tomorrow at TIME",
"date_relative_days_ago" => "%s Tagen",
"date_relative_days_ahead" => "in %s Tagen",
"462" => "Vorschau",
"preview_access_key" => "e",
"preview_access_key" => "r",
"463" => "Alle herunterladen",
"464" => "Alle Repositories Inhalte auf einmal herunterladen (gezippt)",
"465" => "Zeigen alternative URLs (momentane Repositories)",
Expand Down
1 change: 1 addition & 0 deletions core/src/plugins/core.ajaxplorer/i18n/en.php
Expand Up @@ -20,6 +20,7 @@
*/
$mess=array(
"languageLabel" => "English",
"date_intl_locale" => "en_US",
"date_format" => "Y/m/d H:i",
"date_relative_date" => "on DATE",
"date_relative_time" => "TIME",
Expand Down
1 change: 1 addition & 0 deletions core/src/plugins/core.ajaxplorer/i18n/es.php
Expand Up @@ -28,6 +28,7 @@
"languageLabel" => "Español",
"date_format" => "d/m/Y H:i",
"byte_unit_symbol" => "b",
"date_intl_locale" => "es-ES",
"0" => "Última ver.",
"1" => "Nombre",
"2" => "Tamaño",
Expand Down
1 change: 1 addition & 0 deletions core/src/plugins/core.ajaxplorer/i18n/et.php
Expand Up @@ -23,6 +23,7 @@
// Last update: 27.05.2013
$mess=array(
"languageLabel" => "Estonian",
"date_intl_locale" => "et-EE",
"date_format" => "d/m/Y H:i",
"date_relative_date" => "DATE",
"date_relative_time" => "TIME",
Expand Down
1 change: 1 addition & 0 deletions core/src/plugins/core.ajaxplorer/i18n/eus.php
Expand Up @@ -23,6 +23,7 @@
"languageLabel" => "Euskaraz",
"date_format" => "Y/m/d H:i",
"byte_unit_symbol" => "b",
"date_intl_locale" => "eu-ES",
"0" => "Azken bertsioa",
"1" => "Izena",
"2" => "Tamaina",
Expand Down
1 change: 1 addition & 0 deletions core/src/plugins/core.ajaxplorer/i18n/fi.php
Expand Up @@ -25,6 +25,7 @@
"languageLabel" => "Finnish",
"date_format" => "d/m/Y H:i",
"byte_unit_symbol" => "b",
"date_intl_locale" => "fi-FI",
"0" => "Viimeisin versio",
"1" => "Nimi",
"2" => "Koko",
Expand Down
1 change: 1 addition & 0 deletions core/src/plugins/core.ajaxplorer/i18n/fr.php
Expand Up @@ -21,6 +21,7 @@
// French Translation by Charles du Jeu, corrected by GravuTrad
$mess=array(
"languageLabel" => "Français",
"date_intl_locale" => "fr-FR",
"date_format" => "d/m/Y H:i",
"date_relative_date" => "le DATE",
"date_relative_time" => "TIME",
Expand Down
1 change: 1 addition & 0 deletions core/src/plugins/core.ajaxplorer/i18n/gr.php
Expand Up @@ -22,6 +22,7 @@
"languageLabel" => "Ελληνικά",
"date_format" => "d/m/Y H:i",
"byte_unit_symbol" => "b",
"date_intl_locale" => "el_GR",
"0" => "Τελευταία Έκδοση",
"1" => "Όνομα αρχείου",
"2" => "Μέγεθος",
Expand Down
1 change: 1 addition & 0 deletions core/src/plugins/core.ajaxplorer/i18n/he.php
Expand Up @@ -22,6 +22,7 @@
"languageLabel" => "עברית",
"date_format" => "Y/m/d H:i",
"byte_unit_symbol" => "b",
"date_intl_locale" => "he-IL",
"0" => "גרסה אחרונה",
"1" => "שם קובץ",
"2" => "גודל",
Expand Down
1 change: 1 addition & 0 deletions core/src/plugins/core.ajaxplorer/i18n/hu.php
Expand Up @@ -26,6 +26,7 @@
"languageLabel" => "Hungarian",
"date_format" => "Y/m/d H:i",
"byte_unit_symbol" => "b",
"date_intl_locale" => "hu-HU",
"0" => "Utolsó változat",
"1" => "Fájlnév",
"2" => "Fájlméret",
Expand Down
1 change: 1 addition & 0 deletions core/src/plugins/core.ajaxplorer/i18n/it.php
Expand Up @@ -42,6 +42,7 @@
"languageLabel" => "Italiano",
"date_format" => "Y/m/d H:i",
"byte_unit_symbol" => "b",
"date_intl_locale" => "it-IT",
"0" => "Ultima versione",
"1" => "Nome file",
"2" => "Dimensione",
Expand Down
1 change: 1 addition & 0 deletions core/src/plugins/core.ajaxplorer/i18n/ja.php
Expand Up @@ -27,6 +27,7 @@
"languageLabel" => "日本語",
"date_format" => "Y/m/d H:i",
"byte_unit_symbol" => "b",
"date_intl_locale" => "ja-JP",
"0" => "最新バージョン",
"1" => "ファイル名",
"2" => "サイズ",
Expand Down
1 change: 1 addition & 0 deletions core/src/plugins/core.ajaxplorer/i18n/kr.php
Expand Up @@ -31,6 +31,7 @@
"languageLabel" => "한국어",
"date_format" => "Y/m/d H:i",
"byte_unit_symbol" => "b",
"date_intl_locale" => "ko-KR",
"0" => "최신 버전",
"1" => "파일 이름",
"2" => "크기",
Expand Down
1 change: 1 addition & 0 deletions core/src/plugins/core.ajaxplorer/i18n/nl.php
Expand Up @@ -28,6 +28,7 @@
"languageLabel" => "Nederlands",
"date_format" => "Y/m/d H:i",
"byte_unit_symbol" => "b",
"date_intl_locale" => "nl-NL",
"0" => "Laatste versie",
"1" => "Bestandsnaam",
"2" => "Grootte",
Expand Down
1 change: 1 addition & 0 deletions core/src/plugins/core.ajaxplorer/i18n/no.php
Expand Up @@ -26,6 +26,7 @@
"languageLabel" => "Norwegian",
"date_format" => "d.m.Y H:i",
"byte_unit_symbol" => "b",
"date_intl_locale" => "nn-NO",
"0" => "Aktuell versjon",
"1" => "Filnavn",
"2" => "Størrelse",
Expand Down
1 change: 1 addition & 0 deletions core/src/plugins/core.ajaxplorer/i18n/pl.php
Expand Up @@ -22,6 +22,7 @@
"languageLabel" => "Polski",
"date_format" => "d/m/Y H:i",
"byte_unit_symbol" => "b",
"date_intl_locale" => "pl-PL",
"0" => "Ostatnia wersja",
"1" => "Nazwa pliku",
"2" => "Rozmiar",
Expand Down
1 change: 1 addition & 0 deletions core/src/plugins/core.ajaxplorer/i18n/pt-br.php
Expand Up @@ -26,6 +26,7 @@
"languageLabel" => "Português Brasileiro",
"date_format" => "Y/m/d H:i",
"byte_unit_symbol" => "b",
"date_intl_locale" => "pt-BR",
"0" => "Última versão",
"1" => "Nome do arquivo",
"2" => "Tamanho",
Expand Down
1 change: 1 addition & 0 deletions core/src/plugins/core.ajaxplorer/i18n/pt.php
Expand Up @@ -20,6 +20,7 @@
*/
$mess=array(
"languageLabel" => "Português (Portugal)",
"date_intl_locale" => "pl-PL",
"date_format" => "d/m/Y H:i",
"date_relative_date" => "em DATE",
"date_relative_time" => "TIME",
Expand Down
1 change: 1 addition & 0 deletions core/src/plugins/core.ajaxplorer/i18n/ru.php
Expand Up @@ -22,6 +22,7 @@
"languageLabel" => "Russian",
"date_format" => "Y/m/d H:i",
"byte_unit_symbol" => "b",
"date_intl_locale" => "ru-RU",
"0" => "Версия",
"1" => "Имя файла",
"2" => "Размер",
Expand Down
1 change: 1 addition & 0 deletions core/src/plugins/core.ajaxplorer/i18n/si.php
Expand Up @@ -23,6 +23,7 @@
"languageLabel" => "Slovenščina",
"date_format" => "d/m/Y H:i",
"byte_unit_symbol" => "b",
"date_intl_locale" => "sl-SI",
"0" => "Zadnja različica",
"1" => "Ime",
"2" => "Velikost",
Expand Down
1 change: 1 addition & 0 deletions core/src/plugins/core.ajaxplorer/i18n/sv.php
Expand Up @@ -22,6 +22,7 @@
"languageLabel" => "Svenska",
"date_format" => "Y/m/d H:i",
"byte_unit_symbol" => "b",
"date_intl_locale" => "sv-SE",
"0" => "Senaste version",
"1" => "Filnamn",
"2" => "Storlek",
Expand Down
1 change: 1 addition & 0 deletions core/src/plugins/core.ajaxplorer/i18n/tr.php
Expand Up @@ -25,6 +25,7 @@
"languageLabel" => "Türkçe",
"date_format" => "Y/m/d H:i",
"byte_unit_symbol" => "b",
"date_intl_locale" => "tr-TR",
"0" => "Son sürüm",
"1" => "Dosya",
"2" => "Boyut",
Expand Down
1 change: 1 addition & 0 deletions core/src/plugins/core.ajaxplorer/i18n/zh-tw.php
Expand Up @@ -25,6 +25,7 @@
"languageLabel" => "繁體中文",
"date_format" => "Y/m/d H:i",
"byte_unit_symbol" => "b",
"date_intl_locale" => "zh-TW",
"0" => "上一版本",
"1" => "名稱",
"2" => "大小",
Expand Down
1 change: 1 addition & 0 deletions core/src/plugins/core.ajaxplorer/i18n/zh.php
Expand Up @@ -34,6 +34,7 @@
"languageLabel" => "简体中文",
"date_format" => "Y/m/d H:i",
"byte_unit_symbol" => "b",
"date_intl_locale" => "zh-CN",
"0" => "上一版本",
"1" => "名称",
"2" => "大小",
Expand Down

0 comments on commit 2579c36

Please sign in to comment.