2023-07-12 11:28:07 +03:00
<!DOCTYPE html>
< html lang = "en" >
< head >
< meta charset = "utf-8" >
< meta http-equiv = "x-ua-compatible" content = "ie=edge" >
< meta name = "viewport" content = "width=device-width, initial-scale=1.0" >
2024-01-11 10:50:44 +03:00
< meta name = "generator" content = "ExDoc v0.31.0" >
2023-07-12 11:28:07 +03:00
< meta name = "project" content = "Plausible v0.0.1" >
2024-01-11 10:50:44 +03:00
2023-07-12 11:28:07 +03:00
< title > Plausible.Cldr.AcceptLanguage — Plausible v0.0.1< / title >
2024-01-11 10:50:44 +03:00
< link rel = "stylesheet" href = "dist/html-elixir-3ZLIM5JF.css" / >
2023-07-12 11:28:07 +03:00
< script src = "dist/handlebars.runtime-NWIB6V2M.js" > < / script >
2024-01-11 10:50:44 +03:00
< script src = "dist/handlebars.templates-43PMFBC7.js" > < / script >
2024-01-15 18:00:30 +03:00
< script src = "dist/sidebar_items-CF1C204F.js" > < / script >
2023-07-12 11:28:07 +03:00
< script src = "docs_config.js" > < / script >
2024-01-11 10:50:44 +03:00
< script async src = "dist/html-CILPWI2Q.js" > < / script >
2023-07-12 11:28:07 +03:00
< / head >
< body data-type = "modules" class = "page-module" >
< script >
try {
var settings = JSON.parse(localStorage.getItem('ex_doc:settings') || '{}');
if (settings.theme === 'dark' ||
((settings.theme === 'system' || settings.theme == null) & &
window.matchMedia('(prefers-color-scheme: dark)').matches)
) {
document.body.classList.add('dark')
}
} catch (error) { }
< / script >
< div class = "main" >
2024-01-11 10:50:44 +03:00
< button class = "sidebar-button sidebar-toggle" aria-label = "toggle sidebar" aria-controls = "sidebar" >
2023-07-12 11:28:07 +03:00
< i class = "ri-menu-line ri-lg" title = "Collapse/expand sidebar" > < / i >
< / button >
2024-01-11 10:50:44 +03:00
< nav id = "sidebar" class = "sidebar" >
2023-07-12 11:28:07 +03:00
< div class = "sidebar-header" >
2024-01-11 10:50:44 +03:00
< div class = "sidebar-projectInfo" >
2023-07-12 11:28:07 +03:00
2024-01-11 10:50:44 +03:00
< a href = "readme.html" class = "sidebar-projectImage" >
< img src = "assets/logo.png" alt = "Plausible" / >
< / a >
2023-07-12 11:28:07 +03:00
2024-01-11 10:50:44 +03:00
< div >
< a href = "readme.html" class = "sidebar-projectName" translate = "no" >
2023-07-12 11:28:07 +03:00
Plausible
2024-01-11 10:50:44 +03:00
< / a >
< div class = "sidebar-projectVersion" translate = "no" >
v0.0.1
< / div >
2023-07-12 11:28:07 +03:00
< / div >
< / div >
2024-01-11 10:50:44 +03:00
< ul id = "sidebar-listNav" class = "sidebar-listNav" role = "tablist" >
< li >
< button id = "extras-list-tab-button" role = "tab" data-type = "extras" aria-controls = "extras-tab-panel" aria-selected = "true" tabindex = "0" >
Pages
< / button >
< / li >
< li >
< button id = "modules-list-tab-button" role = "tab" data-type = "modules" aria-controls = "modules-tab-panel" aria-selected = "false" tabindex = "-1" >
Modules
< / button >
< / li >
< li >
< button id = "tasks-list-tab-button" role = "tab" data-type = "tasks" aria-controls = "tasks-tab-panel" aria-selected = "false" tabindex = "-1" >
< span translate = "no" > Mix< / span > Tasks
< / button >
< / li >
2023-07-12 11:28:07 +03:00
2024-01-11 10:50:44 +03:00
< / ul >
< / div >
2023-07-12 11:28:07 +03:00
2024-01-11 10:50:44 +03:00
< div id = "extras-tab-panel" class = "sidebar-tabpanel" role = "tabpanel" aria-labelledby = "extras-list-tab-button" >
< ul id = "extras-full-list" class = "full-list" > < / ul >
< / div >
2023-07-12 11:28:07 +03:00
2024-01-11 10:50:44 +03:00
< div id = "modules-tab-panel" class = "sidebar-tabpanel" role = "tabpanel" aria-labelledby = "modules-list-tab-button" hidden >
< ul id = "modules-full-list" class = "full-list" > < / ul >
< / div >
2023-07-12 11:28:07 +03:00
2024-01-11 10:50:44 +03:00
< div id = "tasks-tab-panel" class = "sidebar-tabpanel" role = "tabpanel" aria-labelledby = "tasks-list-tab-button" hidden >
< ul id = "tasks-full-list" class = "full-list" > < / ul >
< / div >
< / nav >
2023-07-12 11:28:07 +03:00
2024-01-11 10:50:44 +03:00
< main class = "content" >
2023-07-12 11:28:07 +03:00
< output role = "status" id = "toast" > < / output >
< div class = "content-outer" >
< div id = "content" class = "content-inner" >
2024-01-11 10:50:44 +03:00
< div class = "top-search" >
< div class = "search-settings" >
< form class = "search-bar" action = "search.html" >
< label class = "search-label" >
< span class = "sr-only" > Search documentation of Plausible< / span >
< input name = "q" type = "text" class = "search-input" placeholder = "Search Documentation (press /)" autocomplete = "off" autocorrect = "off" autocapitalize = "off" spellcheck = "false" / >
< / label >
< button type = "submit" class = "search-button" aria-label = "Submit Search" >
< i class = "ri-search-2-line ri-lg" aria-hidden = "true" title = "Submit search" > < / i >
< / button >
< button type = "button" tabindex = "-1" class = "search-close-button" aria-hidden = "true" >
< i class = "ri-close-line ri-lg" title = "Cancel search" > < / i >
< / button >
< / form >
< button class = "icon-settings display-settings" >
< i class = "ri-settings-3-line" > < / i >
< span class = "sr-only" > Settings< / span >
< / button >
< / div >
< / div >
< div class = "autocomplete" >
< / div >
2023-07-12 11:28:07 +03:00
< h1 >
< a href = "https://github.com/plausible/analytics/blob/main/lib/plausible/cldr.ex#L1" title = "View Source" class = "icon-action" rel = "help" >
< i class = "ri-code-s-slash-line" aria-hidden = "true" > < / i >
< span class = "sr-only" > View Source< / span >
< / a >
< span translate = "no" > Plausible.Cldr.AcceptLanguage< / span >
< small class = "app-vsn" translate = "no" > (Plausible v0.0.1)< / small >
< / h1 >
< section id = "moduledoc" >
< p > Parses HTTP < code class = "inline" > Accept-Language< / code > header values as defined in
< a href = "https://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.4" > rfc2616< / a > .< / p > < p > The Accept-Language request-header field is similar to Accept, but restricts
the set of natural languages that are preferred as a response to the request.
2024-01-11 10:50:44 +03:00
Language tags function are provided in < a href = "https://hexdocs.pm/ex_cldr/2.37.5/Cldr.LanguageTag.html" > < code class = "inline" > Cldr.LanguageTag< / code > < / a > .< / p > < p > The format of an < code class = "inline" > Accept-Language< / code > header is as follows in < code class = "inline" > ABNF< / code > format:< / p > < pre > < code class = "makeup elixir" translate = "no" > < span class = "w" > < / span > < span class = "nc" > Accept< / span > < span class = "o" > -< / span > < span class = "nc" > Language< / span > < span class = "w" > < / span > < span class = "o" > =< / span > < span class = "w" > < / span > < span class = "s" > " Accept-Language" < / span > < span class = "w" > < / span > < span class = "s" > " :" < / span > < span class = "w" >
2023-07-12 11:28:07 +03:00
< / span > < span class = "mi" > 1< / span > < span class = "c1" > #( language-range [ " ;" " q" " =" qvalue ] )< / span > < span class = "w" >
2024-01-16 10:41:12 +03:00
< / span > < span class = "n" > language< / span > < span class = "o" > -< / span > < span class = "n" > range< / span > < span class = "w" > < / span > < span class = "o" > =< / span > < span class = "w" > < / span > < span class = "p" data-group-id = "0317810986-1" > (< / span > < span class = "w" > < / span > < span class = "p" data-group-id = "0317810986-2" > (< / span > < span class = "w" > < / span > < span class = "mi" > 1< / span > < span class = "o" > *< / span > < span class = "mi" > 8< / span > < span class = "nc" > ALPHA< / span > < span class = "w" > < / span > < span class = "o" > *< / span > < span class = "p" data-group-id = "0317810986-3" > (< / span > < span class = "w" > < / span > < span class = "s" > " -" < / span > < span class = "w" > < / span > < span class = "mi" > 1< / span > < span class = "o" > *< / span > < span class = "mi" > 8< / span > < span class = "nc" > ALPHA< / span > < span class = "w" > < / span > < span class = "p" data-group-id = "0317810986-3" > )< / span > < span class = "w" > < / span > < span class = "p" data-group-id = "0317810986-2" > )< / span > < span class = "w" > < / span > < span class = "o" > |< / span > < span class = "w" > < / span > < span class = "s" > " *" < / span > < span class = "w" > < / span > < span class = "p" data-group-id = "0317810986-1" > )< / span > < / code > < / pre > < p > Each language-range MAY be given an associated quality value which represents an
2023-07-12 11:28:07 +03:00
estimate of the user's preference for the languages specified by that range. The
quality value defaults to " q=1" . For example,< / p > < pre > < code class = "makeup elixir" translate = "no" > < span class = "w" > < / span > < span class = "nc" > Accept< / span > < span class = "o" > -< / span > < span class = "ss" > Language< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "n" > da< / span > < span class = "p" > ,< / span > < span class = "w" > < / span > < span class = "n" > en< / span > < span class = "o" > -< / span > < span class = "n" > gb< / span > < span class = "p" > ;< / span > < span class = "n" > q< / span > < span class = "o" > =< / span > < span class = "mf" > 0.8< / span > < span class = "p" > ,< / span > < span class = "w" > < / span > < span class = "n" > en< / span > < span class = "p" > ;< / span > < span class = "n" > q< / span > < span class = "o" > =< / span > < span class = "mf" > 0.7< / span > < / code > < / pre > < p > would mean: " I prefer Danish, but will accept British English and other types of English." < / p >
< / section >
< section id = "summary" class = "details-list" >
< h1 class = "section-heading" >
< a class = "hover-link" href = "#summary" >
< i class = "ri-link-m" aria-hidden = "true" > < / i >
< / a >
2024-01-11 10:50:44 +03:00
< span class = "text" > Summary< / span >
2023-07-12 11:28:07 +03:00
< / h1 >
< div class = "summary-functions summary" >
< h2 >
< a href = "#functions" > Functions< / a >
< / h2 >
< div class = "summary-row" >
< div class = "summary-signature" >
< a href = "#best_match/1" translate = "no" > best_match(accept_language)< / a >
< / div >
< div class = "summary-synopsis" > < p > Parse an < code class = "inline" > Accept-Language< / code > string and return the best match for
2024-01-11 10:50:44 +03:00
a configured < a href = "https://hexdocs.pm/ex_cldr/2.37.5/Cldr.html" > < code class = "inline" > Cldr< / code > < / a > locale.< / p > < / div >
2023-07-12 11:28:07 +03:00
< / div >
< div class = "summary-row" >
< div class = "summary-signature" >
< a href = "#parse/1" translate = "no" > parse(tokens_or_string)< / a >
< / div >
< div class = "summary-synopsis" > < p > Parses an < code class = "inline" > Accept-Language< / code > header value in its string
or tokenized form to return a tuple of the form
< code class = "inline" > {:ok, [{quality, %Cldr.LanguageTag{}}, ...]}< / code > sorted by quality.< / p > < / div >
< / div >
< div class = "summary-row" >
< div class = "summary-signature" >
< a href = "#parse!/1" translate = "no" > parse!(accept_language)< / a >
< / div >
< div class = "summary-synopsis" > < p > Parses an < code class = "inline" > Accept-Language< / code > header value in its string
or tokenized form to produce a list of tuples of the form
< code class = "inline" > [{quality, %Cldr.LanguageTag{}}, ...]< / code > sorted by quality
in descending order.< / p > < / div >
< / div >
< / div >
< / section >
< section id = "functions" class = "details-list" >
< h1 class = "section-heading" >
< a class = "hover-link" href = "#functions" >
< i class = "ri-link-m" aria-hidden = "true" > < / i >
2023-07-25 10:58:48 +03:00
< / a >
2024-01-11 10:50:44 +03:00
< span class = "text" > Functions< / span >
2023-07-12 11:28:07 +03:00
< / h1 >
< div class = "functions-list" >
< section class = "detail" id = "best_match/1" >
< div class = "detail-header" >
< a href = "#best_match/1" class = "detail-link" title = "Link to this function" >
< i class = "ri-link-m" aria-hidden = "true" > < / i >
< span class = "sr-only" > Link to this function< / span >
< / a >
< h1 class = "signature" translate = "no" > best_match(accept_language)< / h1 >
< a href = "https://github.com/plausible/analytics/blob/main/lib/plausible/cldr.ex#L1" class = "icon-action" rel = "help" title = "View Source" >
< i class = "ri-code-s-slash-line" aria-hidden = "true" > < / i >
< span class = "sr-only" > View Source< / span >
< / a >
< / div >
< section class = "docstring" >
< div class = "specs" >
< pre translate = "no" > < span class = "attribute" > @spec< / span > best_match(< a href = "https://hexdocs.pm/elixir/String.html#t:t/0" > String.t< / a > ()) ::
2024-01-11 10:50:44 +03:00
{:ok, < a href = "https://hexdocs.pm/ex_cldr/2.37.5/Cldr.LanguageTag.html#t:t/0" > Cldr.LanguageTag.t< / a > ()}
2023-07-12 11:28:07 +03:00
| {:error, {Cldr.AcceptLanguageError | Cldr.NoMatchingLocale, < a href = "https://hexdocs.pm/elixir/String.html#t:t/0" > String.t< / a > ()}}< / pre >
< / div >
< p > Parse an < code class = "inline" > Accept-Language< / code > string and return the best match for
2024-01-11 10:50:44 +03:00
a configured < a href = "https://hexdocs.pm/ex_cldr/2.37.5/Cldr.html" > < code class = "inline" > Cldr< / code > < / a > locale.< / p > < h2 id = "best_match/1-arguments" class = "section-heading" >
< a href = "#best_match/1-arguments" class = "hover-link" >
2023-07-25 10:58:48 +03:00
< i class = "ri-link-m" aria-hidden = "true" > < / i >
2023-07-12 11:28:07 +03:00
< / a >
2024-01-11 10:50:44 +03:00
< span class = "text" > Arguments< / span >
2023-07-12 11:28:07 +03:00
< / h2 >
< ul > < li > < code class = "inline" > accept_langauge< / code > is a string representing an accept language header< / li > < / ul > < h2 id = "best_match/1-returns" class = "section-heading" >
2024-01-11 10:50:44 +03:00
< a href = "#best_match/1-returns" class = "hover-link" >
2023-07-25 10:58:48 +03:00
< i class = "ri-link-m" aria-hidden = "true" > < / i >
2023-07-12 11:28:07 +03:00
< / a >
2024-01-11 10:50:44 +03:00
< span class = "text" > Returns< / span >
2023-07-12 11:28:07 +03:00
< / h2 >
< ul > < li > < p > < code class = "inline" > {:ok, language_tag}< / code > or< / p > < / li > < li > < p > < code class = "inline" > {:error, reason}< / code > < / p > < / li > < / ul > < h2 id = "best_match/1-examples" class = "section-heading" >
2024-01-11 10:50:44 +03:00
< a href = "#best_match/1-examples" class = "hover-link" >
2023-07-25 10:58:48 +03:00
< i class = "ri-link-m" aria-hidden = "true" > < / i >
2023-07-12 11:28:07 +03:00
< / a >
2024-01-11 10:50:44 +03:00
< span class = "text" > Examples< / span >
2023-07-12 11:28:07 +03:00
< / h2 >
2024-01-16 10:41:12 +03:00
< pre > < code class = "makeup elixir" translate = "no" > < span class = "gp unselectable" > iex> < / span > < span class = "nc" > Plausible.Cldr.AcceptLanguage< / span > < span class = "o" > .< / span > < span class = "n" > best_match< / span > < span class = "p" data-group-id = "3500462777-1" > (< / span > < span class = "s" > " da;q=0.1,zh-TW;q=0.3" < / span > < span class = "p" > ,< / span > < span class = "w" > < / span > < span class = "nc" > TestBackend.Cldr< / span > < span class = "p" data-group-id = "3500462777-1" > )< / span > < span class = "w" >
< / span > < span class = "p" data-group-id = "3500462777-2" > {< / span > < span class = "ss" > :ok< / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "p" data-group-id = "3500462777-3" > %< / span > < span class = "nc" data-group-id = "3500462777-3" > Cldr.LanguageTag< / span > < span class = "p" data-group-id = "3500462777-3" > {< / span > < span class = "w" >
2023-07-12 11:28:07 +03:00
< / span > < span class = "ss" > backend< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "nc" > TestBackend.Cldr< / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "ss" > canonical_locale_name< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "s" > " zh-TW" < / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "ss" > cldr_locale_name< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "ss" > :" zh-Hant" < / span > < span class = "p" > ,< / span > < span class = "w" >
2024-01-16 10:41:12 +03:00
< / span > < span class = "ss" > language_subtags< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "p" data-group-id = "3500462777-4" > [< / span > < span class = "p" data-group-id = "3500462777-4" > ]< / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "ss" > extensions< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "p" data-group-id = "3500462777-5" > %{< / span > < span class = "p" data-group-id = "3500462777-5" > }< / span > < span class = "p" > ,< / span > < span class = "w" >
2023-07-12 11:28:07 +03:00
< / span > < span class = "ss" > gettext_locale_name< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "no" > nil< / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "ss" > language< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "s" > " zh" < / span > < span class = "p" > ,< / span > < span class = "w" >
2024-01-16 10:41:12 +03:00
< / span > < span class = "ss" > locale< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "p" data-group-id = "3500462777-6" > %{< / span > < span class = "p" data-group-id = "3500462777-6" > }< / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "ss" > private_use< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "p" data-group-id = "3500462777-7" > [< / span > < span class = "p" data-group-id = "3500462777-7" > ]< / span > < span class = "p" > ,< / span > < span class = "w" >
2023-07-12 11:28:07 +03:00
< / span > < span class = "ss" > rbnf_locale_name< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "ss" > :" zh-Hant" < / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "ss" > requested_locale_name< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "s" > " zh-TW" < / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "ss" > script< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "ss" > :Hant< / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "ss" > territory< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "ss" > :TW< / span > < span class = "p" > ,< / span > < span class = "w" >
2024-01-16 10:41:12 +03:00
< / span > < span class = "ss" > transform< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "p" data-group-id = "3500462777-8" > %{< / span > < span class = "p" data-group-id = "3500462777-8" > }< / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "ss" > language_variants< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "p" data-group-id = "3500462777-9" > [< / span > < span class = "p" data-group-id = "3500462777-9" > ]< / span > < span class = "w" >
< / span > < span class = "p" data-group-id = "3500462777-3" > }< / span > < span class = "p" data-group-id = "3500462777-2" > }< / span > < span class = "w" >
2023-07-12 11:28:07 +03:00
2024-01-16 10:41:12 +03:00
< / span > < span class = "gp unselectable" > iex> < / span > < span class = "nc" > Plausible.Cldr.AcceptLanguage< / span > < span class = "o" > .< / span > < span class = "n" > best_match< / span > < span class = "p" data-group-id = "3500462777-10" > (< / span > < span class = "s" > " da;q=0.1,zh-TW;q=0.3" < / span > < span class = "p" > ,< / span > < span class = "w" > < / span > < span class = "nc" > TestBackend.Cldr< / span > < span class = "p" data-group-id = "3500462777-10" > )< / span > < span class = "w" >
< / span > < span class = "p" data-group-id = "3500462777-11" > {< / span > < span class = "ss" > :ok< / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "p" data-group-id = "3500462777-12" > %< / span > < span class = "nc" data-group-id = "3500462777-12" > Cldr.LanguageTag< / span > < span class = "p" data-group-id = "3500462777-12" > {< / span > < span class = "w" >
2023-07-12 11:28:07 +03:00
< / span > < span class = "ss" > backend< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "nc" > TestBackend.Cldr< / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "ss" > canonical_locale_name< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "s" > " zh-TW" < / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "ss" > cldr_locale_name< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "ss" > :" zh-Hant" < / span > < span class = "p" > ,< / span > < span class = "w" >
2024-01-16 10:41:12 +03:00
< / span > < span class = "ss" > language_subtags< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "p" data-group-id = "3500462777-13" > [< / span > < span class = "p" data-group-id = "3500462777-13" > ]< / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "ss" > extensions< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "p" data-group-id = "3500462777-14" > %{< / span > < span class = "p" data-group-id = "3500462777-14" > }< / span > < span class = "p" > ,< / span > < span class = "w" >
2023-07-12 11:28:07 +03:00
< / span > < span class = "ss" > gettext_locale_name< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "no" > nil< / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "ss" > language< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "s" > " zh" < / span > < span class = "p" > ,< / span > < span class = "w" >
2024-01-16 10:41:12 +03:00
< / span > < span class = "ss" > locale< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "p" data-group-id = "3500462777-15" > %{< / span > < span class = "p" data-group-id = "3500462777-15" > }< / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "ss" > private_use< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "p" data-group-id = "3500462777-16" > [< / span > < span class = "p" data-group-id = "3500462777-16" > ]< / span > < span class = "p" > ,< / span > < span class = "w" >
2023-07-12 11:28:07 +03:00
< / span > < span class = "ss" > rbnf_locale_name< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "ss" > :" zh-Hant" < / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "ss" > requested_locale_name< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "s" > " zh-TW" < / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "ss" > script< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "ss" > :Hant< / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "ss" > territory< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "ss" > :TW< / span > < span class = "p" > ,< / span > < span class = "w" >
2024-01-16 10:41:12 +03:00
< / span > < span class = "ss" > transform< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "p" data-group-id = "3500462777-17" > %{< / span > < span class = "p" data-group-id = "3500462777-17" > }< / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "ss" > language_variants< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "p" data-group-id = "3500462777-18" > [< / span > < span class = "p" data-group-id = "3500462777-18" > ]< / span > < span class = "w" >
< / span > < span class = "p" data-group-id = "3500462777-12" > }< / span > < span class = "p" data-group-id = "3500462777-11" > }< / span > < span class = "w" >
< / span > < span class = "gp unselectable" > iex> < / span > < span class = "nc" > Plausible.Cldr.AcceptLanguage< / span > < span class = "o" > .< / span > < span class = "n" > best_match< / span > < span class = "p" data-group-id = "3500462777-19" > (< / span > < span class = "s" > " xx,yy;q=0.3" < / span > < span class = "p" data-group-id = "3500462777-19" > )< / span > < span class = "w" >
< / span > < span class = "p" data-group-id = "3500462777-20" > {< / span > < span class = "ss" > :error< / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "p" data-group-id = "3500462777-21" > {< / span > < span class = "nc" > Cldr.NoMatchingLocale< / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "s" > " No configured locale could be matched to < / span > < span class = "se" > \" < / span > < span class = "s" > xx,yy;q=0.3< / span > < span class = "se" > \" < / span > < span class = "s" > " < / span > < span class = "p" data-group-id = "3500462777-21" > }< / span > < span class = "p" data-group-id = "3500462777-20" > }< / span > < span class = "w" >
< / span > < span class = "gp unselectable" > iex> < / span > < span class = "nc" > Plausible.Cldr.AcceptLanguage< / span > < span class = "o" > .< / span > < span class = "n" > best_match< / span > < span class = "p" data-group-id = "3500462777-22" > (< / span > < span class = "s" > " invalid_tag" < / span > < span class = "p" data-group-id = "3500462777-22" > )< / span > < span class = "w" >
< / span > < span class = "p" data-group-id = "3500462777-23" > {< / span > < span class = "ss" > :error< / span > < span class = "p" > ,< / span > < span class = "w" > < / span > < span class = "p" data-group-id = "3500462777-24" > {< / span > < span class = "nc" > Cldr.LanguageTag.ParseError< / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "s" > " Expected a BCP47 language tag. Could not parse the remaining < / span > < span class = "se" > \" < / span > < span class = "s" > g< / span > < span class = "se" > \" < / span > < span class = "s" > starting at position 11" < / span > < span class = "p" data-group-id = "3500462777-24" > }< / span > < span class = "p" data-group-id = "3500462777-23" > }< / span > < / code > < / pre >
2023-07-12 11:28:07 +03:00
< / section >
< / section >
< section class = "detail" id = "parse/1" >
< div class = "detail-header" >
< a href = "#parse/1" class = "detail-link" title = "Link to this function" >
< i class = "ri-link-m" aria-hidden = "true" > < / i >
< span class = "sr-only" > Link to this function< / span >
< / a >
< h1 class = "signature" translate = "no" > parse(tokens_or_string)< / h1 >
< a href = "https://github.com/plausible/analytics/blob/main/lib/plausible/cldr.ex#L1" class = "icon-action" rel = "help" title = "View Source" >
< i class = "ri-code-s-slash-line" aria-hidden = "true" > < / i >
< span class = "sr-only" > View Source< / span >
< / a >
< span class = "note" > (since 2.30.0)< / span >
< / div >
< section class = "docstring" >
< div class = "specs" >
< pre translate = "no" > < span class = "attribute" > @spec< / span > parse([{< a href = "https://hexdocs.pm/elixir/typespecs.html#basic-types" > float< / a > (), < a href = "https://hexdocs.pm/elixir/String.html#t:t/0" > String.t< / a > ()}, ...] | < a href = "https://hexdocs.pm/elixir/String.html#t:t/0" > String.t< / a > ()) ::
{:ok,
[
2024-01-11 10:50:44 +03:00
{< a href = "https://hexdocs.pm/elixir/typespecs.html#basic-types" > float< / a > (), < a href = "https://hexdocs.pm/ex_cldr/2.37.5/Cldr.LanguageTag.html#t:t/0" > Cldr.LanguageTag.t< / a > ()}
2023-07-12 11:28:07 +03:00
| {:error, {Cldr.InvalidLanguageTag, < a href = "https://hexdocs.pm/elixir/String.html#t:t/0" > String.t< / a > ()}},
...
]}
| {:error, {Cldr.AcceptLanguageError, < a href = "https://hexdocs.pm/elixir/String.html#t:t/0" > String.t< / a > ()}}< / pre >
< / div >
< p > Parses an < code class = "inline" > Accept-Language< / code > header value in its string
or tokenized form to return a tuple of the form
< code class = "inline" > {:ok, [{quality, %Cldr.LanguageTag{}}, ...]}< / code > sorted by quality.< / p > < h2 id = "parse/1-arguments" class = "section-heading" >
2024-01-11 10:50:44 +03:00
< a href = "#parse/1-arguments" class = "hover-link" >
2023-07-25 10:58:48 +03:00
< i class = "ri-link-m" aria-hidden = "true" > < / i >
2023-07-12 11:28:07 +03:00
< / a >
2024-01-11 10:50:44 +03:00
< span class = "text" > Arguments< / span >
2023-07-12 11:28:07 +03:00
< / h2 >
< ul > < li > < p > < code class = "inline" > accept-language< / code > is any string in the format defined by
< a href = "https://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.4" > rfc2616< / a > < / p > < / li > < li > < p > < code class = "inline" > backend< / code > is any module that includes < code class = "inline" > use Cldr< / code > and therefore
2024-01-11 10:50:44 +03:00
is a < a href = "https://hexdocs.pm/ex_cldr/2.37.5/Cldr.html" > < code class = "inline" > Cldr< / code > < / a > backend module< / p > < / li > < / ul > < h2 id = "parse/1-returns" class = "section-heading" >
< a href = "#parse/1-returns" class = "hover-link" >
2023-07-25 10:58:48 +03:00
< i class = "ri-link-m" aria-hidden = "true" > < / i >
2023-07-12 11:28:07 +03:00
< / a >
2024-01-11 10:50:44 +03:00
< span class = "text" > Returns< / span >
2023-07-12 11:28:07 +03:00
< / h2 >
< ul > < li > < p > < code class = "inline" > {:ok, [{quality, language_tag}, ...]}< / code > or< / p > < / li > < li > < p > < code class = "inline" > {:error, {Cldr.AcceptLanguageError, String.t}}< / code > < / p > < / li > < / ul > < p > If at least one valid language tag is found but errors are also
detected on one more more tags, an < code class = "inline" > {ok, list}< / code > tuple is returned
wuth an error tuple for each invalid tag added at the end of the list.< / p > < h2 id = "parse/1-example" class = "section-heading" >
2024-01-11 10:50:44 +03:00
< a href = "#parse/1-example" class = "hover-link" >
2023-07-25 10:58:48 +03:00
< i class = "ri-link-m" aria-hidden = "true" > < / i >
2023-07-12 11:28:07 +03:00
< / a >
2024-01-11 10:50:44 +03:00
< span class = "text" > Example< / span >
2023-07-12 11:28:07 +03:00
< / h2 >
2024-01-16 10:41:12 +03:00
< pre > < code class = "makeup elixir" translate = "no" > < span class = "gp unselectable" > iex> < / span > < span class = "nc" > Cldr.AcceptLanguage< / span > < span class = "o" > .< / span > < span class = "n" > parse< / span > < span class = "p" data-group-id = "1387994175-1" > (< / span > < span class = "s" > " da,zh-TW;q=0.3" < / span > < span class = "p" > ,< / span > < span class = "w" > < / span > < span class = "nc" > TestBackend.Cldr< / span > < span class = "p" data-group-id = "1387994175-1" > )< / span > < span class = "w" >
< / span > < span class = "p" data-group-id = "1387994175-2" > {< / span > < span class = "ss" > :ok< / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "p" data-group-id = "1387994175-3" > [< / span > < span class = "w" >
< / span > < span class = "p" data-group-id = "1387994175-4" > {< / span > < span class = "mf" > 1.0< / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "p" data-group-id = "1387994175-5" > %< / span > < span class = "nc" data-group-id = "1387994175-5" > Cldr.LanguageTag< / span > < span class = "p" data-group-id = "1387994175-5" > {< / span > < span class = "w" >
2023-07-12 11:28:07 +03:00
< / span > < span class = "ss" > backend< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "nc" > TestBackend.Cldr< / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "ss" > canonical_locale_name< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "s" > " da" < / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "ss" > cldr_locale_name< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "ss" > :da< / span > < span class = "p" > ,< / span > < span class = "w" >
2024-01-16 10:41:12 +03:00
< / span > < span class = "ss" > language_subtags< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "p" data-group-id = "1387994175-6" > [< / span > < span class = "p" data-group-id = "1387994175-6" > ]< / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "ss" > extensions< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "p" data-group-id = "1387994175-7" > %{< / span > < span class = "p" data-group-id = "1387994175-7" > }< / span > < span class = "p" > ,< / span > < span class = "w" >
2023-07-12 11:28:07 +03:00
< / span > < span class = "ss" > gettext_locale_name< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "no" > nil< / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "ss" > language< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "s" > " da" < / span > < span class = "p" > ,< / span > < span class = "w" >
2024-01-16 10:41:12 +03:00
< / span > < span class = "ss" > locale< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "p" data-group-id = "1387994175-8" > %{< / span > < span class = "p" data-group-id = "1387994175-8" > }< / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "ss" > private_use< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "p" data-group-id = "1387994175-9" > [< / span > < span class = "p" data-group-id = "1387994175-9" > ]< / span > < span class = "p" > ,< / span > < span class = "w" >
2023-07-12 11:28:07 +03:00
< / span > < span class = "ss" > rbnf_locale_name< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "ss" > :da< / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "ss" > requested_locale_name< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "s" > " da" < / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "ss" > script< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "ss" > :Latn< / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "ss" > territory< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "ss" > :DK< / span > < span class = "p" > ,< / span > < span class = "w" >
2024-01-16 10:41:12 +03:00
< / span > < span class = "ss" > transform< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "p" data-group-id = "1387994175-10" > %{< / span > < span class = "p" data-group-id = "1387994175-10" > }< / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "ss" > language_variants< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "p" data-group-id = "1387994175-11" > [< / span > < span class = "p" data-group-id = "1387994175-11" > ]< / span > < span class = "w" >
< / span > < span class = "p" data-group-id = "1387994175-5" > }< / span > < span class = "p" data-group-id = "1387994175-4" > }< / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "p" data-group-id = "1387994175-12" > {< / span > < span class = "mf" > 0.3< / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "p" data-group-id = "1387994175-13" > %< / span > < span class = "nc" data-group-id = "1387994175-13" > Cldr.LanguageTag< / span > < span class = "p" data-group-id = "1387994175-13" > {< / span > < span class = "w" >
2023-07-12 11:28:07 +03:00
< / span > < span class = "ss" > backend< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "nc" > TestBackend.Cldr< / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "ss" > canonical_locale_name< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "s" > " zh-TW" < / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "ss" > cldr_locale_name< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "ss" > :" zh-Hant" < / span > < span class = "p" > ,< / span > < span class = "w" >
2024-01-16 10:41:12 +03:00
< / span > < span class = "ss" > language_subtags< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "p" data-group-id = "1387994175-14" > [< / span > < span class = "p" data-group-id = "1387994175-14" > ]< / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "ss" > extensions< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "p" data-group-id = "1387994175-15" > %{< / span > < span class = "p" data-group-id = "1387994175-15" > }< / span > < span class = "p" > ,< / span > < span class = "w" >
2023-07-12 11:28:07 +03:00
< / span > < span class = "ss" > gettext_locale_name< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "no" > nil< / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "ss" > language< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "s" > " zh" < / span > < span class = "p" > ,< / span > < span class = "w" >
2024-01-16 10:41:12 +03:00
< / span > < span class = "ss" > locale< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "p" data-group-id = "1387994175-16" > %{< / span > < span class = "p" data-group-id = "1387994175-16" > }< / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "ss" > private_use< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "p" data-group-id = "1387994175-17" > [< / span > < span class = "p" data-group-id = "1387994175-17" > ]< / span > < span class = "p" > ,< / span > < span class = "w" >
2023-07-12 11:28:07 +03:00
< / span > < span class = "ss" > rbnf_locale_name< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "ss" > :" zh-Hant" < / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "ss" > requested_locale_name< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "s" > " zh-TW" < / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "ss" > script< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "ss" > :Hant< / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "ss" > territory< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "ss" > :TW< / span > < span class = "p" > ,< / span > < span class = "w" >
2024-01-16 10:41:12 +03:00
< / span > < span class = "ss" > transform< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "p" data-group-id = "1387994175-18" > %{< / span > < span class = "p" data-group-id = "1387994175-18" > }< / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "ss" > language_variants< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "p" data-group-id = "1387994175-19" > [< / span > < span class = "p" data-group-id = "1387994175-19" > ]< / span > < span class = "w" >
< / span > < span class = "p" data-group-id = "1387994175-13" > }< / span > < span class = "p" data-group-id = "1387994175-12" > }< / span > < span class = "w" >
< / span > < span class = "p" data-group-id = "1387994175-3" > ]< / span > < span class = "p" data-group-id = "1387994175-2" > }< / span > < span class = "w" >
< / span > < span class = "gp unselectable" > iex> < / span > < span class = "nc" > Plausible.Cldr.AcceptLanguage< / span > < span class = "o" > .< / span > < span class = "n" > parse< / span > < span class = "p" data-group-id = "1387994175-20" > (< / span > < span class = "s" > " invalid_tag" < / span > < span class = "p" data-group-id = "1387994175-20" > )< / span > < span class = "w" >
< / span > < span class = "p" data-group-id = "1387994175-21" > {< / span > < span class = "ss" > :error< / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "p" data-group-id = "1387994175-22" > {< / span > < span class = "nc" > Cldr.LanguageTag.ParseError< / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "s" > " Expected a BCP47 language tag. Could not parse the remaining < / span > < span class = "se" > \" < / span > < span class = "s" > g< / span > < span class = "se" > \" < / span > < span class = "s" > starting at position 11" < / span > < span class = "p" data-group-id = "1387994175-22" > }< / span > < span class = "p" data-group-id = "1387994175-21" > }< / span > < span class = "w" >
< / span > < span class = "gp unselectable" > iex> < / span > < span class = "nc" > Plausible.Cldr.AcceptLanguage< / span > < span class = "o" > .< / span > < span class = "n" > parse< / span > < span class = "p" data-group-id = "1387994175-23" > (< / span > < span class = "s" > " da,zh-TW;q=0.3,invalid_tag" < / span > < span class = "p" data-group-id = "1387994175-23" > )< / span > < span class = "w" >
< / span > < span class = "p" data-group-id = "1387994175-24" > {< / span > < span class = "ss" > :ok< / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "p" data-group-id = "1387994175-25" > [< / span > < span class = "w" >
< / span > < span class = "p" data-group-id = "1387994175-26" > {< / span > < span class = "mf" > 1.0< / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "p" data-group-id = "1387994175-27" > %< / span > < span class = "nc" data-group-id = "1387994175-27" > Cldr.LanguageTag< / span > < span class = "p" data-group-id = "1387994175-27" > {< / span > < span class = "w" >
2023-07-12 11:28:07 +03:00
< / span > < span class = "ss" > backend< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "nc" > TestBackend.Cldr< / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "ss" > canonical_locale_name< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "s" > " da" < / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "ss" > cldr_locale_name< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "ss" > :da< / span > < span class = "p" > ,< / span > < span class = "w" >
2024-01-16 10:41:12 +03:00
< / span > < span class = "ss" > language_subtags< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "p" data-group-id = "1387994175-28" > [< / span > < span class = "p" data-group-id = "1387994175-28" > ]< / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "ss" > extensions< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "p" data-group-id = "1387994175-29" > %{< / span > < span class = "p" data-group-id = "1387994175-29" > }< / span > < span class = "p" > ,< / span > < span class = "w" >
2023-07-12 11:28:07 +03:00
< / span > < span class = "ss" > gettext_locale_name< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "no" > nil< / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "ss" > language< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "s" > " da" < / span > < span class = "p" > ,< / span > < span class = "w" >
2024-01-16 10:41:12 +03:00
< / span > < span class = "ss" > locale< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "p" data-group-id = "1387994175-30" > %{< / span > < span class = "p" data-group-id = "1387994175-30" > }< / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "ss" > private_use< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "p" data-group-id = "1387994175-31" > [< / span > < span class = "p" data-group-id = "1387994175-31" > ]< / span > < span class = "p" > ,< / span > < span class = "w" >
2023-07-12 11:28:07 +03:00
< / span > < span class = "ss" > rbnf_locale_name< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "ss" > :da< / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "ss" > requested_locale_name< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "s" > " da" < / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "ss" > script< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "ss" > :Latn< / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "ss" > territory< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "ss" > :DK< / span > < span class = "p" > ,< / span > < span class = "w" >
2024-01-16 10:41:12 +03:00
< / span > < span class = "ss" > transform< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "p" data-group-id = "1387994175-32" > %{< / span > < span class = "p" data-group-id = "1387994175-32" > }< / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "ss" > language_variants< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "p" data-group-id = "1387994175-33" > [< / span > < span class = "p" data-group-id = "1387994175-33" > ]< / span > < span class = "w" >
< / span > < span class = "p" data-group-id = "1387994175-27" > }< / span > < span class = "p" data-group-id = "1387994175-26" > }< / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "p" data-group-id = "1387994175-34" > {< / span > < span class = "mf" > 0.3< / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "p" data-group-id = "1387994175-35" > %< / span > < span class = "nc" data-group-id = "1387994175-35" > Cldr.LanguageTag< / span > < span class = "p" data-group-id = "1387994175-35" > {< / span > < span class = "w" >
2023-07-12 11:28:07 +03:00
< / span > < span class = "ss" > backend< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "nc" > TestBackend.Cldr< / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "ss" > canonical_locale_name< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "s" > " zh-TW" < / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "ss" > cldr_locale_name< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "ss" > :" zh-Hant" < / span > < span class = "p" > ,< / span > < span class = "w" >
2024-01-16 10:41:12 +03:00
< / span > < span class = "ss" > language_subtags< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "p" data-group-id = "1387994175-36" > [< / span > < span class = "p" data-group-id = "1387994175-36" > ]< / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "ss" > extensions< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "p" data-group-id = "1387994175-37" > %{< / span > < span class = "p" data-group-id = "1387994175-37" > }< / span > < span class = "p" > ,< / span > < span class = "w" >
2023-07-12 11:28:07 +03:00
< / span > < span class = "ss" > gettext_locale_name< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "no" > nil< / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "ss" > language< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "s" > " zh" < / span > < span class = "p" > ,< / span > < span class = "w" >
2024-01-16 10:41:12 +03:00
< / span > < span class = "ss" > locale< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "p" data-group-id = "1387994175-38" > %{< / span > < span class = "p" data-group-id = "1387994175-38" > }< / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "ss" > private_use< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "p" data-group-id = "1387994175-39" > [< / span > < span class = "p" data-group-id = "1387994175-39" > ]< / span > < span class = "p" > ,< / span > < span class = "w" >
2023-07-12 11:28:07 +03:00
< / span > < span class = "ss" > rbnf_locale_name< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "ss" > :" zh-Hant" < / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "ss" > requested_locale_name< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "s" > " zh-TW" < / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "ss" > script< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "ss" > :Hant< / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "ss" > territory< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "ss" > :TW< / span > < span class = "p" > ,< / span > < span class = "w" >
2024-01-16 10:41:12 +03:00
< / span > < span class = "ss" > transform< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "p" data-group-id = "1387994175-40" > %{< / span > < span class = "p" data-group-id = "1387994175-40" > }< / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "ss" > language_variants< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "p" data-group-id = "1387994175-41" > [< / span > < span class = "p" data-group-id = "1387994175-41" > ]< / span > < span class = "w" >
< / span > < span class = "p" data-group-id = "1387994175-35" > }< / span > < span class = "p" data-group-id = "1387994175-34" > }< / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "p" data-group-id = "1387994175-42" > {< / span > < span class = "ss" > :error< / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "p" data-group-id = "1387994175-43" > {< / span > < span class = "nc" > Cldr.LanguageTag.ParseError< / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "s" > " Expected a BCP47 language tag. Could not parse the remaining < / span > < span class = "se" > \" < / span > < span class = "s" > g< / span > < span class = "se" > \" < / span > < span class = "s" > starting at position 11" < / span > < span class = "p" data-group-id = "1387994175-43" > }< / span > < span class = "p" data-group-id = "1387994175-42" > }< / span > < span class = "w" >
< / span > < span class = "p" data-group-id = "1387994175-25" > ]< / span > < span class = "p" data-group-id = "1387994175-24" > }< / span > < / code > < / pre >
2023-07-12 11:28:07 +03:00
< / section >
< / section >
< section class = "detail" id = "parse!/1" >
< div class = "detail-header" >
< a href = "#parse!/1" class = "detail-link" title = "Link to this function" >
< i class = "ri-link-m" aria-hidden = "true" > < / i >
< span class = "sr-only" > Link to this function< / span >
< / a >
< h1 class = "signature" translate = "no" > parse!(accept_language)< / h1 >
< a href = "https://github.com/plausible/analytics/blob/main/lib/plausible/cldr.ex#L1" class = "icon-action" rel = "help" title = "View Source" >
< i class = "ri-code-s-slash-line" aria-hidden = "true" > < / i >
< span class = "sr-only" > View Source< / span >
< / a >
< / div >
< section class = "docstring" >
< p > Parses an < code class = "inline" > Accept-Language< / code > header value in its string
or tokenized form to produce a list of tuples of the form
< code class = "inline" > [{quality, %Cldr.LanguageTag{}}, ...]< / code > sorted by quality
in descending order.< / p > < h2 id = "parse!/1-arguments" class = "section-heading" >
2024-01-11 10:50:44 +03:00
< a href = "#parse!/1-arguments" class = "hover-link" >
2023-07-25 10:58:48 +03:00
< i class = "ri-link-m" aria-hidden = "true" > < / i >
2023-07-12 11:28:07 +03:00
< / a >
2024-01-11 10:50:44 +03:00
< span class = "text" > Arguments< / span >
2023-07-12 11:28:07 +03:00
< / h2 >
< ul > < li > < code class = "inline" > accept-language< / code > is any string in the format defined by < a href = "https://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.4" > rfc2616< / a > < / li > < / ul > < h2 id = "parse!/1-returns" class = "section-heading" >
2024-01-11 10:50:44 +03:00
< a href = "#parse!/1-returns" class = "hover-link" >
2023-07-25 10:58:48 +03:00
< i class = "ri-link-m" aria-hidden = "true" > < / i >
2023-07-12 11:28:07 +03:00
< / a >
2024-01-11 10:50:44 +03:00
< span class = "text" > Returns< / span >
2023-07-12 11:28:07 +03:00
< / h2 >
2024-01-11 10:50:44 +03:00
< ul > < li > < p > < code class = "inline" > {:ok, [{quality, language_tag}, ...]}< / code > or< / p > < / li > < li > < p > raises a < a href = "https://hexdocs.pm/ex_cldr/2.37.5/Cldr.AcceptLanguageError.html" > < code class = "inline" > Cldr.AcceptLanguageError< / code > < / a > exception< / p > < / li > < / ul > < p > If at least one valid language tag is found but errors are also
2023-07-12 11:28:07 +03:00
detected on one more more tags, an < code class = "inline" > {ok, list}< / code > tuple is returned
wuth an error tuple for each invalid tag added at the end of the list.< / p > < h2 id = "parse!/1-example" class = "section-heading" >
2024-01-11 10:50:44 +03:00
< a href = "#parse!/1-example" class = "hover-link" >
2023-07-25 10:58:48 +03:00
< i class = "ri-link-m" aria-hidden = "true" > < / i >
2023-07-12 11:28:07 +03:00
< / a >
2024-01-11 10:50:44 +03:00
< span class = "text" > Example< / span >
2023-07-12 11:28:07 +03:00
< / h2 >
2024-01-16 10:41:12 +03:00
< pre > < code class = "makeup elixir" translate = "no" > < span class = "gp unselectable" > iex> < / span > < span class = "nc" > Plausible.Cldr.AcceptLanguage< / span > < span class = "o" > .< / span > < span class = "n" > parse!< / span > < span class = "p" data-group-id = "3641973297-1" > (< / span > < span class = "s" > " da,zh-TW;q=0.3" < / span > < span class = "p" data-group-id = "3641973297-1" > )< / span > < span class = "w" >
< / span > < span class = "p" data-group-id = "3641973297-2" > [< / span > < span class = "w" >
< / span > < span class = "p" data-group-id = "3641973297-3" > {< / span > < span class = "mf" > 1.0< / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "p" data-group-id = "3641973297-4" > %< / span > < span class = "nc" data-group-id = "3641973297-4" > Cldr.LanguageTag< / span > < span class = "p" data-group-id = "3641973297-4" > {< / span > < span class = "w" >
2023-07-12 11:28:07 +03:00
< / span > < span class = "ss" > backend< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "nc" > TestBackend.Cldr< / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "ss" > canonical_locale_name< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "s" > " da" < / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "ss" > cldr_locale_name< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "ss" > :da< / span > < span class = "p" > ,< / span > < span class = "w" >
2024-01-16 10:41:12 +03:00
< / span > < span class = "ss" > language_subtags< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "p" data-group-id = "3641973297-5" > [< / span > < span class = "p" data-group-id = "3641973297-5" > ]< / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "ss" > extensions< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "p" data-group-id = "3641973297-6" > %{< / span > < span class = "p" data-group-id = "3641973297-6" > }< / span > < span class = "p" > ,< / span > < span class = "w" >
2023-07-12 11:28:07 +03:00
< / span > < span class = "ss" > gettext_locale_name< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "no" > nil< / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "ss" > language< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "s" > " da" < / span > < span class = "p" > ,< / span > < span class = "w" >
2024-01-16 10:41:12 +03:00
< / span > < span class = "ss" > locale< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "p" data-group-id = "3641973297-7" > %{< / span > < span class = "p" data-group-id = "3641973297-7" > }< / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "ss" > private_use< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "p" data-group-id = "3641973297-8" > [< / span > < span class = "p" data-group-id = "3641973297-8" > ]< / span > < span class = "p" > ,< / span > < span class = "w" >
2023-07-12 11:28:07 +03:00
< / span > < span class = "ss" > rbnf_locale_name< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "ss" > :da< / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "ss" > requested_locale_name< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "s" > " da" < / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "ss" > script< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "ss" > :Latn< / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "ss" > territory< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "ss" > :DK< / span > < span class = "p" > ,< / span > < span class = "w" >
2024-01-16 10:41:12 +03:00
< / span > < span class = "ss" > transform< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "p" data-group-id = "3641973297-9" > %{< / span > < span class = "p" data-group-id = "3641973297-9" > }< / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "ss" > language_variants< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "p" data-group-id = "3641973297-10" > [< / span > < span class = "p" data-group-id = "3641973297-10" > ]< / span > < span class = "w" >
< / span > < span class = "p" data-group-id = "3641973297-4" > }< / span > < span class = "p" data-group-id = "3641973297-3" > }< / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "p" data-group-id = "3641973297-11" > {< / span > < span class = "mf" > 0.3< / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "p" data-group-id = "3641973297-12" > %< / span > < span class = "nc" data-group-id = "3641973297-12" > Cldr.LanguageTag< / span > < span class = "p" data-group-id = "3641973297-12" > {< / span > < span class = "w" >
2023-07-12 11:28:07 +03:00
< / span > < span class = "ss" > backend< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "nc" > TestBackend.Cldr< / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "ss" > canonical_locale_name< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "s" > " zh-TW" < / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "ss" > cldr_locale_name< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "ss" > :" zh-Hant" < / span > < span class = "p" > ,< / span > < span class = "w" >
2024-01-16 10:41:12 +03:00
< / span > < span class = "ss" > language_subtags< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "p" data-group-id = "3641973297-13" > [< / span > < span class = "p" data-group-id = "3641973297-13" > ]< / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "ss" > extensions< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "p" data-group-id = "3641973297-14" > %{< / span > < span class = "p" data-group-id = "3641973297-14" > }< / span > < span class = "p" > ,< / span > < span class = "w" >
2023-07-12 11:28:07 +03:00
< / span > < span class = "ss" > gettext_locale_name< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "no" > nil< / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "ss" > language< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "s" > " zh" < / span > < span class = "p" > ,< / span > < span class = "w" >
2024-01-16 10:41:12 +03:00
< / span > < span class = "ss" > locale< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "p" data-group-id = "3641973297-15" > %{< / span > < span class = "p" data-group-id = "3641973297-15" > }< / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "ss" > private_use< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "p" data-group-id = "3641973297-16" > [< / span > < span class = "p" data-group-id = "3641973297-16" > ]< / span > < span class = "p" > ,< / span > < span class = "w" >
2023-07-12 11:28:07 +03:00
< / span > < span class = "ss" > rbnf_locale_name< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "ss" > :" zh-Hant" < / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "ss" > requested_locale_name< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "s" > " zh-TW" < / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "ss" > script< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "ss" > :Hant< / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "ss" > territory< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "ss" > :TW< / span > < span class = "p" > ,< / span > < span class = "w" >
2024-01-16 10:41:12 +03:00
< / span > < span class = "ss" > transform< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "p" data-group-id = "3641973297-17" > %{< / span > < span class = "p" data-group-id = "3641973297-17" > }< / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "ss" > language_variants< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "p" data-group-id = "3641973297-18" > [< / span > < span class = "p" data-group-id = "3641973297-18" > ]< / span > < span class = "w" >
< / span > < span class = "p" data-group-id = "3641973297-12" > }< / span > < span class = "p" data-group-id = "3641973297-11" > }< / span > < span class = "w" >
< / span > < span class = "p" data-group-id = "3641973297-2" > ]< / span > < span class = "w" >
2023-07-12 11:28:07 +03:00
< / span > < span class = "nc" > Plausible.Cldr.AcceptLanguage< / span > < span class = "o" > .< / span > < span class = "n" > parse!< / span > < span class = "w" > < / span > < span class = "s" > " invalid_tag" < / span > < span class = "w" >
< / span > < span class = "gt" > ** (Cldr.AcceptLanguageError) " Expected a BCP47 language tag. Could not parse the remaining " g" starting at position 11
(ex_cldr) lib/cldr/accept_language.ex:304: Cldr.AcceptLanguage.parse!/1< / span > < span class = "w" >
2024-01-16 10:41:12 +03:00
< / span > < span class = "gp unselectable" > iex> < / span > < span class = "nc" > Plausible.Cldr.AcceptLanguage< / span > < span class = "o" > .< / span > < span class = "n" > parse!< / span > < span class = "p" data-group-id = "3641973297-19" > (< / span > < span class = "s" > " da,zh-TW;q=0.3,invalid_tag" < / span > < span class = "p" data-group-id = "3641973297-19" > )< / span > < span class = "w" >
< / span > < span class = "p" data-group-id = "3641973297-20" > [< / span > < span class = "w" >
< / span > < span class = "p" data-group-id = "3641973297-21" > {< / span > < span class = "mf" > 1.0< / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "p" data-group-id = "3641973297-22" > %< / span > < span class = "nc" data-group-id = "3641973297-22" > Cldr.LanguageTag< / span > < span class = "p" data-group-id = "3641973297-22" > {< / span > < span class = "w" >
2023-07-12 11:28:07 +03:00
< / span > < span class = "ss" > backend< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "nc" > TestBackend.Cldr< / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "ss" > canonical_locale_name< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "s" > " da" < / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "ss" > cldr_locale_name< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "ss" > :da< / span > < span class = "p" > ,< / span > < span class = "w" >
2024-01-16 10:41:12 +03:00
< / span > < span class = "ss" > language_subtags< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "p" data-group-id = "3641973297-23" > [< / span > < span class = "p" data-group-id = "3641973297-23" > ]< / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "ss" > extensions< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "p" data-group-id = "3641973297-24" > %{< / span > < span class = "p" data-group-id = "3641973297-24" > }< / span > < span class = "p" > ,< / span > < span class = "w" >
2023-07-12 11:28:07 +03:00
< / span > < span class = "ss" > gettext_locale_name< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "no" > nil< / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "ss" > language< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "s" > " da" < / span > < span class = "p" > ,< / span > < span class = "w" >
2024-01-16 10:41:12 +03:00
< / span > < span class = "ss" > locale< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "p" data-group-id = "3641973297-25" > %{< / span > < span class = "p" data-group-id = "3641973297-25" > }< / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "ss" > private_use< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "p" data-group-id = "3641973297-26" > [< / span > < span class = "p" data-group-id = "3641973297-26" > ]< / span > < span class = "p" > ,< / span > < span class = "w" >
2023-07-12 11:28:07 +03:00
< / span > < span class = "ss" > rbnf_locale_name< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "ss" > :da< / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "ss" > requested_locale_name< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "s" > " da" < / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "ss" > script< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "ss" > :Latn< / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "ss" > territory< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "ss" > :DK< / span > < span class = "p" > ,< / span > < span class = "w" >
2024-01-16 10:41:12 +03:00
< / span > < span class = "ss" > transform< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "p" data-group-id = "3641973297-27" > %{< / span > < span class = "p" data-group-id = "3641973297-27" > }< / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "ss" > language_variants< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "p" data-group-id = "3641973297-28" > [< / span > < span class = "p" data-group-id = "3641973297-28" > ]< / span > < span class = "w" >
< / span > < span class = "p" data-group-id = "3641973297-22" > }< / span > < span class = "p" data-group-id = "3641973297-21" > }< / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "p" data-group-id = "3641973297-29" > {< / span > < span class = "mf" > 0.3< / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "p" data-group-id = "3641973297-30" > %< / span > < span class = "nc" data-group-id = "3641973297-30" > Cldr.LanguageTag< / span > < span class = "p" data-group-id = "3641973297-30" > {< / span > < span class = "w" >
2023-07-12 11:28:07 +03:00
< / span > < span class = "ss" > backend< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "nc" > TestBackend.Cldr< / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "ss" > canonical_locale_name< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "s" > " zh-TW" < / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "ss" > cldr_locale_name< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "ss" > :" zh-Hant" < / span > < span class = "p" > ,< / span > < span class = "w" >
2024-01-16 10:41:12 +03:00
< / span > < span class = "ss" > language_subtags< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "p" data-group-id = "3641973297-31" > [< / span > < span class = "p" data-group-id = "3641973297-31" > ]< / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "ss" > extensions< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "p" data-group-id = "3641973297-32" > %{< / span > < span class = "p" data-group-id = "3641973297-32" > }< / span > < span class = "p" > ,< / span > < span class = "w" >
2023-07-12 11:28:07 +03:00
< / span > < span class = "ss" > gettext_locale_name< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "no" > nil< / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "ss" > language< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "s" > " zh" < / span > < span class = "p" > ,< / span > < span class = "w" >
2024-01-16 10:41:12 +03:00
< / span > < span class = "ss" > locale< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "p" data-group-id = "3641973297-33" > %{< / span > < span class = "p" data-group-id = "3641973297-33" > }< / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "ss" > private_use< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "p" data-group-id = "3641973297-34" > [< / span > < span class = "p" data-group-id = "3641973297-34" > ]< / span > < span class = "p" > ,< / span > < span class = "w" >
2023-07-12 11:28:07 +03:00
< / span > < span class = "ss" > rbnf_locale_name< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "ss" > :" zh-Hant" < / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "ss" > requested_locale_name< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "s" > " zh-TW" < / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "ss" > script< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "ss" > :Hant< / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "ss" > territory< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "ss" > :TW< / span > < span class = "p" > ,< / span > < span class = "w" >
2024-01-16 10:41:12 +03:00
< / span > < span class = "ss" > transform< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "p" data-group-id = "3641973297-35" > %{< / span > < span class = "p" data-group-id = "3641973297-35" > }< / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "ss" > language_variants< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "p" data-group-id = "3641973297-36" > [< / span > < span class = "p" data-group-id = "3641973297-36" > ]< / span > < span class = "w" >
< / span > < span class = "p" data-group-id = "3641973297-30" > }< / span > < span class = "p" data-group-id = "3641973297-29" > }< / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "p" data-group-id = "3641973297-37" > {< / span > < span class = "ss" > :error< / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "p" data-group-id = "3641973297-38" > {< / span > < span class = "nc" > Cldr.LanguageTag.ParseError< / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "s" > " Expected a BCP47 language tag. Could not parse the remaining < / span > < span class = "se" > \" < / span > < span class = "s" > g< / span > < span class = "se" > \" < / span > < span class = "s" > starting at position 11" < / span > < span class = "p" data-group-id = "3641973297-38" > }< / span > < span class = "p" data-group-id = "3641973297-37" > }< / span > < span class = "w" >
< / span > < span class = "p" data-group-id = "3641973297-20" > ]< / span > < / code > < / pre >
2023-07-12 11:28:07 +03:00
< / section >
< / section >
< / div >
< / section >
< footer class = "footer" >
< p >
< span class = "line" >
< button class = "a-main footer-button display-quick-switch" title = "Search HexDocs packages" >
Search HexDocs
< / button >
< a href = "Plausible.epub" title = "ePub version" >
Download ePub version
< / a >
< / span >
< / p >
< p class = "built-using" >
Built using
2024-01-11 10:50:44 +03:00
< a href = "https://github.com/elixir-lang/ex_doc" title = "ExDoc" target = "_blank" rel = "help noopener" translate = "no" > ExDoc< / a > (v0.31.0) for the
2023-07-12 11:28:07 +03:00
< a href = "https://elixir-lang.org" title = "Elixir" target = "_blank" translate = "no" > Elixir programming language< / a >
< / p >
< / footer >
< / div >
< / div >
2024-01-11 10:50:44 +03:00
< / main >
2023-07-12 11:28:07 +03:00
< / div >
< script src = "https://cdn.jsdelivr.net/npm/mermaid/dist/mermaid.min.js" > < / script >
< script > mermaid . initialize ( { startOnLoad : true } ) < / script >
< / body >
< / html >