mirror of
https://github.com/Luzifer/go-holidays.git
synced 2024-12-25 13:21:17 +00:00
Allow to query localized name
Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
parent
3307a07901
commit
c361e5ea47
1 changed files with 7 additions and 1 deletions
|
@ -65,6 +65,7 @@ func handleHolidays(res http.ResponseWriter, r *http.Request) {
|
|||
var (
|
||||
countryCode = vars["country-code"]
|
||||
format = vars["format"]
|
||||
locale = r.FormValue("locale")
|
||||
year = time.Now().Year()
|
||||
)
|
||||
|
||||
|
@ -99,8 +100,13 @@ func handleHolidays(res http.ResponseWriter, r *http.Request) {
|
|||
case "ics":
|
||||
cal := iCalendar{}
|
||||
for _, h := range outputSet {
|
||||
name := h.Name
|
||||
if h.LocalizedName != nil && h.LocalizedName[locale] != "" {
|
||||
name = h.LocalizedName[locale]
|
||||
}
|
||||
|
||||
cal.Events = append(cal.Events, iCalendarEvent{
|
||||
Summary: h.Name,
|
||||
Summary: name,
|
||||
Date: h.ParsedDate,
|
||||
UID: fmt.Sprintf("%s_%s@hoiday-api.fyi", countryCode, h.ParsedDate.Format("20060102")),
|
||||
})
|
||||
|
|
Loading…
Reference in a new issue