Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor/chinese taiwan language #28

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 55 additions & 0 deletions format_th_th.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
package monday

// ============================================================
// Format rules for "th_TH" locale: Thai (Thailand)
// ============================================================

var longDayNamesThTH = map[string]string{
"Sunday": "อาทิตย์",
"Monday": "จันทร์",
"Tuesday": "อังคาร",
"Wednesday": "พุธ",
"Thursday": "พฤหัสบดี",
"Friday": "ศุกร์",
"Saturday": "เสาร์",
}

var shortDayNamesThTH = map[string]string{
"Sun": "อา",
"Mon": "จ",
"Tue": "อ",
"Wed": "พ",
"Thu": "พฤ",
"Fri": "ศ",
"Sat": "ส",
}

var longMonthNamesThTH = map[string]string{
"January": "มกราคม",
"February": "กุมภาพันธ์",
"March": "มีนาคม",
"April": "เมษายน",
"May": "พฤษภาคม",
"June": "มิถุนายน",
"July": "กรกฎาคม",
"August": "สิงหาคม",
"September": "กันยายน",
"October": "ตุลาคม",
"November": "พฤศจิกายน",
"December": "ธันวาคม",
}

var shortMonthNamesThTH = map[string]string{
"Jan": "ม.ค.",
"Feb": "ก.พ.",
"Mar": "มี.ค.",
"Apr": "เม.ย.",
"May": "พ.ค.",
"Jun": "มิ.ย.",
"Jul": "ก.ค.",
"Aug": "ส.ค.",
"Sep": "ก.ย.",
"Oct": "ต.ค.",
"Nov": "พ.ย.",
"Dec": "ธ.ค.",
}
24 changes: 12 additions & 12 deletions format_zh_tw.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,18 @@ var shortDayNamesZhTW = map[string]string{
}

var longMonthNamesZhTW = map[string]string{
"January": "1 月",
"February": "2 月",
"March": "3 月",
"April": "4 月",
"May": "5 月",
"June": "6 月",
"July": "7 月",
"August": "8 月",
"September": "9 月",
"October": "10 月",
"November": "11 月",
"December": "12 月",
"January": "一月",
"February": "二月",
"March": "三月",
"April": "四月",
"May": "五月",
"June": "六月",
"July": "七月",
"August": "八月",
"September": "九月",
"October": "十月",
"November": "十一月",
"December": "十二月",
}

var shortMonthNamesZhTW = map[string]string{
Expand Down
4 changes: 2 additions & 2 deletions locale.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ const (
LocaleFrRE = "fr_RE" // French (Reunion)
LocaleFrGF = "fr_GF" // French (French Guiana)
LocaleCsCZ = "cs_CZ" // Czech (Czech Republic)
LocaleSlSI = "sl_SI" // Slovenian (Slovenia)
LocaleThTH = "th_TH" // Thai (Thailand)
)

// ListLocales returns all locales supported by the package.
Expand Down Expand Up @@ -80,6 +80,6 @@ func ListLocales() []Locale {
LocaleFrRE,
LocaleFrGF,
LocaleCsCZ,
LocaleSlSI,
LocaleThTH,
}
}
14 changes: 7 additions & 7 deletions monday.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ var internalFormatFuncs = map[Locale]internalFormatFunc{
LocaleElGR: createCommonFormatFuncWithGenitive(LocaleElGR),
LocaleIdID: createCommonFormatFunc(LocaleIdID),
LocaleCsCZ: createCommonFormatFunc(LocaleCsCZ),
LocaleSlSI: createCommonFormatFunc(LocaleSlSI),
LocaleThTH: createCommonFormatFunc(LocaleThTH),
}

// internalParseFunc is a preprocessor for default time.ParseInLocation func
Expand Down Expand Up @@ -86,7 +86,7 @@ var internalParseFuncs = map[Locale]internalParseFunc{
LocaleElGR: createCommonParsetFuncWithGenitive(LocaleElGR),
LocaleIdID: createCommonParseFunc(LocaleIdID),
LocaleCsCZ: createCommonParseFunc(LocaleCsCZ),
LocaleSlSI: createCommonParseFunc(LocaleSlSI),
LocaleThTH: createCommonParseFunc(LocaleThTH),
}

var knownDaysShort = map[Locale]map[string]string{} // Mapping for 'Format', days of week, short form
Expand Down Expand Up @@ -331,11 +331,11 @@ func fillKnownWords() {
fillKnownMonthsLong(longMonthNamesCsCZ, LocaleCsCZ)
fillKnownMonthsShort(shortMonthNamesCsCZ, LocaleCsCZ)

// Sl_SI: Slovenian (Slovenia)
fillKnownDaysLong(longDayNamesSlSI, LocaleSlSI)
fillKnownDaysShort(shortDayNamesSlSI, LocaleSlSI)
fillKnownMonthsLong(longMonthNamesSlSI, LocaleSlSI)
fillKnownMonthsShort(shortMonthNamesSlSI, LocaleSlSI)
// Th_TH: Thai (Thailand)
fillKnownDaysLong(longDayNamesThTH, LocaleThTH)
fillKnownDaysShort(shortDayNamesThTH, LocaleThTH)
fillKnownMonthsLong(longMonthNamesThTH, LocaleThTH)
fillKnownMonthsShort(shortMonthNamesThTH, LocaleThTH)
}

func fill(src map[string]string, dest map[Locale]map[string]string, locale Locale) {
Expand Down