diff --git a/README.md b/README.md index f212254..e3e67d9 100644 --- a/README.md +++ b/README.md @@ -118,6 +118,7 @@ const ( LocaleFrGF = "fr_RE" // French (Reunion) LocaleCsCZ = "cs_CZ" // Czech (Czech Republic) LocaleSlSI = "sl_SI" // Slovenian (Slovenia) + LocaleLtLT = "lt_LT" // Lithuanian (Lithuania) ) ``` diff --git a/default_formats.go b/default_formats.go index 65c8747..0ab894d 100644 --- a/default_formats.go +++ b/default_formats.go @@ -214,6 +214,12 @@ const ( DefaultFormatCsCZMedium = "02 Jan 2006" DefaultFormatCsCZShort = "02/01/2006" DefaultFormatCsCZDateTime = "02/01/2006 15:04" + + DefaultFormatLtLTFull = "2006 m. January 2 d., Monday" // Lithuanian (Lithuania) + DefaultFormatLtLTLong = "2006 January 2 d." + DefaultFormatLtLTMedium = "2006 Jan 2" + DefaultFormatLtLTShort = "2006-01-02" + DefaultFormatLtLTDateTime = "2006-01-02, 15:04" ) // FullFormatsByLocale maps locales to the'full' date formats for all @@ -254,6 +260,7 @@ var FullFormatsByLocale = map[Locale]string{ LocaleElGR: DefaultFormatElGRFull, LocaleCsCZ: DefaultFormatCsCZFull, LocaleUkUA: DefaultFormatUkUAFull, + LocaleLtLT: DefaultFormatLtLTFull, } // LongFormatsByLocale maps locales to the 'long' date formats for all @@ -294,6 +301,7 @@ var LongFormatsByLocale = map[Locale]string{ LocaleElGR: DefaultFormatElGRLong, LocaleCsCZ: DefaultFormatCsCZLong, LocaleUkUA: DefaultFormatUkUALong, + LocaleLtLT: DefaultFormatLtLTLong, } // MediumFormatsByLocale maps locales to the 'medium' date formats for all @@ -334,6 +342,7 @@ var MediumFormatsByLocale = map[Locale]string{ LocaleElGR: DefaultFormatElGRMedium, LocaleCsCZ: DefaultFormatCsCZMedium, LocaleUkUA: DefaultFormatUkUAMedium, + LocaleLtLT: DefaultFormatLtLTMedium, } // ShortFormatsByLocale maps locales to the 'short' date formats for all @@ -374,6 +383,7 @@ var ShortFormatsByLocale = map[Locale]string{ LocaleElGR: DefaultFormatElGRShort, LocaleCsCZ: DefaultFormatCsCZShort, LocaleUkUA: DefaultFormatUkUAShort, + LocaleLtLT: DefaultFormatLtLTShort, } // DateTimeFormatsByLocale maps locales to the 'DateTime' date formats for @@ -414,4 +424,5 @@ var DateTimeFormatsByLocale = map[Locale]string{ LocaleElGR: DefaultFormatElGRDateTime, LocaleCsCZ: DefaultFormatCsCZDateTime, LocaleUkUA: DefaultFormatUkUADateTime, + LocaleLtLT: DefaultFormatLtLTDateTime, } diff --git a/format_lt_lt.go b/format_lt_lt.go new file mode 100644 index 0000000..264a67a --- /dev/null +++ b/format_lt_lt.go @@ -0,0 +1,85 @@ +package monday + +// ============================================================ +// Format rules for "lt_LT" locale: Lithuanian (Lithuania) +// ============================================================ + +var longDayNamesLtLT = map[string]string{ + "Sunday": "sekmadienis", + "Monday": "pirmadienis", + "Tuesday": "antradienis", + "Wednesday": "trečiadienis", + "Thursday": "ketvirtadienis", + "Friday": "penktadienis", + "Saturday": "šeštadienis", +} + +var shortDayNamesLtLT = map[string]string{ + "Sun": "VII", + "Mon": "I", + "Tue": "II", + "Wed": "III", + "Thu": "IV", + "Fri": "V", + "Sat": "VI", +} + +var longMonthNamesLtLT = map[string]string{ + "January": "sausis", + "February": "vasaris", + "March": "kovas", + "April": "balandis", + "May": "gegužė", + "June": "birželis", + "July": "liepa", + "August": "rugpjūtis", + "September": "rugsėjis", + "October": "spalis", + "November": "lapkritis", + "December": "gruodis", +} + +var longMonthNamesGenitiveLtLT = map[string]string{ + "January": "sausio", + "February": "vasario", + "March": "kovo", + "April": "balandžio", + "May": "gegužės", + "June": "birželio", + "July": "liepos", + "August": "rugpjūčio", + "September": "rugsėjio", + "October": "spalio", + "November": "lapkričio", + "December": "gruodžio", +} + +var shortMonthNamesLtLT = map[string]string{ + "Jan": "sausis", + "Feb": "vas", + "Mar": "kovas", + "Apr": "bal", + "May": "geg", + "Jun": "birž", + "Jul": "liepa", + "Aug": "rugpj", + "Sep": "rugs", + "Oct": "spalis", + "Nov": "lapkr", + "Dec": "gruodis", +} + +var shortMonthNamesGenitiveLtLT = map[string]string{ + "Jan": "sausio", + "Feb": "vas", + "Mar": "kovo", + "Apr": "bal", + "May": "geg", + "Jun": "birž", + "Jul": "liepos", + "Aug": "rugpj", + "Sep": "rugs", + "Oct": "spalio", + "Nov": "lapkr", + "Dec": "gruodžio", +} diff --git a/locale.go b/locale.go index 6be569e..518bacb 100644 --- a/locale.go +++ b/locale.go @@ -45,6 +45,7 @@ const ( LocaleFrGF = "fr_GF" // French (French Guiana) LocaleCsCZ = "cs_CZ" // Czech (Czech Republic) LocaleSlSI = "sl_SI" // Slovenian (Slovenia) + LocaleLtLT = "lt_LT" // Lithuanian (Lithuania) ) // ListLocales returns all locales supported by the package. @@ -87,5 +88,6 @@ func ListLocales() []Locale { LocaleFrGF, LocaleCsCZ, LocaleSlSI, + LocaleLtLT, } } diff --git a/monday.go b/monday.go index cbcaf27..5e4a034 100644 --- a/monday.go +++ b/monday.go @@ -47,6 +47,7 @@ var internalFormatFuncs = map[Locale]internalFormatFunc{ LocaleIdID: createCommonFormatFunc(LocaleIdID), LocaleCsCZ: createCommonFormatFunc(LocaleCsCZ), LocaleSlSI: createCommonFormatFunc(LocaleSlSI), + LocaleLtLT: createCommonFormatFuncWithGenitive(LocaleLtLT), } // internalParseFunc is a preprocessor for default time.ParseInLocation func @@ -91,6 +92,7 @@ var internalParseFuncs = map[Locale]internalParseFunc{ LocaleIdID: createCommonParseFunc(LocaleIdID), LocaleCsCZ: createCommonParseFunc(LocaleCsCZ), LocaleSlSI: createCommonParseFunc(LocaleSlSI), + LocaleLtLT: createCommonParsetFuncWithGenitive(LocaleLtLT), } var knownDaysShort = map[Locale]map[string]string{} // Mapping for 'Format', days of week, short form @@ -355,6 +357,14 @@ func fillKnownWords() { fillKnownDaysShort(shortDayNamesSlSI, LocaleSlSI) fillKnownMonthsLong(longMonthNamesSlSI, LocaleSlSI) fillKnownMonthsShort(shortMonthNamesSlSI, LocaleSlSI) + + // Lt_LT: Lithuanian (Lithuania) + fillKnownDaysLong(longDayNamesLtLT, LocaleLtLT) + fillKnownDaysShort(shortDayNamesLtLT, LocaleLtLT) + fillKnownMonthsLong(longMonthNamesLtLT, LocaleLtLT) + fillKnownMonthsShort(shortMonthNamesLtLT, LocaleLtLT) + fillKnownMonthsGenitiveLong(longMonthNamesGenitiveLtLT, LocaleLtLT) + fillKnownMonthsGenitiveShort(shortMonthNamesGenitiveLtLT, LocaleLtLT) } func fill(src map[string]string, dest map[Locale]map[string]string, locale Locale) {