Skip to content

Commit

Permalink
Merge pull request #11 from heetch/fix/fix-locales-list
Browse files Browse the repository at this point in the history
Fix Polish and Bulgarian locales
  • Loading branch information
goodsign committed Jun 1, 2016
2 parents 3bc6396 + 52c6ab1 commit 0ec55ec
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 30 deletions.
58 changes: 29 additions & 29 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,35 +78,35 @@ Supported locales are listed in **locale.go** file.

```
const (
LocaleEnUS = "en_US" // English (United States)
LocaleEnGB = "en_GB" // English (United Kingdom)
LocaleDaDK = "da_DK" // Danish (Denmark)
LocaleNlBE = "nl_BE" // Dutch (Belgium)
LocaleNlNL = "nl_NL" // Dutch (Netherlands)
LocaleFiFI = "fi_FI" // Finnish (Finland)
LocaleFrFR = "fr_FR" // French (France)
LocaleFrCA = "fr_CA" // French (Canada)
LocaleDeDE = "de_DE" // German (Germany)
LocaleHuHU = "hu_HU" // Hungarian (Hungary)
LocaleItIT = "it_IT" // Italian (Italy)
LocaleNnNO = "nn_NO" // Norwegian Nynorsk (Norway)
LocaleNbNO = "nb_NO" // Norwegian Bokmål (Norway)
LocalePlPL = "pl_PL" // Polish (Poland)
LocalePtPT = "pt_PT" // Portuguese (Portugal)
LocalePtBR = "pt_BR" // Portuguese (Brazil)
LocaleRoRO = "ro_RO" // Romanian (Romania)
LocaleRuRU = "ru_RU" // Russian (Russia)
LocaleEsES = "es_ES" // Spanish (Spain)
LocaleCaES = "ca_ES" // Catalan (Spain)
LocaleSvSE = "sv_SE" // Swedish (Sweden)
LocaleTrTR = "tr_TR" // Turkish (Turkey)
LocaleBgBF = "bg_BG" // Bulgarian (Bulgaria)
LocaleZhCN = "zh_CN" // Chinese (Mainland)
LocaleZhTW = "zh_TW" // Chinese (Taiwan)
LocaleZhHK = "zh_HK" // Chinese (Hong Kong)
LocaleJaJP = "ja_JP" // Japanese (Japan)
LocaleElGR = "el_GR" // Greek (Greece)
LocaleIdID = "id_ID" // Indonesian (Indonesia)
LocaleEnUS = "en_US" // English (United States)
LocaleEnGB = "en_GB" // English (United Kingdom)
LocaleDaDK = "da_DK" // Danish (Denmark)
LocaleNlBE = "nl_BE" // Dutch (Belgium)
LocaleNlNL = "nl_NL" // Dutch (Netherlands)
LocaleFiFI = "fi_FI" // Finnish (Finland)
LocaleFrFR = "fr_FR" // French (France)
LocaleFrCA = "fr_CA" // French (Canada)
LocaleDeDE = "de_DE" // German (Germany)
LocaleHuHU = "hu_HU" // Hungarian (Hungary)
LocaleItIT = "it_IT" // Italian (Italy)
LocaleNnNO = "nn_NO" // Norwegian Nynorsk (Norway)
LocaleNbNO = "nb_NO" // Norwegian Bokmål (Norway)
LocalePlPL = "pl_PL" // Polish (Poland)
LocalePtPT = "pt_PT" // Portuguese (Portugal)
LocalePtBR = "pt_BR" // Portuguese (Brazil)
LocaleRoRO = "ro_RO" // Romanian (Romania)
LocaleRuRU = "ru_RU" // Russian (Russia)
LocaleEsES = "es_ES" // Spanish (Spain)
LocaleCaES = "ca_ES" // Catalan (Spain)
LocaleSvSE = "sv_SE" // Swedish (Sweden)
LocaleTrTR = "tr_TR" // Turkish (Turkey)
LocaleBgBG = "bg_BG" // Bulgarian (Bulgaria)
LocaleZhCN = "zh_CN" // Chinese (Mainland)
LocaleZhTW = "zh_TW" // Chinese (Taiwan)
LocaleZhHK = "zh_HK" // Chinese (Hong Kong)
LocaleJaJP = "ja_JP" // Japanese (Japan)
LocaleElGR = "el_GR" // Greek (Greece)
LocaleIdID = "id_ID" // Indonesian (Indonesia)
)
```

