Module:I18n/date
--[[
   __  __           _       _        ___ _  ___           __  _       _       
  |  \/  | ___   __| |_   _| | ___ _|_ _/ |( _ ) _ __    / /_| | __ _| |_ ___ 
  | |\/| |/ _ \ / _` | | | | |/ _ (_)| || |/ _ \| '_ \  / / _` |/ _` | __/ _ \
  | |  | | (_) | (_| | |_| | |  __/_ | || | (_) | | | |/ / (_| | (_| | ||  __/
  |_|  |_|\___/ \__,_|\__,_|_|\___(_)___|_|\___/|_| |_/_/ \__,_|\__,_|\__\___|
                                                                              
 This Module handles per language customization of dates
 Copied from https://commons.wikimedia.org/wiki/Module:I18n/date
 used by Module:ISOdate, Module:Complex date, Module:WikidataIB
 Authors and Maintainers:
 * Jarekt 
 ]]
 
 
 local p = {}
 
 --[[ Different languages use different date formats, and many formats are shared among whole families of languages. 
 &quot;DateLang&quot; picks a cluster of languages associated with a single date format, based on the language to be used. 
 All unlisted languages default to English form. Languages like &quot;de-formal&quot; follows regular language fallback chain 
 and would default to German, and only if that does not exist then to English.
 ]]
 
 p.DateLang = {
 	['be'] 		= 'ru-form', -- Belarusian
 	['be-tarsk'] 	= 'ru-form', -- Belarusian (Tara۫ievica)
 	['bn'] 		= 'en-form', -- Bengali
 	['bpy'] 	= 'bpy-form', -- Bishnupuriya Manipuri
 	['ce'] 		= 'ce-form', -- Chechen
 	['cs'] 		= 'cs-form', -- Czech
 	['da'] 		= 'de-form', -- Danish
 	['de'] 		= 'de-form', -- German
 	['el'] 		= 'ru-form', -- Greek
 	['en'] 		= 'en-form', -- English
 	['eo'] 		= 'eo-form', -- Esperanto
 	['es'] 		= 'es-form', -- Spanish
 	['et'] 		= 'de-form', -- Estonian
 	['eu'] 		= 'eu-form', -- Basque
 	['fa'] 		= 'he-form', -- Persian
 	['fi'] 		= 'fi-form', -- Finnish
 	['fr'] 		= 'fr-form', -- French
 	['ga'] 		= 'ga-form', -- Gallic
 	['gl'] 		= 'es-form', -- Galician based on https://translatewiki.net/wiki/MediaWiki:Pagetriage-info-timestamp-date-format/gl
 	['hi'] 		= 'en-form', -- Hindi
 	['he'] 		= 'he-form', -- Hebrew 
 	['hr'] 		= 'hr-form', -- Croatian 
 	['hu'] 		= 'hu-form', -- Hungarian
 	['hsb'] 	= 'cs-form', -- Upper Sorbian
 	['ia'] 		= 'ia-form', -- Interlingua
 	['is'] 		= 'de-form', -- Icelandic
 	['ja'] 		= 'zh-form', -- Japanese
 	['kn'] 		= 'kn-form', -- Kannada
 	['ko'] 		= 'ko-form', -- Korean
 	['lt'] 		= 'lt-form', -- Lithuanian
 	['lv'] 		= 'lv-form', -- Latvian
 	['mk'] 		= 'en-form', -- Macedonian
 	['ml'] 		= 'ml-form', -- Malayalam
 	['mr'] 		= 'mr-form', -- Marathi
 	['new'] 	= 'new-form', -- Newari
 	['nn'] 		= 'de-form', -- Norwegian Nynorsk
 	['no'] 		= 'de-form', -- Norwegian (bokm欩
 	['oc'] 		= 'oc-form', -- Occitan
 	['pa'] 		= 'en-form', -- Punjabi
 	['pl'] 		= 'ru-form', -- Polish
 	['pt'] 		= 'es-form', -- Portuguese
 	['qu'] 		= 'qu-form', -- Quechua based on https://translatewiki.net/wiki/MediaWiki:Pagetriage-info-timestamp-date-format/qu
 	['qug'] 	= 'qug-form', -- Kichwa based on Template_talk:Date#Kichwa_.5Bqug.5D
 	['ru'] 		= 'ru-form', -- Russian
 	['sk'] 		= 'cs-form', -- Slovakian
 	['sl'] 		= 'sl-form', -- Slovene
 	['sr'] 		= 'hr-form', -- Serbian
 	['th'] 		= 'th-form', -- Thai solar calendar
 	['uk'] 		= 'ru-form', -- Ukrainian
 	['vi'] 		= 'vi-form', -- Vietnamese
 	['zh-hans'] 	= 'zh-form', -- Chinese
 }
 
 --[[ Date format parameter which will be passed to {{#time:}} parser function. 
   It depends on the language and which parts of the date need to be displayed. 
   Different forms are:
   * YMDHMS = stands for YYYY:MM:DD, HH:MM:SS format or equivalent
   * YMDHM  = stands for YYYY:MM:DD, HH:MM format or equivalent
   * YMD    = stands for YYYY:MM:DD format or equivalent
   * YM     = stands for YYYY:MM (year-month) format or equivalent
   * MD     = stands for MM:DD (month-day) format or equivalent
   * Y      = stands for YYYY (year only) format or equivalent
   * M      = stands for month name only
   
   The left hand side follows encoding used by {{#time}} parser function , 
   see https://www.mediawiki.org/wiki/Help:Extension:ParserFunctions#.23time for documentation.
 	To summerize:
 	 * Y - 4-digit year, like &quot;2017&quot;
 	 * y - 2-digit year, like &quot;17&quot;
 	 * M - An abbreviation of the month name, in the site language, like &quot;Mar&quot;
 	 * F - The full month name in the site language, like &quot;March&quot;
 	 * xg - Output the full month name in the genitive form for site languages that distinguish 
 	        between genitive and nominative forms. This option is useful for many Slavic languages 
 					like Polish, Russian, Belarusian, Czech, Slovak, Slovene, Ukrainian, etc.
 	 * j - Day of the month, not zero-padded, like &quot;1&quot;
 	 * d - Day of the month, zero-padded, like &quot;01&quot;
 	 * a - &quot;am&quot; during the morning (00:00:00 → 11:59:59), &quot;pm&quot; otherwise (12:00:00 → 23:59:59).
 	 * A - Uppercase version of a above.
 	 * g - Hour in 12-hour format, not zero-padded. 
 	 * h - Hour in 12-hour format, zero-padded.
 	 * G - Hour in 24-hour format, not zero-padded. 
 	 * H - Hour in 24-hour format, zero-padded. 
 	 * i - Minutes past the hour, zero-padded.
 	 * s - Seconds past the minute, zero-padded.
 	 
   Original set was developed to match the output of the pre-Lua {{date}} template, preserved as {{date/old}}
 ]]
 p.DateFormat = {
 	-- day/month/year languages
 	['en-form'] = {
 		YMDHMS='j F Y, H:i:s',		
 		YMDHM ='j F Y, H:i',		
 		YMD   ='j F Y',		
 		YM    ='F Y',		
 		MD    ='j F',		
 		Y     ='Y',
 		M     ='F'		
 	},
 	['de-form'] = {
 		YMDHMS='j. F Y, H:i:s',		
 		YMDHM ='j. F Y, H:i',		
 		YMD   ='j. F Y',		
 		YM    ='F Y',		
 		MD    ='j. F',		
 		Y     ='Y',
 		M     ='F'
 	},
 	['hr-form'] = {
 		YMDHMS='j. F Y., H:i:s',		
 		YMDHM ='j. F Y., H:i',		
 		YMD   ='j. F Y.',		
 		YM    ='F Y.',		
 		MD    ='j. F',		
 		Y     ='Y.',
 		M     ='F'
 	},
 	['ml-form'] = {
 		YMDHMS='j F Y, H:i:s',		
 		YMDHM ='j F Y, H:i',		
 		YMD   ='j F Y',		
 		YM    ='F Y',		
 		MD    ='F j',		
 		Y     ='Y',
 		M     ='F'
 	},
 	['th-form'] = {
 		YMDHMS='j F &quot;พ.ศ.&quot; xkY, H:i:s',	
 		YMDHM ='j F &quot;พ.ศ.&quot; xkY, H:i',	
 		YMD   ='j F &quot;พ.ศ.&quot; xkY',	
 		YM    ='F &quot;พ.ศ.&quot; xkY',
 		MD    ='j F',		
 		Y     ='&quot;พ.ศ.&quot; xkY',
 		M     ='F'
 	},
 	['fi-form'] = {
 		YMDHMS='j. F&quot;ta&quot; Y, H:i:s',	
 		YMDHM ='j. F&quot;ta&quot; Y, H:i',	
 		YMD   ='j. F&quot;ta&quot; Y',	
 		YM    ='F Y',		
 		MD    ='j. F&quot;ta&quot;',		
 		Y     ='Y',
 		M     ='F'
 	},
 	['es-form'] = {
 		YMDHMS='j &quot;de&quot; F &quot;de&quot; Y, H:i:s',	
 		YMDHM ='j &quot;de&quot; F &quot;de&quot; Y, H:i',	
 		YMD   ='j &quot;de&quot; F &quot;de&quot; Y',	
 		YM    ='F &quot;de&quot; Y',		
 		MD    ='j &quot;de&quot; F',		
 		Y     ='Y',
 		M     ='F'
 	},
 	['oc-form'] = {
 		YMDHMS='j F &quot;de&quot; Y, H:i:s',	
 		YMDHM ='j F &quot;de&quot; Y, H:i',	
 		YMD   ='j F &quot;de&quot; Y',	
 		YM    ='F &quot;de&quot; Y',		
 		MD    ='j F',			
 		Y     ='Y',
 		M     ='F'
 	},
 	['ia-form'] = {
 		YMDHMS='j &quot;de&quot; F Y, H:i:s',	
 		YMDHM ='j &quot;de&quot; F Y, H:i',	
 		YMD   ='j &quot;de&quot; F Y',	
 		YM    ='F Y',		
 		MD    ='j &quot;de&quot; F',		
 		Y     ='Y',
 		M     ='F'
 	},
 	['eo-form'] = {
 		YMDHMS='&quot;la&quot; j&quot;-a de&quot; F Y, H:i:s',
 		YMDHM ='&quot;la&quot; j&quot;-a de&quot; F Y, H:i',
 		YMD   ='&quot;la&quot; j&quot;-a de&quot; F Y',
 		YM    ='F Y',		
 		MD    ='&quot;la&quot; j&quot;-a de&quot; F',	
 		Y     ='Y',
 		M     ='F'
 	},
 	['vi-form'] = {
 		YMDHMS='j F &quot;năm&quot; Y &quot;lúc&quot; H:i:s',	
 		YMDHM ='j F &quot;năm&quot; Y &quot;lúc&quot; H:i',	
 		YMD   ='j F &quot;năm&quot; Y',	
 		YM    ='F &quot;năm&quot; Y',		
 		MD    ='j F',		
 		Y     ='Y',
 		M     ='F'
 	},
 	['qu-form'] = {
 		YMDHMS='j &quot;ñiqin&quot; F&quot;pi&quot; Y &quot;watapi&quot;, H:i:s',	
 		YMDHM ='j &quot;ñiqin&quot; F&quot;pi&quot; Y &quot;watapi&quot;, H:i',	
 		YMD   ='j &quot;ñiqin&quot; F&quot;pi&quot; Y &quot;watapi&quot;',	
 		YM    ='F&quot;pi&quot; Y &quot;watapi&quot;',		
 		MD    ='j &quot;ñiqin&quot; F&quot;pi&quot;',		
 		Y     ='Y',
 		M     ='F'
 	},
 	['qug-form'] = {
 		YMDHMS='j &quot;niki&quot; F&quot;pi&quot; Y &quot;watapi&quot;, H:i:s',	
 		YMDHM ='j &quot;niki&quot; F&quot;pi&quot; Y &quot;watapi&quot;, H:i',	
 		YMD   ='j &quot;niki&quot; F&quot;pi&quot; Y &quot;watapi&quot;',	
 		YM    ='F&quot;pi&quot; Y &quot;watapi&quot;',		
 		MD    ='j &quot;niki&quot; F&quot;pi&quot;',		
 		Y     ='Y',
 		M     ='F'
 	},
 	['he-form'] = {
 		YMDHMS='&quot;&lt;span dir=rtl&gt;&quot;j xg Y&quot;&lt;/span&gt;&quot;, H:i:s',		
 		YMDHM ='&quot;&lt;span dir=rtl&gt;&quot;j xg Y&quot;&lt;/span&gt;&quot;, H:i',		
 		YMD   ='&quot;&lt;span dir=rtl&gt;&quot;j xg Y&quot;&lt;/span&gt;&quot;',		
 		YM    ='&quot;&lt;span dir=rtl&gt;&quot;F Y&quot;&lt;/span&gt;&quot;',		
 		MD    ='&quot;&lt;span dir=rtl&gt;&quot;j xg&quot;&lt;/span&gt;&quot;',		
 		Y     ='Y',
 		M     ='&quot;&lt;span dir=rtl&gt;&quot;F&quot;&lt;/span&gt;&quot;'
 	},
 	
 	-- French and Gallic languages require different form for first day of the month and 
 	-- different for the other days
 	['fr-form'] = {
 		YMDHMS='j F Y, H:i:s',		
 		YMDHM ='j F Y, H:i',		
 		YMD   ='j F Y',		
 		YM    ='F Y',		
 		MD    ='j F',		
 		Y     ='Y',
 		M     ='F'
 	},
 	['ga-form'] = {
 		YMDHMS='j F Y, H:i:s',		
 		YMDHM ='j F Y, H:i',		
 		YMD   ='j F Y',		
 		YM    ='F Y',		
 		MD    ='j F',		
 		Y     ='Y',
 		M     ='F'
 	},
 	['fr-form1'] = { -- 1st of the month form
 		YMDHMS='j&quot;&lt;sup&gt;er&lt;/sup&gt;&quot; F Y, H:i:s', 
 		YMDHM ='j&quot;&lt;sup&gt;er&lt;/sup&gt;&quot; F Y, H:i', 
 		YMD   ='j&quot;&lt;sup&gt;er&lt;/sup&gt;&quot; F Y', 
 		YM    ='F Y', 	
 		MD    ='j&quot;&lt;sup&gt;er&lt;/sup&gt;&quot; F', 
 		Y     ='Y',
 		M     ='F'
 	},
 	['ga-form1'] = { -- 1st of the month form
 		YMDHMS='j&quot;&lt;sup&gt;ú&lt;/sup&gt;&quot; F Y, H:i:s',  
 		YMDHM ='j&quot;&lt;sup&gt;ú&lt;/sup&gt;&quot; F Y, H:i',  
 		YMD   ='j&quot;&lt;sup&gt;ú&lt;/sup&gt;&quot; F Y',  
 		YM    ='F Y', 	
 		MD    ='j&quot;&lt;sup&gt;ú&lt;/sup&gt;&quot; F',  
 		Y     ='Y',
 		M     ='F'
 	},
 		
 	-- day/month/year Slavic languages
 	['ru-form'] = {
 		YMDHMS='j xg Y, H:i:s',		
 		YMDHM ='j xg Y, H:i',		
 		YMD   ='j xg Y',		
 		YM    ='F Y',		
 		MD    ='j xg',		
 		Y     ='Y',
 		M     ='F'
 	},
 	['cs-form'] = {
 		YMDHMS='j. xg Y, H:i:s',		
 		YMDHM ='j. xg Y, H:i',		
 		YMD   ='j. xg Y',		
 		YM    ='F Y',		
 		MD    ='j. xg',		
 		Y     ='Y',
 		M     ='F'
 	},
 	['sl-form'] = {
 		YMDHMS='j. xg Y &quot;ob&quot; H:i:s',	
 		YMDHM ='j. xg Y &quot;ob&quot; H:i',	
 		YMD   ='j. xg Y',		
 		YM    ='F Y',		
 		MD    ='j. xg',		
 		Y     ='Y',
 		M     ='F'
 	},
 		
 	-- year/month/day languages
 	['zh-form'] = {
 		YMDHMS='Y年Fj日, H:i:s',		
 		YMDHM ='Y年Fj日, H:i',		
 		YMD   ='Y年Fj日',		
 		YM    ='Y年F',		
 		MD    ='Fj日',		
 		Y     ='Y年',
 		M     ='F'
 	},
 	['ko-form'] = {
 		YMDHMS='Y년 F j일, H:i:s',	
 		YMDHM ='Y년 F j일, H:i',		
 		YMD   ='Y년 F j일',		
 		YM    ='Y년 F',		
 		MD    ='F j일',		
 		Y     ='Y년',
 		M     ='F'
 	},
 	['hu-form'] = {
 		YMDHMS='Y. F j., H:i:s',		
 		YMDHM ='Y. F j., H:i',		
 		YMD   ='Y. F j.',		
 		YM    ='Y. F',		
 		MD    ='F j.',		
 		Y     ='Y',
 		M     ='F'
 	},
 	['lt-form'] = {
 		YMDHMS='Y &quot;m&quot;. F j &quot;d&quot;., H:i:s',	
 		YMDHM ='Y &quot;m&quot;. F j &quot;d&quot;., H:i',	
 		YMD   ='Y &quot;m&quot;. F j &quot;d&quot;.',	
 		YM    ='Y &quot;m&quot;. F',		
 		MD    ='F j &quot;d&quot;.',		
 		Y     ='Y &quot;m&quot;.',
 		M     ='F'
 	},
 	['eu-form'] = {
 		YMDHMS='Y&quot;ko&quot; F&quot;ren&quot; j&quot;a&quot;, H:i:s',		
 		YMDHM ='Y&quot;ko&quot; F&quot;ren&quot; j&quot;a&quot;, H:i',		
 		YMD   ='Y&quot;ko&quot; F&quot;ren&quot; j&quot;a&quot;',		
 		YM    ='Y&quot;ko&quot; F',		
 		MD    ='F&quot;ren&quot; j&quot;a&quot;',		
 		Y     ='Y',
 		M     ='F'
 	},
 	['eu-form01'] = { -- 1st and 21st of the month  uses different form
                 YMDHMS='Y&quot;ko&quot; F&quot;ren&quot; j&quot;ea&quot;, H:i:s',		
 		YMDHM ='Y&quot;ko&quot; F&quot;ren&quot; j&quot;ea&quot;, H:i',		
 		YMD   ='Y&quot;ko&quot; F&quot;ren&quot; j&quot;ea&quot;',		
 		YM    ='Y&quot;ko&quot; F',		
 		MD    ='F&quot;ren&quot; j&quot;ea&quot;',		
 		Y     ='Y',
 		M     ='F'
 	},
 	['eu-form11'] = { -- 11th and 31st of the month  uses different form
                 YMDHMS='Y&quot;ko&quot; F&quot;ren&quot; j, H:i:s',		
 		YMDHM ='Y&quot;ko&quot; F&quot;ren&quot; j, H:i',		
 		YMD   ='Y&quot;ko&quot; F&quot;ren&quot; j',		
 		YM    ='Y&quot;ko&quot; F',		
 		MD    ='F&quot;ren&quot; j',		
 		Y     ='Y',
 		M     ='F'
 	},
 	['ce-form'] = {
 		YMDHMS='Y &quot;шаран&quot; j F, H:i:s',	
 		YMDHM ='Y &quot;шаран&quot; j F, H:i',	
 		YMD   ='Y &quot;шаран&quot; j F',	
 		YM    ='Y &quot;шаран&quot; F',	
 		MD    ='j F',		
 		Y     ='Y &quot;шо&quot;',
 		M     ='F'
 	},
 			
 	-- year/day/month languages
 	['lv-form'] = {
 		YMDHMS='Y&quot;. gada&quot; j. F, H:i:s',	
 		YMDHM ='Y&quot;. gada&quot; j. F, H:i',	
 		YMD   ='Y&quot;. gada&quot; j. F',	
 		YM    ='Y&quot;. gada&quot; F',	
 		MD    ='j. F',		
 		Y     ='Y&quot;. gada&quot;',
 		M     ='F'
 	},
 
 	-- month/day/year languages
 	['kn-form'] = {
 		YMDHMS='F j, Y, H:i:s',		
 		YMDHM ='F j, Y, H:i',		
 		YMD   ='F j, Y',		
 		YM    ='F, Y',		
 		MD    ='F j',		
 		Y     ='Y',
 		M     ='F'
 	}, 
 	['bpy-form']= {
 		YMDHMS='F j, মারি Y, H:i:s',	
 		YMDHM ='F j, মারি Y, H:i',		
 		YMD   ='F j, মারি Y',	
 		YM    ='F, মারি Y',		
 		MD    ='F j',		
 		Y     ='মারি Y',
 		M     ='F'
 	},
 	['mr-form'] = {
 		YMDHMS='F j, इ.स. Y, H:i:s',	
 		YMDHM ='F j, इ.स. Y, H:i',	
 		YMD   ='F j, इ.स. Y',	
 		YM    ='F, इ.स. Y',		
 		MD    ='F j',		
 		Y     ='इ.स. Y',
 		M     ='F'
 	},
 	['new-form']= {
 		YMDHMS='F j, ई सं  Y, H:i:s',	
 		YMDHM ='F j, ई सं  Y, H:i',	
 		YMD   ='F j, ई सं  Y',	
 		YM    ='F, ई सं  Y',		
 		MD    ='F j',		
 		Y     ='ई सं Y',
 		M     ='F'
 	},
 }