Search documentation of Localize

# Localize.LanguageTag.Sigil (Localize v0.39.0)

Copy Markdown View Source

Implements a `sigil_l/2` macro for constructing `t:Localize.LanguageTag` structs.

## Summary

### Functions

sigil_l(locale_id, arg2)

Handles sigil `~l` for language tags.

## Functions

# sigil_l(locale_id, arg2)

(macro)

Handles sigil `~l` for language tags.

## Arguments

- `locale_id` is a BCP 47 locale identifier as a string.

## Options

- `u` Will parse the locale but will not add likely subtags or resolve the CLDR locale identifier.

## Returns

- a `Localize.LanguageTag.t/0` struct or

- raises an exception.

## Examples

    iex> import Localize.LanguageTag.Sigil
    iex> tag = ~l(en-US-u-ca-gregory)
    iex> tag.language
    :en

    iex> import Localize.LanguageTag.Sigil
    iex> tag = ~l(en)u
    iex> tag.requested_locale_id
    "en"