View Source Apple.WeatherKit.I18n (apple_weather_kit v0.2.1)
Provides utilities for i18n.
Summary
Functions
Gets the localized name of an condition code.
Types
Functions
@spec condition_name(condition_code(), locale()) :: {:ok, String.t()} | :error
Gets the localized name of an condition code.
Currently, only limited locales (
"en"
,"zh-Hans"
,"zh-Hant"
) are supported, If you want to get support for more locales, or improve the existing locales, consider to contribute.
Examples
iex> Apple.WeatherKit.I18n.condition_name("MostlyCloudy", "en")
{:ok, "Mostly Cloudy"}
iex> Apple.WeatherKit.I18n.condition_name("MostlyCloudy", "zh-Hans")
{:ok, "大部多云"}
iex> Apple.WeatherKit.I18n.condition_name("unknown condition code", "en")
:error
iex> Apple.WeatherKit.I18n.condition_name("MostlyCloudy", "unknown locale")
:error