View Source Apple.WeatherKit.I18n (apple_weather_kit v0.4.3)

Provides utilities for i18n.

Summary

Functions

Gets the localized name of an condition code.

Types

@type condition_code() :: String.t()
@type locale() :: String.t()

Functions

Link to this function

condition_name(arg1, arg2)

View Source
@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