WeatherKit localization options

I am working on an app that pulls data from weatherKit, including the conditionCode property, the content of which is displayed to the user. I wish to localize the data pulled from weatherKit but when pulling data from:

weatherkit.apple.com/api/v1/weather/de/{latitude}/{longitude}

The conditionCode and other strings is in english. Same is true if the language parameter is set to es, ja or something else.

Am I doing something wrong or is localization yet to be supported in weatherKit? I can't find any documentation on this.

Replies

The condition codes are enumeration values meant for programatic use not user-facing strings. Your app could use this enumeration value and perhaps other relevant fields in the weather response to provide a human-readable description suitable for your users.

  • Is there an equivalent language parameter when using the WeatherKit SDK in swiftui? I'm using the call below in my app: ''' weather = try await weatherService.weather(for: location, including: .daily(startDate: yesterDay , endDate: Date())) ''' This works for English/US users, but some users in other countries (e.g. Germany) are not getting the correct temperature results from this. Is there something I need to add to make this work in each user's location?

Add a Comment

Can the language parameter affect the data returned from weatherKit? How is it used?

I'm confused about this one too... what is the point of the language parameter in the URL if it doesn't do anything?

language string (Required) The language tag to use for localizing responses.

The language parameter does control the language used for localizable, human-readable text in the WeatherKit response. Currently, the weatherAlerts data set includes such localized text and does respect the language parameter. If in the future other data sets include localizable text they will will also respect the language parameter to select the appropriate language.