谷歌日历本地化

时间:2018-03-23 08:22:13

标签: json google-api localization google-calendar-api

我正在尝试使用谷歌假日日历API使用以下网址获取当地语言中不同国家/地区的事件列表,但我仍然使用默认语言英语获取事件列表。

url = 'https://www.googleapis.com/calendar/v3/calendars/malaysia__mu@holiday.calendar.google.com/events?key=mykey&
timeMin=2018-03-18T00:00:00Z&timeMax=2018-12-01T00:00:00Z&maxResults=24&orderBy=startTime&singleEvents=true

回应:

[{"event": "Easter Sunday", "date_start": "2018-04-01", "date_end": "2018-04-02"}, {"event": "Isra and Mi'raj", "date_start": "2018-04-13", "date_end": "2018-04-14"}, {"event": "Labour Day", "date_start": "2018-05-01", "date_end": "2018-05-02"}, {"event": "Ramadan begins", "date_start": "2018-05-16", "date_end": "2018-05-17"}, {"event": "Wesak Day", "date_start": "2018-05-29", "date_end": "2018-05-30"}, {"event": "Harvest Festival", "date_start": "2018-05-30", "date_end": "2018-05-31"}, {"event": "Harvest Festival Day 2", "date_start": "2018-05-31", "date_end": "2018-06-01"}, {"event": "Hari Raya Puasa Day 1", "date_start": "2018-06-15", "date_end": "2018-06-16"}, {"event": "Hari Raya Puasa Day 2", "date_start": "2018-06-16", "date_end": "2018-06-17"}, {"event": "Georgetown World Heritage City Day", "date_start": "2018-07-07", "date_end": "2018-07-08"}, {"event": "Penang Governor's Birthday", "date_start": "2018-07-14", "date_end": "2018-07-15"}, {"event": "Hari Raya Haji", "date_start": "2018-08-22", "date_end": "2018-08-23"}, {"event": "Malaysia's National Day", "date_start": "2018-08-31", "date_end": "2018-09-01"}, {"event": "The Yang di-Pertuan Agong's Birthday", "date_start": "2018-09-08", "date_end": "2018-09-09"}, {"event": "Muharram/New Year", "date_start": "2018-09-11", "date_end": "2018-09-12"}, {"event": "Malaysia Day", "date_start": "2018-09-16", "date_end": "2018-09-17"}]

事件不是马来语 谁可以在这方面发挥领导作用?

1 个答案:

答案 0 :(得分:1)

Google日历会以其所拥有的语言(通常为英语)返回数据。它不支持以任何其他语言返回数据。

当数据返回给您时,您可以将其翻译成您选择的语言。