Cldr v0.12.2 Cldr.LanguageTag.Parser View Source

Parses a CLDR language tag (also referred to as locale string).

The applicable specification is from CLDR which is similar based upon RFC5646 with some variations.

This module provides functions to parse a language tag (locale string). To be consistent with the rest of Cldr, the term locale string will be preferred.

Link to this section Summary

Functions

Parse a locale name into a Cldr.LanguageTag.t

Parse a locale name into a Cldr.LanguageTag.t

Link to this section Functions

Link to this function parse(locale_name) View Source
parse(Locale.locale_name() | charlist()) ::
  {:ok, Cldr.LanguageTag.t()} |
  {:error, {Exception.t(), String.t()}}

Parse a locale name into a Cldr.LanguageTag.t

  • locale_name is a string representation of a language tag as defined by RFC5646

Returns

  • {:ok, language_tag} or

  • {:error, reasons}

Parse a locale name into a Cldr.LanguageTag.t

  • locale_name is a string representation of a language tag as defined by RFC5646

Returns

  • language_tag or

  • raises an exception