Expand Down
4 changes: 3 additions & 1 deletion locale.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ const (
LocaleItIT = "it_IT" // Italian (Italy)
LocaleNnNO = "nn_NO" // Norwegian Nynorsk (Norway)
LocaleNbNO = "nb_NO" // Norwegian Bokmål (Norway)
LocalePlPL = "pl_PL" // Polish (Poland)
LocalePtPT = "pt_PT" // Portuguese (Portugal)
LocalePtBR = "pt_BR" // Portuguese (Brazil)
LocaleRoRO = "ro_RO" // Romanian (Romania)
Expand All @@ -26,7 +27,7 @@ const (
LocaleCaES = "ca_ES" // Catalan (Spain)
LocaleSvSE = "sv_SE" // Swedish (Sweden)
LocaleTrTR = "tr_TR" // Turkish (Turkey)
LocaleBgBG = "bt_BG" // Bulgarian (Bulgaria)
LocaleBgBG = "bg_BG" // Bulgarian (Bulgaria)
LocaleZhCN = "zh_CN" // Chinese (Mainland)
LocaleZhTW = "zh_TW" // Chinese (Taiwan)
LocaleZhHK = "zh_HK" // Chinese (Hong Kong)
Expand All @@ -51,6 +52,7 @@ func ListLocales() []Locale {
LocaleItIT,
LocaleNnNO,
LocaleNbNO,
LocalePlPL,
LocalePtPT,
LocalePtBR,
LocaleRoRO,
Expand Down
8 changes: 8 additions & 0 deletions monday.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ var internalFormatFuncs = map[Locale]internalFormatFunc{
LocaleItIT: createCommonFormatFunc(LocaleItIT),
LocaleNnNO: createCommonFormatFunc(LocaleNnNO),
LocaleNbNO: createCommonFormatFunc(LocaleNbNO),
LocalePlPL: createCommonFormatFunc(LocalePlPL),
LocalePtPT: createCommonFormatFunc(LocalePtPT),
LocalePtBR: createCommonFormatFunc(LocalePtBR),
LocaleRoRO: createCommonFormatFunc(LocaleRoRO),
Expand Down Expand Up @@ -57,6 +58,7 @@ var internalParseFuncs = map[Locale]internalParseFunc{
LocaleItIT: createCommonParseFunc(LocaleItIT),
LocaleNnNO: createCommonParseFunc(LocaleNnNO),
LocaleNbNO: createCommonParseFunc(LocaleNbNO),
LocalePlPL: parseFuncPtCommon(LocalePlPL),
LocalePtPT: parseFuncPtCommon(LocalePtPT),
LocalePtBR: parseFuncPtCommon(LocalePtBR),
LocaleRoRO: createCommonParseFunc(LocaleRoRO),
Expand Down Expand Up @@ -177,6 +179,12 @@ func fillKnownWords() {
fillKnownMonthsLong(longMonthNamesNbNO, LocaleNbNO)
fillKnownMonthsShort(shortMonthNamesNbNO, LocaleNbNO)

// Pl_PL: Polish (Poland)
fillKnownDaysLong(longDayNamesPlPL, LocalePlPL)
fillKnownDaysShort(shortDayNamesPlPL, LocalePlPL)
fillKnownMonthsLong(longMonthNamesPlPL, LocalePlPL)
fillKnownMonthsShort(shortMonthNamesPlPL, LocalePlPL)

// Pt_PT: Portuguese (Portugal)
fillKnownDaysLong(longDayNamesPtPT, LocalePtPT)
fillKnownDaysShort(shortDayNamesPtPT, LocalePtPT)
Expand Down
25 changes: 25 additions & 0 deletions monday_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,15 @@ var formatTests = []FormatTest{
{LocaleNbNO, time.Date(0, 5, 1, 0, 0, 0, 0, time.UTC), "January", "mai"},
{LocaleNbNO, time.Date(0, 5, 13, 0, 0, 0, 0, time.UTC), "2 January", "13 mai"},

{LocalePlPL, time.Date(2013, 9, 3, 0, 0, 0, 0, time.UTC), "Mon Jan 2 2006", "Wto Wrz 3 2013"},
{LocalePlPL, time.Date(2013, 9, 4, 0, 0, 0, 0, time.UTC), "Monday Jan 2 2006", "Środa Wrz 4 2013"},
{LocalePlPL, time.Date(2013, 10, 3, 0, 0, 0, 0, time.UTC), "Monday January 02 2006", "Czwartek Październik 03 2013"},
{LocalePlPL, time.Date(2013, 11, 3, 0, 0, 0, 0, time.UTC), "Monday. 2 January 2006", "Niedziela. 3 Listopad 2013"},
{LocalePlPL, time.Date(2013, 5, 13, 0, 0, 0, 0, time.UTC), "2006. 2 January. Monday", "2013. 13 Maj. Poniedziałek"},
{LocalePlPL, time.Date(2013, 5, 13, 0, 0, 0, 0, time.UTC), "2 Jan 2006", "13 Maj 2013"},
{LocalePlPL, time.Date(0, 5, 1, 0, 0, 0, 0, time.UTC), "January", "Maj"},
{LocalePlPL, time.Date(0, 5, 13, 0, 0, 0, 0, time.UTC), "2 January", "13 Maj"},

{LocalePtPT, time.Date(2013, 9, 3, 0, 0, 0, 0, time.UTC), "Mon Jan 2 2006", "ter Set 3 2013"},
{LocalePtPT, time.Date(2013, 9, 4, 0, 0, 0, 0, time.UTC), "Monday Jan 2 2006", "Quarta-feira Set 4 2013"},
{LocalePtPT, time.Date(2013, 10, 3, 0, 0, 0, 0, time.UTC), "Monday January 02 2006", "Quinta-feira Outubro 03 2013"},
Expand Down Expand Up @@ -220,6 +229,22 @@ var formatTests = []FormatTest{
{LocaleZhCN, time.Date(2013, 5, 13, 0, 0, 0, 0, time.UTC), "2006年 January 2日", "2013年 5 月 13日"},
{LocaleZhCN, time.Date(0, 5, 1, 0, 0, 0, 0, time.UTC), "January", "5 月"},

{LocaleZhTW, time.Date(2013, 5, 13, 0, 0, 0, 0, time.UTC), "2006-01-2", "2013-05-13"},
{LocaleZhTW, time.Date(2013, 5, 13, 0, 0, 0, 0, time.UTC), "2006/1/2 Monday", "2013/5/13 星期一"},
{LocaleZhTW, time.Date(2013, 5, 13, 0, 0, 0, 0, time.UTC), "2006年1月2日 Monday", "2013年5月13日 星期一"},
{LocaleZhTW, time.Date(2013, 5, 13, 0, 0, 0, 0, time.UTC), "2006年1月2日", "2013年5月13日"},
{LocaleZhTW, time.Date(2013, 5, 13, 0, 0, 0, 0, time.UTC), "2006年 Jan 2日", "2013年 5 13日"},
{LocaleZhTW, time.Date(2013, 5, 13, 0, 0, 0, 0, time.UTC), "2006年 January 2日", "2013年 5 月 13日"},
{LocaleZhTW, time.Date(0, 5, 1, 0, 0, 0, 0, time.UTC), "January", "5 月"},

{LocaleZhHK, time.Date(2013, 5, 13, 0, 0, 0, 0, time.UTC), "2006-01-2", "2013-05-13"},
{LocaleZhHK, time.Date(2013, 5, 13, 0, 0, 0, 0, time.UTC), "2006/1/2 Monday", "2013/5/13 星期一"},
{LocaleZhHK, time.Date(2013, 5, 13, 0, 0, 0, 0, time.UTC), "2006年1月2日 Monday", "2013年5月13日 星期一"},
{LocaleZhHK, time.Date(2013, 5, 13, 0, 0, 0, 0, time.UTC), "2006年1月2日", "2013年5月13日"},
{LocaleZhHK, time.Date(2013, 5, 13, 0, 0, 0, 0, time.UTC), "2006年 Jan 2日", "2013年 5 13日"},
{LocaleZhHK, time.Date(2013, 5, 13, 0, 0, 0, 0, time.UTC), "2006年 January 2日", "2013年 5 月 13日"},
{LocaleZhHK, time.Date(0, 5, 1, 0, 0, 0, 0, time.UTC), "January", "5 月"},

{LocaleJaJP, time.Date(2013, 5, 13, 0, 0, 0, 0, time.UTC), "2006/01/2", "2013/05/13"},
{LocaleJaJP, time.Date(2013, 5, 13, 0, 0, 0, 0, time.UTC), "2006/1/2 Monday", "2013/5/13 月曜日"},
{LocaleJaJP, time.Date(2013, 5, 13, 10, 30, 0, 0, time.UTC), "2006/1/2 Monday 3:04pm", "2013/5/13 月曜日 10:30午前"},
Expand Down

0 comments on commit 0ec55ec

Please sign in to comment.