Documentation ¶
Overview ¶
Package datesi18n provides internationalization for programs needing language support for weekdays and months. The package is intended to be used with the dates package.
The following code is an example of using the datesi18n package:
import "github.com/mjibson/go-datesi18n" func main() { d := datesi18n.NewDatesI18N("en") fmt.Println(d.Weekdays.Monday) fmt.Println(d.WeekdaysShort.Monday) fmt.Println(d.WeekdaysMin.Monday) fmt.Println(d.Months.January) }
The output of the program is:
Monday Mon M January
Index ¶
- type DatesI18N
- func (d *DatesI18N) DayName(day int) string
- func (d *DatesI18N) DayNumber(day string) int
- func (d *DatesI18N) MinDayName(day int) string
- func (d *DatesI18N) MinDayNumber(day string) int
- func (d *DatesI18N) MonthName(month int) string
- func (d *DatesI18N) MonthNumber(month string) int
- func (d *DatesI18N) ShortDayName(day int) string
- func (d *DatesI18N) ShortDayNumber(day string) int
- func (d *DatesI18N) ShortMonthName(month int) string
- func (d *DatesI18N) ShortMonthNumber(month string) int
- type DatesMonths
- type DatesMonthsShort
- type DatesWeekdays
- type DatesWeekdaysMin
- type DatesWeekdaysShort
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DatesI18N ¶
type DatesI18N struct { Weekdays DatesWeekdays `json:"weekdays"` WeekdaysShort DatesWeekdaysShort `json:"weekdaysshort"` WeekdaysMin DatesWeekdaysMin `json:"weekdaysmin"` Months DatesMonths `json:"months"` MonthsShort DatesMonthsShort `json:"monthsshort"` Language string `json:"language"` }
DatesI18N is a struct that holds the internationalization data for the dates package.
func NewDatesI18N ¶
NewDatesI18N returns a new DatesI18N struct initialized with the language values for the given language
func (*DatesI18N) MinDayName ¶
MinDayName returns the minimal name of the day of the week given by index number.
func (*DatesI18N) MinDayNumber ¶
MinDayNumber returns the number of the day of the week given by minimal name.
func (*DatesI18N) MonthNumber ¶
MonthNumber returns the number of the month given by name.
func (*DatesI18N) ShortDayName ¶
ShortDayName returns the short name of the day of the week given by index number.
func (*DatesI18N) ShortDayNumber ¶
ShortDayNumber returns the number of the day of the week given by short name.
func (*DatesI18N) ShortMonthName ¶
ShortMonthName returns the short name of the month given by index number.
func (*DatesI18N) ShortMonthNumber ¶
ShortMonthNumber returns the number of the month given by short name.
type DatesMonths ¶
type DatesMonths struct { January string `json:"january"` February string `json:"february"` March string `json:"march"` April string `json:"april"` May string `json:"may"` June string `json:"june"` July string `json:"july"` August string `json:"august"` September string `json:"september"` October string `json:"october"` November string `json:"november"` December string `json:"december"` }
DatesMonths is a struct that holds the names of the months.
type DatesMonthsShort ¶
type DatesMonthsShort struct { January string `json:"jan"` February string `json:"feb"` March string `json:"mar"` April string `json:"apr"` May string `json:"may"` June string `json:"jun"` July string `json:"jul"` August string `json:"aug"` September string `json:"sep"` October string `json:"oct"` November string `json:"nov"` December string `json:"dec"` }
DatesMonthsShort is a struct that holds the short names of the months.
type DatesWeekdays ¶
type DatesWeekdays struct { Sunday string `json:"sunday"` Monday string `json:"monday"` Tuesday string `json:"tuesday"` Wednesday string `json:"wednesday"` Thursday string `json:"thursday"` Friday string `json:"friday"` Saturday string `json:"saturday"` }
DatesWeekdays is a struct that holds the names of the weekdays.
type DatesWeekdaysMin ¶
type DatesWeekdaysMin struct { Sunday string `json:"Su"` Monday string `json:"Mo"` Tuesday string `json:"Tu"` Wednesday string `json:"We"` Thursday string `json:"Th"` Friday string `json:"Fr"` Saturday string `json:"Sa"` }
DattesWeekdaysMin is a struct that holds the minimal names of the weekdays.
type DatesWeekdaysShort ¶
type DatesWeekdaysShort struct { Sunday string `json:"sun"` Monday string `json:"mon"` Tuesday string `json:"tue"` Wednesday string `json:"wed"` Thursday string `json:"thu"` Friday string `json:"fri"` Saturday string `json:"sat"` }
DatesWeekdaysShort is a struct that holds the short names of the weekdays.