Przeglądaj źródła

added locale to calendar

CauseFX 5 lat temu
rodzic
commit
d488d97f12

+ 1 - 0
api/config/default.php

@@ -236,6 +236,7 @@ return array(
 	'calendarRefresh' => '60000',
 	'calendarTimeFormat' => 'h(:mm)t',
 	'calendarLimit' => '1000',
+	'calendarLocale' => 'en',
 	'customCss' => '',
 	'customThemeCss' => '',
 	'customHTMLone' => '',

+ 199 - 0
api/functions/option-functions.php

@@ -2,6 +2,205 @@
 
 trait OptionsFunction
 {
+	public function calendarLocaleOptions()
+	{
+		return [
+			[
+				'name' => 'Arabic (Standard)',
+				'value' => 'ar',
+			],
+			[
+				'name' => 'Arabic (Morocco)',
+				'value' => 'ar-ma',
+			],
+			[
+				'name' => 'Arabic (Saudi Arabia)',
+				'value' => 'ar-sa'
+			],
+			[
+				'value' => 'ar-tn',
+				'name' => 'Arabic (Tunisia)'
+			],
+			[
+				'value' => 'bg',
+				'name' => 'Bulgarian'
+			],
+			[
+				'value' => 'ca',
+				'name' => 'Catalan'
+			],
+			[
+				'value' => 'cs',
+				'name' => 'Czech'
+			],
+			[
+				'value' => 'da',
+				'name' => 'Danish'
+			],
+			[
+				'value' => 'de',
+				'name' => 'German (Standard)'
+			],
+			[
+				'value' => 'de-at',
+				'name' => 'German (Austria)'
+			],
+			[
+				'value' => 'el',
+				'name' => 'Greek'
+			],
+			[
+				'value' => 'en',
+				'name' => 'English'
+			],
+			[
+				'value' => 'en-au',
+				'name' => 'English (Australia)'
+			],
+			[
+				'value' => 'en-ca',
+				'name' => 'English (Canada)'
+			],
+			[
+				'value' => 'en-gb',
+				'name' => 'English (United Kingdom)'
+			],
+			[
+				'value' => 'es',
+				'name' => 'Spanish'
+			],
+			[
+				'value' => 'fa',
+				'name' => 'Farsi'
+			],
+			[
+				'value' => 'fi',
+				'name' => 'Finnish'
+			],
+			[
+				'value' => 'fr',
+				'name' => 'French (Standard)'
+			],
+			[
+				'value' => 'fr-ca',
+				'name' => 'French (Canada)'
+			],
+			[
+				'value' => 'he',
+				'name' => 'Hebrew'
+			],
+			[
+				'value' => 'hi',
+				'name' => 'Hindi'
+			],
+			[
+				'value' => 'hr',
+				'name' => 'Croatian'
+			],
+			[
+				'value' => 'hu',
+				'name' => 'Hungarian'
+			],
+			[
+				'value' => 'id',
+				'name' => 'Indonesian'
+			],
+			[
+				'value' => 'is',
+				'name' => 'Icelandic'
+			],
+			[
+				'value' => 'it',
+				'name' => 'Italian'
+			],
+			[
+				'value' => 'ja',
+				'name' => 'Japanese'
+			],
+			[
+				'value' => 'ko',
+				'name' => 'Korean'
+			],
+			[
+				'value' => 'lt',
+				'name' => 'Lithuanian'
+			],
+			[
+				'value' => 'lv',
+				'name' => 'Latvian'
+			],
+			[
+				'value' => 'nb',
+				'name' => 'Norwegian (Bokmal)'
+			],
+			[
+				'value' => 'nl',
+				'name' => 'Dutch (Standard)'
+			],
+			[
+				'value' => 'pl',
+				'name' => 'Polish'
+			],
+			[
+				'value' => 'pt',
+				'name' => 'Portuguese'
+			],
+			[
+				'value' => 'pt-br',
+				'name' => 'Portuguese (Brazil)'
+			],
+			[
+				'value' => 'ro',
+				'name' => 'Romanian'
+			],
+			[
+				'value' => 'ru',
+				'name' => 'Russian'
+			],
+			[
+				'value' => 'sk',
+				'name' => 'Slovak'
+			],
+			[
+				'value' => 'sl',
+				'name' => 'Slovenian'
+			],
+			[
+				'value' => 'sr',
+				'name' => 'Serbian'
+			],
+			[
+				'value' => 'sv',
+				'name' => 'Swedish'
+			],
+			[
+				'value' => 'th',
+				'name' => 'Thai'
+			],
+			[
+				'value' => 'tr',
+				'name' => 'Turkish'
+			],
+			[
+				'value' => 'uk',
+				'name' => 'Ukrainian'
+			],
+			[
+				'value' => 'vi',
+				'name' => 'Vietnamese'
+			],
+			[
+				'value' => 'zh-cn',
+				'name' => 'Chinese (PRC)'
+			],
+			[
+				'value' => 'zh-tw',
+				'name' => 'Chinese (Taiwan)'
+			]
+		];
+		
+	}
+	
 	public function daysOptions()
 	{
 		return array(

+ 13 - 0
api/homepage/calendar.php

@@ -68,6 +68,13 @@ trait CalendarHomepageItem
 						'value' => $this->config['calendarTimeFormat'],
 						'options' => $this->timeFormatOptions()
 					),
+					array(
+						'type' => 'select',
+						'name' => 'calendarLocale',
+						'label' => 'Locale',
+						'value' => $this->config['calendarLocale'],
+						'options' => $this->calendarLocaleOptions()
+					),
 					array(
 						'type' => 'select',
 						'name' => 'calendarLimit',
@@ -87,6 +94,12 @@ trait CalendarHomepageItem
 		);
 	}
 	
+	public function loadCalendarJS()
+	{
+		$locale = ($this->config['calendarLocale'] !== 'en') ?? false;
+		return ($locale) ? '<script src="plugins/bower_components/calendar/dist/lang-all.js"></script>' : '';
+	}
+	
 	public function getCalendar()
 	{
 		$startDate = date('Y-m-d', strtotime("-" . $this->config['calendarStart'] . " days"));

+ 7 - 0
api/homepage/couchpotato.php

@@ -64,6 +64,13 @@ trait CouchPotatoHomepageItem
 						'value' => $this->config['calendarTimeFormat'],
 						'options' => $this->timeFormatOptions()
 					),
+					array(
+						'type' => 'select',
+						'name' => 'calendarLocale',
+						'label' => 'Locale',
+						'value' => $this->config['calendarLocale'],
+						'options' => $this->calendarLocaleOptions()
+					),
 					array(
 						'type' => 'select',
 						'name' => 'calendarLimit',

+ 7 - 0
api/homepage/lidarr.php

@@ -107,6 +107,13 @@ trait LidarrHomepageItem
 						'value' => $this->config['calendarTimeFormat'],
 						'options' => $this->timeFormatOptions()
 					),
+					array(
+						'type' => 'select',
+						'name' => 'calendarLocale',
+						'label' => 'Locale',
+						'value' => $this->config['calendarLocale'],
+						'options' => $this->calendarLocaleOptions()
+					),
 					array(
 						'type' => 'select',
 						'name' => 'calendarLimit',

+ 7 - 0
api/homepage/radarr.php

@@ -135,6 +135,13 @@ trait RadarrHomepageItem
 						'value' => $this->config['calendarTimeFormat'],
 						'options' => $this->timeFormatOptions()
 					),
+					array(
+						'type' => 'select',
+						'name' => 'calendarLocale',
+						'label' => 'Locale',
+						'value' => $this->config['calendarLocale'],
+						'options' => $this->calendarLocaleOptions()
+					),
 					array(
 						'type' => 'select',
 						'name' => 'calendarLimit',

+ 7 - 0
api/homepage/sickrage.php

@@ -63,6 +63,13 @@ trait SickRageHomepageItem
 						'value' => $this->config['calendarTimeFormat'],
 						'options' => $this->timeFormatOptions()
 					),
+					array(
+						'type' => 'select',
+						'name' => 'calendarLocale',
+						'label' => 'Locale',
+						'value' => $this->config['calendarLocale'],
+						'options' => $this->calendarLocaleOptions()
+					),
 					array(
 						'type' => 'select',
 						'name' => 'calendarLimit',

+ 7 - 0
api/homepage/sonarr.php

@@ -135,6 +135,13 @@ trait SonarrHomepageItem
 						'value' => $this->config['calendarTimeFormat'],
 						'options' => $this->timeFormatOptions()
 					),
+					array(
+						'type' => 'select',
+						'name' => 'calendarLocale',
+						'label' => 'Locale',
+						'value' => $this->config['calendarLocale'],
+						'options' => $this->calendarLocaleOptions()
+					),
 					array(
 						'type' => 'select',
 						'name' => 'calendarLimit',

+ 1 - 0
api/pages/homepage.php

@@ -34,6 +34,7 @@ function get_page_homepage($Organizr = null)
 
         var $this = this;
         $this.$calendarObj = $this.$calendar.fullCalendar({
+        	locale: "' . $Organizr->config['calendarLocale'] . '",
         	customButtons: {
 			    filterCalendar: {
 			      text: \'Filter\',

+ 1 - 0
index.php

@@ -235,6 +235,7 @@ $Organizr = new Organizr();
 echo $Organizr->googleTracking();
 echo $Organizr->pluginFiles('js');
 echo $Organizr->formKey();
+echo $Organizr->loadCalendarJS();
 ?>
 </body>
 

Plik diff jest za duży
+ 0 - 0
plugins/bower_components/calendar/dist/lang-all.js


Niektóre pliki nie zostały wyświetlone z powodu dużej ilości zmienionych plików