standardize macrons

This commit is contained in:
Daniel Mason 2022-01-17 16:25:26 +13:00
parent 28c8a31643
commit 07d0e82dff
3 changed files with 15 additions and 2 deletions

View file

@ -102,7 +102,8 @@ func getNewAPILocations() {
if strings.Contains(strings.ToLower(item.PublicAdvice), "omicron") {
copy.EventName = copy.EventName + " (Omicron)"
}
newItems[item.Location.City] = append(newItems[item.Location.City], copy)
locationParse := parseCity(item.Location.City)
newItems[locationParse] = append(newItems[locationParse], copy)
// Always keep the latest
if item.PublishedAt.After(newUpdatedTime) {
@ -113,7 +114,8 @@ func getNewAPILocations() {
copy := item
// Apend Omicron if Omicron in advice
copy.EventName = copy.EventName + " (Omicron)"
newItems[item.Location.City] = append(newItems[item.Location.City], copy)
locationParse := parseCity(item.Location.City)
newItems[locationParse] = append(newItems[locationParse], copy)
// Always keep the latest
if item.UpdatedAt.After(newUpdatedTime) {
@ -198,3 +200,12 @@ func getDaySuffix(t time.Time) string {
}
return suffix
}
func parseCity(c string) string {
switch city := c; city {
case "Whangarei":
return "Whangārei"
default:
return city
}
}