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-16 10:41:49 +03:00
< meta name = "generator" content = "ExDoc v0.31.1" >
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.Currency — Plausible v0.0.1< / title >
2024-01-16 10:41:49 +03:00
< link rel = "stylesheet" href = "dist/html-elixir-FM2CSD74.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-06-03 13:29:48 +03:00
< script src = "dist/sidebar_items-04905ADA.js" > < / script >
2023-07-12 11:28:07 +03:00
< script src = "docs_config.js" > < / script >
2024-01-16 10:41:49 +03:00
< script async src = "dist/html-L4O5OK2K.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-16 10:41:49 +03:00
< button id = "sidebar-menu" 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-16 10:41:49 +03:00
< div class = "background-layer" > < / div >
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 >
2024-01-16 10:41:49 +03:00
< div class = "autocomplete" >
< / div >
2024-01-11 10:50:44 +03:00
< button class = "icon-settings display-settings" >
< i class = "ri-settings-3-line" > < / i >
< span class = "sr-only" > Settings< / span >
< / button >
< / div >
2024-01-16 10:41:49 +03:00
2024-01-11 10:50:44 +03:00
< / 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.Currency< / span >
< small class = "app-vsn" translate = "no" > (Plausible v0.0.1)< / small >
< / h1 >
< 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 = "#currencies_for_locale/3" translate = "no" > currencies_for_locale(locale, only \\ :all, except \\ nil)< / a >
< / div >
< div class = "summary-synopsis" > < p > Returns a map of the metadata for all currencies for
a given locale.< / p > < / div >
< / div >
< div class = "summary-row" >
< div class = "summary-signature" >
< a href = "#currencies_for_locale!/3" translate = "no" > currencies_for_locale!(locale, only \\ :all, except \\ nil)< / a >
< / div >
< div class = "summary-synopsis" > < p > Returns a map of the metadata for all currencies for
a given locale and raises on error.< / p > < / div >
< / div >
< div class = "summary-row" >
< div class = "summary-signature" >
< a href = "#currency_for_code/2" translate = "no" > currency_for_code(currency_or_currency_code, options \\ [locale: Plausible.Cldr.default_locale()])< / a >
< / div >
< div class = "summary-synopsis" > < p > Returns the currency metadata for the requested currency code.< / p > < / div >
< / div >
< div class = "summary-row" >
< div class = "summary-signature" >
< a href = "#currency_for_code!/2" translate = "no" > currency_for_code!(currency_or_currency_code, options \\ [locale: Plausible.Cldr.default_locale()])< / a >
< / div >
< div class = "summary-synopsis" > < p > Returns the currency metadata for the requested currency code.< / p > < / div >
< / div >
< div class = "summary-row" >
< div class = "summary-signature" >
< a href = "#currency_from_locale/1" translate = "no" > currency_from_locale(locale)< / a >
< / div >
< div class = "summary-synopsis" > < p > Returns the effective currency for a given locale< / p > < / div >
< / div >
< div class = "summary-row" >
< div class = "summary-signature" >
< a href = "#currency_history_for_locale/1" translate = "no" > currency_history_for_locale(language_tag)< / a >
< / div >
< div class = "summary-synopsis" > < p > Returns a list of historic and the current
currency for a given locale.< / p > < / div >
< / div >
< div class = "summary-row" >
< div class = "summary-signature" >
< a href = "#currency_strings/3" translate = "no" > currency_strings(locale, only \\ :all, except \\ nil)< / a >
< / div >
< div class = "summary-synopsis" > < p > Returns a map that matches a currency string to a
currency code.< / p > < / div >
< / div >
< div class = "summary-row" >
< div class = "summary-signature" >
< a href = "#currency_strings!/3" translate = "no" > currency_strings!(locale_name, only \\ :all, except \\ nil)< / a >
< / div >
< div class = "summary-synopsis" > < p > Returns a map that matches a currency string to a
currency code or raises an exception.< / p > < / div >
< / div >
< div class = "summary-row" >
< div class = "summary-signature" >
< a href = "#current_currency_from_locale/1" translate = "no" > current_currency_from_locale(locale)< / a >
< / div >
< div class = "summary-synopsis" > < p > Returns the current currency for a given locale.< / p > < / div >
< / div >
< div class = "summary-row" >
< div class = "summary-signature" >
< a href = "#current_territory_currencies/0" translate = "no" > current_territory_currencies()< / a >
< / div >
< div class = "summary-synopsis" > < p > Returns a mapping from a territory code to its
current currency code.< / p > < / div >
< / div >
< div class = "summary-row" >
< div class = "summary-signature" >
< a href = "#known_currencies/0" translate = "no" > known_currencies()< / a >
< / div >
< div class = "summary-synopsis" > < p > See < a href = "#known_currency_codes/0" > < code class = "inline" > Plausible.Cldr.Currency.known_currency_codes/0< / code > < / a > .< / p > < / div >
< / div >
< div class = "summary-row" >
< div class = "summary-signature" >
< a href = "#known_currency?/1" translate = "no" > known_currency?(code)< / a >
< / div >
< div class = "summary-synopsis" > < p > See < a href = "#known_currency_code?/1" > < code class = "inline" > Plausible.Cldr.Currency.known_currency_code?/1< / code > < / a > .< / p > < / div >
< / div >
< div class = "summary-row" >
< div class = "summary-signature" >
< a href = "#known_currency_code/1" translate = "no" > known_currency_code(currency_code)< / a >
< / div >
< div class = "summary-synopsis" > < p > Returns a 2-tuple indicating if the supplied currency code is known.< / p > < / div >
< / div >
< div class = "summary-row" >
< div class = "summary-signature" >
< a href = "#known_currency_code?/1" translate = "no" > known_currency_code?(currency_code)< / a >
< / div >
< div class = "summary-synopsis" > < p > Returns a boolean indicating if the supplied currency code is known.< / p > < / div >
< / div >
< div class = "summary-row" >
< div class = "summary-signature" >
< a href = "#known_currency_codes/0" translate = "no" > known_currency_codes()< / a >
< / div >
< div class = "summary-synopsis" > < p > Returns a list of all known currency codes.< / p > < / div >
< / div >
< div class = "summary-row" >
< div class = "summary-signature" >
< a href = "#new/2" translate = "no" > new(currency, options \\ [])< / a >
< / div >
< div class = "summary-synopsis" > < p > Returns a < code class = "inline" > Currency< / code > struct created from the arguments.< / p > < / div >
< / div >
< div class = "summary-row" >
< div class = "summary-signature" >
< a href = "#pluralize/3" translate = "no" > pluralize(number, currency, options \\ [])< / a >
< / div >
< div class = "summary-synopsis" > < p > Returns the appropriate currency display name for the < code class = "inline" > currency< / code > , based
on the plural rules in effect for the < code class = "inline" > locale< / code > .< / p > < / div >
< / div >
< div class = "summary-row" >
< div class = "summary-signature" >
< a href = "#strings_for_currency/2" translate = "no" > strings_for_currency(currency, locale)< / a >
< / div >
< div class = "summary-synopsis" > < p > Returns the strings associated with a currency
in a given locale.< / 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 = "currencies_for_locale/3" >
< span id = "currencies_for_locale/1" > < / span >
< span id = "currencies_for_locale/2" > < / span >
< div class = "detail-header" >
< a href = "#currencies_for_locale/3" 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" > currencies_for_locale(locale, only \\ :all, except \\ nil)< / 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 > currencies_for_locale(
2024-01-11 10:50:44 +03:00
< a href = "https://hexdocs.pm/ex_cldr/2.37.5/Cldr.Locale.html#t:locale_name/0" > Cldr.Locale.locale_name< / a > () | < a href = "https://hexdocs.pm/ex_cldr/2.37.5/Cldr.LanguageTag.html#t:t/0" > Cldr.LanguageTag.t< / a > (),
only :: < a href = "https://hexdocs.pm/ex_cldr_currencies/2.15.1/Cldr.Currency.html#t:filter/0" > Cldr.Currency.filter< / a > (),
except :: < a href = "https://hexdocs.pm/ex_cldr_currencies/2.15.1/Cldr.Currency.html#t:filter/0" > Cldr.Currency.filter< / a > ()
2023-07-12 11:28:07 +03:00
) :: {:ok, < a href = "https://hexdocs.pm/elixir/typespecs.html#basic-types" > map< / a > ()} | {:error, {< a href = "https://hexdocs.pm/elixir/typespecs.html#built-in-types" > module< / a > (), < a href = "https://hexdocs.pm/elixir/String.html#t:t/0" > String.t< / a > ()}}< / pre >
< pre translate = "no" > < span class = "attribute" > @spec< / span > currencies_for_locale(
2024-01-11 10:50:44 +03:00
< a href = "https://hexdocs.pm/ex_cldr/2.37.5/Cldr.Locale.html#t:locale_name/0" > Cldr.Locale.locale_name< / a > () | < a href = "https://hexdocs.pm/ex_cldr/2.37.5/Cldr.LanguageTag.html#t:t/0" > Cldr.LanguageTag.t< / a > (),
only :: < a href = "https://hexdocs.pm/ex_cldr_currencies/2.15.1/Cldr.Currency.html#t:filter/0" > Cldr.Currency.filter< / a > (),
except :: < a href = "https://hexdocs.pm/ex_cldr_currencies/2.15.1/Cldr.Currency.html#t:filter/0" > Cldr.Currency.filter< / a > ()
2023-07-12 11:28:07 +03:00
) :: < a href = "https://hexdocs.pm/elixir/typespecs.html#basic-types" > map< / a > () | < a href = "https://hexdocs.pm/elixir/typespecs.html#built-in-types" > no_return< / a > ()< / pre >
< / div >
< p > Returns a map of the metadata for all currencies for
a given locale.< / p > < h2 id = "currencies_for_locale/3-arguments" class = "section-heading" >
2024-01-11 10:50:44 +03:00
< a href = "#currencies_for_locale/3-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" > locale< / code > is any valid locale name returned by < code class = "inline" > MyApp.Cldr.known_locale_names/0< / code >
2024-01-11 10:50:44 +03:00
or a < a href = "https://hexdocs.pm/ex_cldr/2.37.5/Cldr.LanguageTag.html" > < code class = "inline" > Cldr.LanguageTag< / code > < / a > struct returned by < code class = "inline" > MyApp.Cldr.Locale.new!/1< / code > < / p > < / li > < li > < p > < code class = "inline" > currency_status< / code > is < code class = "inline" > :all< / code > , < code class = "inline" > :current< / code > , < code class = "inline" > :historic< / code > ,
2023-07-12 11:28:07 +03:00
< code class = "inline" > unannotated< / code > or < code class = "inline" > :tender< / code > ; or a list of one or more status.
2024-01-11 10:50:44 +03:00
The default is < code class = "inline" > :all< / code > . See < a href = "https://hexdocs.pm/ex_cldr_currencies/2.15.1/Cldr.Currency.html#currency_filter/2" > < code class = "inline" > Cldr.Currency.currency_filter/2< / code > < / a > .< / p > < / li > < / ul > < h2 id = "currencies_for_locale/3-returns" class = "section-heading" >
< a href = "#currencies_for_locale/3-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, currency_map}< / code > or< / p > < / li > < li > < p > < code class = "inline" > {:error, {exception, reason}}< / code > < / p > < / li > < / ul > < h2 id = "currencies_for_locale/3-example" class = "section-heading" >
2024-01-11 10:50:44 +03:00
< a href = "#currencies_for_locale/3-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-11 10:50:44 +03:00
< p > MyApp.Cldr.Currency.currencies_for_locale(" en" )
2023-07-12 11:28:07 +03:00
=> {:ok,
2024-06-06 17:49:53 +03:00
%{< / p > < pre > < code class = "makeup elixir" translate = "no" > < span class = "w" > < / span > < span class = "ss" > FJD< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "p" data-group-id = "1301365370-1" > %< / span > < span class = "nc" data-group-id = "1301365370-1" > Cldr.Currency< / span > < span class = "p" data-group-id = "1301365370-1" > {< / span > < span class = "w" >
2023-07-12 11:28:07 +03:00
< / span > < span class = "ss" > cash_digits< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "mi" > 2< / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "ss" > cash_rounding< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "mi" > 0< / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "ss" > code< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "s" > " FJD" < / span > < span class = "p" > ,< / span > < span class = "w" >
2024-06-06 17:49:53 +03:00
< / span > < span class = "ss" > count< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "p" data-group-id = "1301365370-2" > %{< / span > < span class = "ss" > one< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "s" > " Fijian dollar" < / span > < span class = "p" > ,< / span > < span class = "w" > < / span > < span class = "ss" > other< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "s" > " Fijian dollars" < / span > < span class = "p" data-group-id = "1301365370-2" > }< / span > < span class = "p" > ,< / span > < span class = "w" >
2023-07-12 11:28:07 +03:00
< / span > < span class = "ss" > digits< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "mi" > 2< / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "ss" > from< / 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" > iso_digits< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "mi" > 2< / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "ss" > name< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "s" > " Fijian Dollar" < / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "ss" > narrow_symbol< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "s" > " $" < / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "ss" > rounding< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "mi" > 0< / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "ss" > symbol< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "s" > " FJD" < / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "ss" > tender< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "no" > true< / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "ss" > to< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "no" > nil< / span > < span class = "w" >
2024-06-06 17:49:53 +03:00
< / span > < span class = "p" data-group-id = "1301365370-1" > }< / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "ss" > SUR< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "p" data-group-id = "1301365370-3" > %< / span > < span class = "nc" data-group-id = "1301365370-3" > Cldr.Currency< / span > < span class = "p" data-group-id = "1301365370-3" > {< / span > < span class = "w" >
2023-07-12 11:28:07 +03:00
< / span > < span class = "ss" > cash_digits< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "mi" > 2< / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "ss" > cash_rounding< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "mi" > 0< / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "ss" > code< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "s" > " SUR" < / span > < span class = "p" > ,< / span > < span class = "w" >
2024-06-06 17:49:53 +03:00
< / span > < span class = "ss" > count< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "p" data-group-id = "1301365370-4" > %{< / span > < span class = "ss" > one< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "s" > " Soviet rouble" < / span > < span class = "p" > ,< / span > < span class = "w" > < / span > < span class = "ss" > other< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "s" > " Soviet roubles" < / span > < span class = "p" data-group-id = "1301365370-4" > }< / span > < span class = "p" > ,< / span > < span class = "w" >
2023-07-12 11:28:07 +03:00
< / span > < span class = "ss" > digits< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "mi" > 2< / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "ss" > from< / 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" > iso_digits< / 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" > name< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "s" > " Soviet Rouble" < / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "ss" > narrow_symbol< / 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" > rounding< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "mi" > 0< / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "ss" > symbol< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "s" > " SUR" < / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "ss" > tender< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "no" > true< / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "ss" > to< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "no" > nil< / span > < span class = "w" >
2024-06-06 17:49:53 +03:00
< / span > < span class = "p" data-group-id = "1301365370-3" > }< / span > < span class = "p" > ,< / span > < span class = "w" >
2023-07-12 11:28:07 +03:00
< / span > < span class = "n" > ...< / span > < span class = "w" >
< / span > < span class = "err" > }< / span > < span class = "err" > }< / span > < / code > < / pre >
< / section >
< / section >
< section class = "detail" id = "currencies_for_locale!/3" >
< span id = "currencies_for_locale!/1" > < / span >
< span id = "currencies_for_locale!/2" > < / span >
< div class = "detail-header" >
< a href = "#currencies_for_locale!/3" 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" > currencies_for_locale!(locale, only \\ :all, except \\ nil)< / 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 > Returns a map of the metadata for all currencies for
a given locale and raises on error.< / p > < h2 id = "currencies_for_locale!/3-arguments" class = "section-heading" >
2024-01-11 10:50:44 +03:00
< a href = "#currencies_for_locale!/3-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" > locale< / code > is any valid locale name returned by < code class = "inline" > MyApp.Cldr.known_locale_names/0< / code >
2024-01-11 10:50:44 +03:00
or a < a href = "https://hexdocs.pm/ex_cldr/2.37.5/Cldr.LanguageTag.html" > < code class = "inline" > Cldr.LanguageTag< / code > < / a > struct returned by < code class = "inline" > MyApp.Cldr.Locale.new!/1< / code > < / p > < / li > < li > < p > < code class = "inline" > currency_status< / code > is < code class = "inline" > :all< / code > , < code class = "inline" > :current< / code > , < code class = "inline" > :historic< / code > ,
2023-07-12 11:28:07 +03:00
< code class = "inline" > unannotated< / code > or < code class = "inline" > :tender< / code > ; or a list of one or more status.
2024-01-11 10:50:44 +03:00
The default is < code class = "inline" > :all< / code > . See < a href = "https://hexdocs.pm/ex_cldr_currencies/2.15.1/Cldr.Currency.html#currency_filter/2" > < code class = "inline" > Cldr.Currency.currency_filter/2< / code > < / a > .< / p > < / li > < / ul > < h2 id = "currencies_for_locale!/3-returns" class = "section-heading" >
< a href = "#currencies_for_locale!/3-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, currency_map}< / code > or< / p > < / li > < li > < p > raises an exception< / p > < / li > < / ul > < h2 id = "currencies_for_locale!/3-example" class = "section-heading" >
2024-01-11 10:50:44 +03:00
< a href = "#currencies_for_locale!/3-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-11 10:50:44 +03:00
< p > MyApp.Cldr.Currency.currencies_for_locale!(" en" )
2024-06-06 17:49:53 +03:00
=> %{< / p > < pre > < code class = "makeup elixir" translate = "no" > < span class = "ss" > FJD< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "p" data-group-id = "0521702596-1" > %< / span > < span class = "nc" data-group-id = "0521702596-1" > Cldr.Currency< / span > < span class = "p" data-group-id = "0521702596-1" > {< / span > < span class = "w" >
2023-07-12 11:28:07 +03:00
< / span > < span class = "ss" > cash_digits< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "mi" > 2< / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "ss" > cash_rounding< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "mi" > 0< / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "ss" > code< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "s" > " FJD" < / span > < span class = "p" > ,< / span > < span class = "w" >
2024-06-06 17:49:53 +03:00
< / span > < span class = "ss" > count< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "p" data-group-id = "0521702596-2" > %{< / span > < span class = "ss" > one< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "s" > " Fijian dollar" < / span > < span class = "p" > ,< / span > < span class = "w" > < / span > < span class = "ss" > other< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "s" > " Fijian dollars" < / span > < span class = "p" data-group-id = "0521702596-2" > }< / span > < span class = "p" > ,< / span > < span class = "w" >
2023-07-12 11:28:07 +03:00
< / span > < span class = "ss" > digits< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "mi" > 2< / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "ss" > from< / 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" > iso_digits< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "mi" > 2< / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "ss" > name< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "s" > " Fijian Dollar" < / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "ss" > narrow_symbol< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "s" > " $" < / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "ss" > rounding< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "mi" > 0< / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "ss" > symbol< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "s" > " FJD" < / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "ss" > tender< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "no" > true< / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "ss" > to< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "no" > nil< / span > < span class = "w" >
2024-06-06 17:49:53 +03:00
< / span > < span class = "p" data-group-id = "0521702596-1" > }< / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "ss" > SUR< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "p" data-group-id = "0521702596-3" > %< / span > < span class = "nc" data-group-id = "0521702596-3" > Cldr.Currency< / span > < span class = "p" data-group-id = "0521702596-3" > {< / span > < span class = "w" >
2023-07-12 11:28:07 +03:00
< / span > < span class = "ss" > cash_digits< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "mi" > 2< / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "ss" > cash_rounding< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "mi" > 0< / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "ss" > code< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "s" > " SUR" < / span > < span class = "p" > ,< / span > < span class = "w" >
2024-06-06 17:49:53 +03:00
< / span > < span class = "ss" > count< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "p" data-group-id = "0521702596-4" > %{< / span > < span class = "ss" > one< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "s" > " Soviet rouble" < / span > < span class = "p" > ,< / span > < span class = "w" > < / span > < span class = "ss" > other< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "s" > " Soviet roubles" < / span > < span class = "p" data-group-id = "0521702596-4" > }< / span > < span class = "p" > ,< / span > < span class = "w" >
2023-07-12 11:28:07 +03:00
< / span > < span class = "ss" > digits< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "mi" > 2< / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "ss" > from< / 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" > iso_digits< / 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" > name< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "s" > " Soviet Rouble" < / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "ss" > narrow_symbol< / 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" > rounding< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "mi" > 0< / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "ss" > symbol< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "s" > " SUR" < / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "ss" > tender< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "no" > true< / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "ss" > to< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "no" > nil< / span > < span class = "w" >
2024-06-06 17:49:53 +03:00
< / span > < span class = "p" data-group-id = "0521702596-3" > }< / span > < span class = "p" > ,< / span > < span class = "w" >
2023-07-12 11:28:07 +03:00
< / span > < span class = "n" > ...< / span > < / code > < / pre > < p > }< / p >
< / section >
< / section >
< section class = "detail" id = "currency_for_code/2" >
< span id = "currency_for_code/1" > < / span >
< div class = "detail-header" >
< a href = "#currency_for_code/2" 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" > currency_for_code(currency_or_currency_code, options \\ [locale: Plausible.Cldr.default_locale()])< / 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" >
2024-01-11 10:50:44 +03:00
< pre translate = "no" > < span class = "attribute" > @spec< / span > currency_for_code(< a href = "https://hexdocs.pm/ex_cldr_currencies/2.15.1/Cldr.Currency.html#t:code/0" > Cldr.Currency.code< / a > () | < a href = "https://hexdocs.pm/ex_cldr_currencies/2.15.1/Cldr.Currency.html#t:t/0" > Cldr.Currency.t< / a > (), < a href = "https://hexdocs.pm/elixir/Keyword.html#t:t/0" > Keyword.t< / a > ()) ::
{:ok, < a href = "https://hexdocs.pm/ex_cldr_currencies/2.15.1/Cldr.Currency.html#t:t/0" > Cldr.Currency.t< / a > ()} | {:error, {< a href = "https://hexdocs.pm/elixir/typespecs.html#built-in-types" > module< / a > (), < a href = "https://hexdocs.pm/elixir/String.html#t:t/0" > String.t< / a > ()}}< / pre >
2023-07-12 11:28:07 +03:00
< / div >
< p > Returns the currency metadata for the requested currency code.< / p > < h2 id = "currency_for_code/2-arguments" class = "section-heading" >
2024-01-11 10:50:44 +03:00
< a href = "#currency_for_code/2-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" > currency_or_currency_code< / code > is a < code class = "inline" > binary< / code > or < code class = "inline" > atom< / code > representation
of an ISO 4217 currency code, or a < code class = "inline" > %Cldr.Currency{}< / code > struct.< / li > < / ul > < h2 id = "currency_for_code/2-options" class = "section-heading" >
2024-01-11 10:50:44 +03:00
< a href = "#currency_for_code/2-options" 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" > Options< / span >
2023-07-12 11:28:07 +03:00
< / h2 >
2024-01-11 10:50:44 +03:00
< ul > < li > < code class = "inline" > :locale< / code > is any valid locale name returned by < a href = "https://hexdocs.pm/ex_cldr/2.37.5/Cldr.html#known_locale_names/1" > < code class = "inline" > Cldr.known_locale_names/1< / code > < / a >
or a < a href = "https://hexdocs.pm/ex_cldr/2.37.5/Cldr.LanguageTag.html" > < code class = "inline" > Cldr.LanguageTag< / code > < / a > struct returned by < a href = "https://hexdocs.pm/ex_cldr/2.37.5/Cldr.Locale.html#new!/2" > < code class = "inline" > Cldr.Locale.new!/2< / code > < / a > < / li > < / ul > < h2 id = "currency_for_code/2-returns" class = "section-heading" >
< a href = "#currency_for_code/2-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 > A < code class = "inline" > {:ok, currency}< / code > or< / p > < / li > < li > < p > < code class = "inline" > {:error, {exception, reason}}< / code > < / p > < / li > < / ul > < h2 id = "currency_for_code/2-examples" class = "section-heading" >
2024-01-11 10:50:44 +03:00
< a href = "#currency_for_code/2-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-06-06 17:49:53 +03:00
< pre > < code class = "makeup elixir" translate = "no" > < span class = "gp unselectable" > iex> < / span > < span class = "nc" > Plausible.Cldr.Currency< / span > < span class = "o" > .< / span > < span class = "n" > currency_for_code< / span > < span class = "p" data-group-id = "3141573902-1" > (< / span > < span class = "s" > " AUD" < / span > < span class = "p" data-group-id = "3141573902-1" > )< / span > < span class = "w" >
< / span > < span class = "p" data-group-id = "3141573902-2" > {< / span > < span class = "ss" > :ok< / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "p" data-group-id = "3141573902-3" > %< / span > < span class = "nc" data-group-id = "3141573902-3" > Cldr.Currency< / span > < span class = "p" data-group-id = "3141573902-3" > {< / span > < span class = "w" >
2023-07-12 11:28:07 +03:00
< / span > < span class = "ss" > cash_digits< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "mi" > 2< / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "ss" > cash_rounding< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "mi" > 0< / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "ss" > code< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "s" > " AUD" < / span > < span class = "p" > ,< / span > < span class = "w" >
2024-06-06 17:49:53 +03:00
< / span > < span class = "ss" > count< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "p" data-group-id = "3141573902-4" > %{< / span > < span class = "ss" > one< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "s" > " Australian dollar" < / span > < span class = "p" > ,< / span > < span class = "w" > < / span > < span class = "ss" > other< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "s" > " Australian dollars" < / span > < span class = "p" data-group-id = "3141573902-4" > }< / span > < span class = "p" > ,< / span > < span class = "w" >
2023-07-12 11:28:07 +03:00
< / span > < span class = "ss" > digits< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "mi" > 2< / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "ss" > iso_digits< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "mi" > 2< / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "ss" > name< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "s" > " Australian Dollar" < / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "ss" > narrow_symbol< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "s" > " $" < / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "ss" > rounding< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "mi" > 0< / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "ss" > symbol< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "s" > " A$" < / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "ss" > tender< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "no" > true< / span > < span class = "w" >
2024-06-06 17:49:53 +03:00
< / span > < span class = "p" data-group-id = "3141573902-3" > }< / span > < span class = "p" data-group-id = "3141573902-2" > }< / span > < span class = "w" >
2023-07-12 11:28:07 +03:00
2024-06-06 17:49:53 +03:00
< / span > < span class = "gp unselectable" > iex> < / span > < span class = "nc" > Plausible.Cldr.Currency< / span > < span class = "o" > .< / span > < span class = "n" > currency_for_code< / span > < span class = "p" data-group-id = "3141573902-5" > (< / span > < span class = "s" > " THB" < / span > < span class = "p" data-group-id = "3141573902-5" > )< / span > < span class = "w" >
< / span > < span class = "p" data-group-id = "3141573902-6" > {< / span > < span class = "ss" > :ok< / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "p" data-group-id = "3141573902-7" > %< / span > < span class = "nc" data-group-id = "3141573902-7" > Cldr.Currency< / span > < span class = "p" data-group-id = "3141573902-7" > {< / span > < span class = "w" >
2023-07-12 11:28:07 +03:00
< / span > < span class = "ss" > cash_digits< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "mi" > 2< / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "ss" > cash_rounding< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "mi" > 0< / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "ss" > code< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "s" > " THB" < / span > < span class = "p" > ,< / span > < span class = "w" >
2024-06-06 17:49:53 +03:00
< / span > < span class = "ss" > count< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "p" data-group-id = "3141573902-8" > %{< / span > < span class = "ss" > one< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "s" > " Thai baht" < / span > < span class = "p" > ,< / span > < span class = "w" > < / span > < span class = "ss" > other< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "s" > " Thai baht" < / span > < span class = "p" data-group-id = "3141573902-8" > }< / span > < span class = "p" > ,< / span > < span class = "w" >
2023-07-12 11:28:07 +03:00
< / span > < span class = "ss" > digits< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "mi" > 2< / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "ss" > iso_digits< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "mi" > 2< / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "ss" > name< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "s" > " Thai Baht" < / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "ss" > narrow_symbol< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "s" > " ฿" < / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "ss" > rounding< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "mi" > 0< / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "ss" > symbol< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "s" > " THB" < / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "ss" > tender< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "no" > true< / span > < span class = "w" >
2024-06-06 17:49:53 +03:00
< / span > < span class = "p" data-group-id = "3141573902-7" > }< / span > < span class = "p" data-group-id = "3141573902-6" > }< / span > < / code > < / pre >
2023-07-12 11:28:07 +03:00
< / section >
< / section >
< section class = "detail" id = "currency_for_code!/2" >
< span id = "currency_for_code!/1" > < / span >
< div class = "detail-header" >
< a href = "#currency_for_code!/2" 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" > currency_for_code!(currency_or_currency_code, options \\ [locale: Plausible.Cldr.default_locale()])< / 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.14.0)< / span >
< / div >
< section class = "docstring" >
< div class = "specs" >
2024-01-11 10:50:44 +03:00
< pre translate = "no" > < span class = "attribute" > @spec< / span > currency_for_code!(< a href = "https://hexdocs.pm/ex_cldr_currencies/2.15.1/Cldr.Currency.html#t:code/0" > Cldr.Currency.code< / a > () | < a href = "https://hexdocs.pm/ex_cldr_currencies/2.15.1/Cldr.Currency.html#t:t/0" > Cldr.Currency.t< / a > (), < a href = "https://hexdocs.pm/elixir/Keyword.html#t:t/0" > Keyword.t< / a > ()) ::
< a href = "https://hexdocs.pm/ex_cldr_currencies/2.15.1/Cldr.Currency.html#t:t/0" > Cldr.Currency.t< / a > () | < a href = "https://hexdocs.pm/elixir/typespecs.html#built-in-types" > no_return< / a > ()< / pre >
2023-07-12 11:28:07 +03:00
< / div >
< p > Returns the currency metadata for the requested currency code.< / p > < h2 id = "currency_for_code!/2-arguments" class = "section-heading" >
2024-01-11 10:50:44 +03:00
< a href = "#currency_for_code!/2-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" > currency_or_currency_code< / code > is a < code class = "inline" > binary< / code > or < code class = "inline" > atom< / code > representation
of an ISO 4217 currency code, or a < code class = "inline" > %Cldr.Currency{}< / code > struct.< / li > < / ul > < h2 id = "currency_for_code!/2-options" class = "section-heading" >
2024-01-11 10:50:44 +03:00
< a href = "#currency_for_code!/2-options" 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" > Options< / span >
2023-07-12 11:28:07 +03:00
< / h2 >
2024-01-11 10:50:44 +03:00
< ul > < li > < code class = "inline" > :locale< / code > is any valid locale name returned by < a href = "https://hexdocs.pm/ex_cldr/2.37.5/Cldr.html#known_locale_names/1" > < code class = "inline" > Cldr.known_locale_names/1< / code > < / a >
or a < a href = "https://hexdocs.pm/ex_cldr/2.37.5/Cldr.LanguageTag.html" > < code class = "inline" > Cldr.LanguageTag< / code > < / a > struct returned by < a href = "https://hexdocs.pm/ex_cldr/2.37.5/Cldr.Locale.html#new!/2" > < code class = "inline" > Cldr.Locale.new!/2< / code > < / a > < / li > < / ul > < h2 id = "currency_for_code!/2-returns" class = "section-heading" >
< a href = "#currency_for_code!/2-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 > A < code class = "inline" > t:Cldr.Current.t/0< / code > or< / p > < / li > < li > < p > raises an exception< / p > < / li > < / ul > < h2 id = "currency_for_code!/2-examples" class = "section-heading" >
2024-01-11 10:50:44 +03:00
< a href = "#currency_for_code!/2-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-06-06 17:49:53 +03:00
< pre > < code class = "makeup elixir" translate = "no" > < span class = "gp unselectable" > iex> < / span > < span class = "nc" > Plausible.Cldr.Currency< / span > < span class = "o" > .< / span > < span class = "n" > currency_for_code!< / span > < span class = "p" data-group-id = "1786794703-1" > (< / span > < span class = "s" > " AUD" < / span > < span class = "p" data-group-id = "1786794703-1" > )< / span > < span class = "w" >
< / span > < span class = "p" data-group-id = "1786794703-2" > %< / span > < span class = "nc" data-group-id = "1786794703-2" > Cldr.Currency< / span > < span class = "p" data-group-id = "1786794703-2" > {< / span > < span class = "w" >
2023-07-12 11:28:07 +03:00
< / span > < span class = "ss" > cash_digits< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "mi" > 2< / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "ss" > cash_rounding< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "mi" > 0< / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "ss" > code< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "s" > " AUD" < / span > < span class = "p" > ,< / span > < span class = "w" >
2024-06-06 17:49:53 +03:00
< / span > < span class = "ss" > count< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "p" data-group-id = "1786794703-3" > %{< / span > < span class = "ss" > one< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "s" > " Australian dollar" < / span > < span class = "p" > ,< / span > < span class = "w" > < / span > < span class = "ss" > other< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "s" > " Australian dollars" < / span > < span class = "p" data-group-id = "1786794703-3" > }< / span > < span class = "p" > ,< / span > < span class = "w" >
2023-07-12 11:28:07 +03:00
< / span > < span class = "ss" > digits< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "mi" > 2< / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "ss" > iso_digits< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "mi" > 2< / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "ss" > name< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "s" > " Australian Dollar" < / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "ss" > narrow_symbol< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "s" > " $" < / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "ss" > rounding< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "mi" > 0< / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "ss" > symbol< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "s" > " A$" < / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "ss" > tender< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "no" > true< / span > < span class = "w" >
2024-06-06 17:49:53 +03:00
< / span > < span class = "p" data-group-id = "1786794703-2" > }< / span > < span class = "w" >
2023-07-12 11:28:07 +03:00
2024-06-06 17:49:53 +03:00
< / span > < span class = "gp unselectable" > iex> < / span > < span class = "nc" > Plausible.Cldr.Currency< / span > < span class = "o" > .< / span > < span class = "n" > currency_for_code!< / span > < span class = "p" data-group-id = "1786794703-4" > (< / span > < span class = "s" > " THB" < / span > < span class = "p" data-group-id = "1786794703-4" > )< / span > < span class = "w" >
< / span > < span class = "p" data-group-id = "1786794703-5" > %< / span > < span class = "nc" data-group-id = "1786794703-5" > Cldr.Currency< / span > < span class = "p" data-group-id = "1786794703-5" > {< / span > < span class = "w" >
2023-07-12 11:28:07 +03:00
< / span > < span class = "ss" > cash_digits< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "mi" > 2< / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "ss" > cash_rounding< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "mi" > 0< / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "ss" > code< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "s" > " THB" < / span > < span class = "p" > ,< / span > < span class = "w" >
2024-06-06 17:49:53 +03:00
< / span > < span class = "ss" > count< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "p" data-group-id = "1786794703-6" > %{< / span > < span class = "ss" > one< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "s" > " Thai baht" < / span > < span class = "p" > ,< / span > < span class = "w" > < / span > < span class = "ss" > other< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "s" > " Thai baht" < / span > < span class = "p" data-group-id = "1786794703-6" > }< / span > < span class = "p" > ,< / span > < span class = "w" >
2023-07-12 11:28:07 +03:00
< / span > < span class = "ss" > digits< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "mi" > 2< / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "ss" > iso_digits< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "mi" > 2< / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "ss" > name< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "s" > " Thai Baht" < / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "ss" > narrow_symbol< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "s" > " ฿" < / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "ss" > rounding< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "mi" > 0< / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "ss" > symbol< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "s" > " THB" < / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "ss" > tender< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "no" > true< / span > < span class = "w" >
2024-06-06 17:49:53 +03:00
< / span > < span class = "p" data-group-id = "1786794703-5" > }< / span > < / code > < / pre >
2023-07-12 11:28:07 +03:00
< / section >
< / section >
< section class = "detail" id = "currency_from_locale/1" >
< div class = "detail-header" >
< a href = "#currency_from_locale/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" > currency_from_locale(locale)< / 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 > Returns the effective currency for a given locale< / p > < h2 id = "currency_from_locale/1-arguments" class = "section-heading" >
2024-01-11 10:50:44 +03:00
< a href = "#currency_from_locale/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 >
2024-01-11 10:50:44 +03:00
< ul > < li > < code class = "inline" > locale< / code > is a < a href = "https://hexdocs.pm/ex_cldr/2.37.5/Cldr.LanguageTag.html" > < code class = "inline" > Cldr.LanguageTag< / code > < / a > struct returned by
< a href = "https://hexdocs.pm/ex_cldr/2.37.5/Cldr.Locale.html#new!/2" > < code class = "inline" > Cldr.Locale.new!/2< / code > < / a > < / li > < / ul > < h2 id = "currency_from_locale/1-returns" class = "section-heading" >
< a href = "#currency_from_locale/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 > A ISO 4217 currency code as an upcased atom< / li > < / ul > < h2 id = "currency_from_locale/1-examples" class = "section-heading" >
2024-01-11 10:50:44 +03:00
< a href = "#currency_from_locale/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-06-06 17:49:53 +03:00
< pre > < code class = "makeup elixir" translate = "no" > < span class = "gp unselectable" > iex> < / span > < span class = "p" data-group-id = "0534566494-1" > {< / span > < span class = "ss" > :ok< / span > < span class = "p" > ,< / span > < span class = "w" > < / span > < span class = "n" > locale< / span > < span class = "p" data-group-id = "0534566494-1" > }< / span > < span class = "w" > < / span > < span class = "o" > =< / span > < span class = "w" > < / span > < span class = "nc" > Plausible.Cldr< / span > < span class = "o" > .< / span > < span class = "n" > validate_locale< / span > < span class = "p" data-group-id = "0534566494-2" > (< / span > < span class = "s" > " en" < / span > < span class = "p" data-group-id = "0534566494-2" > )< / span > < span class = "w" >
2023-07-12 11:28:07 +03:00
< / span > < span class = "gp unselectable" > iex> < / span > < span class = "nc" > Plausible.Cldr.Currency< / span > < span class = "o" > .< / span > < span class = "n" > currency_from_locale< / span > < span class = "w" > < / span > < span class = "n" > locale< / span > < span class = "w" >
< / span > < span class = "ss" > :USD< / span > < span class = "w" >
2024-06-06 17:49:53 +03:00
< / span > < span class = "gp unselectable" > iex> < / span > < span class = "p" data-group-id = "0534566494-3" > {< / span > < span class = "ss" > :ok< / span > < span class = "p" > ,< / span > < span class = "w" > < / span > < span class = "n" > locale< / span > < span class = "p" data-group-id = "0534566494-3" > }< / span > < span class = "w" > < / span > < span class = "o" > =< / span > < span class = "w" > < / span > < span class = "nc" > Plausible.Cldr< / span > < span class = "o" > .< / span > < span class = "n" > validate_locale< / span > < span class = "p" data-group-id = "0534566494-4" > (< / span > < span class = "s" > " en-AU" < / span > < span class = "p" data-group-id = "0534566494-4" > )< / span > < span class = "w" >
2023-07-12 11:28:07 +03:00
< / span > < span class = "gp unselectable" > iex> < / span > < span class = "nc" > Plausible.Cldr.Currency< / span > < span class = "o" > .< / span > < span class = "n" > currency_from_locale< / span > < span class = "w" > < / span > < span class = "n" > locale< / span > < span class = "w" >
< / span > < span class = "ss" > :AUD< / span > < span class = "w" >
2024-06-06 17:49:53 +03:00
< / span > < span class = "gp unselectable" > iex> < / span > < span class = "nc" > Plausible.Cldr.Currency< / span > < span class = "o" > .< / span > < span class = "n" > currency_from_locale< / span > < span class = "p" data-group-id = "0534566494-5" > (< / span > < span class = "s" > " en-GB" < / span > < span class = "p" data-group-id = "0534566494-5" > )< / span > < span class = "w" >
2023-07-12 11:28:07 +03:00
< / span > < span class = "ss" > :GBP< / span > < / code > < / pre >
< / section >
< / section >
< section class = "detail" id = "currency_history_for_locale/1" >
< div class = "detail-header" >
< a href = "#currency_history_for_locale/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" > currency_history_for_locale(language_tag)< / 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" >
2024-01-11 10:50:44 +03:00
< pre translate = "no" > < span class = "attribute" > @spec< / span > currency_history_for_locale(< a href = "https://hexdocs.pm/ex_cldr/2.37.5/Cldr.LanguageTag.html#t:t/0" > Cldr.LanguageTag.t< / a > () | < a href = "https://hexdocs.pm/ex_cldr/2.37.5/Cldr.Locale.html#t:locale_name/0" > Cldr.Locale.locale_name< / a > ()) ::
{:ok, < a href = "https://hexdocs.pm/elixir/typespecs.html#basic-types" > map< / a > ()} | {:error, {< a href = "https://hexdocs.pm/elixir/typespecs.html#built-in-types" > module< / a > (), < a href = "https://hexdocs.pm/elixir/String.html#t:t/0" > String.t< / a > ()}}< / pre >
2023-07-12 11:28:07 +03:00
< / div >
< p > Returns a list of historic and the current
currency for a given locale.< / p > < h2 id = "currency_history_for_locale/1-arguments" class = "section-heading" >
2024-01-11 10:50:44 +03:00
< a href = "#currency_history_for_locale/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" > locale< / code > is any valid locale name returned by < code class = "inline" > MyApp.Cldr.known_locale_names/0< / code >
2024-01-11 10:50:44 +03:00
or a < a href = "https://hexdocs.pm/ex_cldr/2.37.5/Cldr.LanguageTag.html" > < code class = "inline" > Cldr.LanguageTag< / code > < / a > struct returned by < code class = "inline" > MyApp.Cldr.Locale.new!/1< / code > < / li > < / ul > < h2 id = "currency_history_for_locale/1-example" class = "section-heading" >
< a href = "#currency_history_for_locale/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-06-06 17:49:53 +03:00
< pre > < code class = "makeup elixir" translate = "no" > < span class = "gp unselectable" > iex> < / span > < span class = "nc" > MyApp.Cldr.Currency< / span > < span class = "o" > .< / span > < span class = "n" > currency_history_for_locale< / span > < span class = "p" data-group-id = "9938078730-1" > (< / span > < span class = "s" > " en" < / span > < span class = "p" data-group-id = "9938078730-1" > )< / span > < span class = "w" >
< / span > < span class = "p" data-group-id = "9938078730-2" > {< / span > < span class = "ss" > :ok< / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "p" data-group-id = "9938078730-3" > %{< / span > < span class = "w" >
< / span > < span class = "ss" > USD< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "p" data-group-id = "9938078730-4" > %{< / span > < span class = "ss" > from< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "ld" > ~D[1792-01-01]< / span > < span class = "p" > ,< / span > < span class = "w" > < / span > < span class = "ss" > to< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "no" > nil< / span > < span class = "p" data-group-id = "9938078730-4" > }< / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "ss" > USN< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "p" data-group-id = "9938078730-5" > %{< / span > < span class = "ss" > tender< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "no" > false< / span > < span class = "p" data-group-id = "9938078730-5" > }< / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "ss" > USS< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "p" data-group-id = "9938078730-6" > %{< / span > < span class = "ss" > from< / 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" > tender< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "no" > false< / span > < span class = "p" > ,< / span > < span class = "w" > < / span > < span class = "ss" > to< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "ld" > ~D[2014-03-01]< / span > < span class = "p" data-group-id = "9938078730-6" > }< / span > < span class = "w" >
< / span > < span class = "p" data-group-id = "9938078730-3" > }< / span > < span class = "w" >
< / span > < span class = "p" data-group-id = "9938078730-2" > }< / span > < / code > < / pre >
2023-07-12 11:28:07 +03:00
< / section >
< / section >
< section class = "detail" id = "currency_strings/3" >
< span id = "currency_strings/1" > < / span >
< span id = "currency_strings/2" > < / span >
< div class = "detail-header" >
< a href = "#currency_strings/3" 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" > currency_strings(locale, only \\ :all, except \\ nil)< / 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 > currency_strings(
2024-01-11 10:50:44 +03:00
< a href = "https://hexdocs.pm/ex_cldr/2.37.5/Cldr.LanguageTag.html#t:t/0" > Cldr.LanguageTag.t< / a > () | < a href = "https://hexdocs.pm/ex_cldr/2.37.5/Cldr.Locale.html#t:locale_name/0" > Cldr.Locale.locale_name< / a > (),
only :: < a href = "https://hexdocs.pm/ex_cldr_currencies/2.15.1/Cldr.Currency.html#t:filter/0" > Cldr.Currency.filter< / a > (),
except :: < a href = "https://hexdocs.pm/ex_cldr_currencies/2.15.1/Cldr.Currency.html#t:filter/0" > Cldr.Currency.filter< / a > ()
2023-07-12 11:28:07 +03:00
) :: {:ok, < a href = "https://hexdocs.pm/elixir/typespecs.html#basic-types" > map< / a > ()} | {:error, {< a href = "https://hexdocs.pm/elixir/typespecs.html#built-in-types" > module< / a > (), < a href = "https://hexdocs.pm/elixir/String.html#t:t/0" > String.t< / a > ()}}< / pre >
< / div >
< p > Returns a map that matches a currency string to a
currency code.< / p > < p > A currency string is a localised name or symbol
representing a currency in a locale-specific manner.< / p > < h2 id = "currency_strings/3-arguments" class = "section-heading" >
2024-01-11 10:50:44 +03:00
< a href = "#currency_strings/3-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" > locale< / code > is any valid locale name returned by < code class = "inline" > MyApp.Cldr.known_locale_names/0< / code >
2024-01-11 10:50:44 +03:00
or a < a href = "https://hexdocs.pm/ex_cldr/2.37.5/Cldr.LanguageTag.html" > < code class = "inline" > Cldr.LanguageTag< / code > < / a > struct returned by < code class = "inline" > MyApp.Cldr.Locale.new!/1< / code > < / p > < / li > < li > < p > < code class = "inline" > currency_status< / code > is < code class = "inline" > :all< / code > , < code class = "inline" > :current< / code > , < code class = "inline" > :historic< / code > ,
2023-07-12 11:28:07 +03:00
< code class = "inline" > unannotated< / code > or < code class = "inline" > :tender< / code > ; or a list of one or more status.
2024-01-11 10:50:44 +03:00
The default is < code class = "inline" > :all< / code > . See < a href = "https://hexdocs.pm/ex_cldr_currencies/2.15.1/Cldr.Currency.html#currency_filter/2" > < code class = "inline" > Cldr.Currency.currency_filter/2< / code > < / a > .< / p > < / li > < / ul > < h2 id = "currency_strings/3-returns" class = "section-heading" >
< a href = "#currency_strings/3-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, currency_string_map}< / code > or< / p > < / li > < li > < p > < code class = "inline" > {:error, {exception, reason}}< / code > < / p > < / li > < / ul > < h2 id = "currency_strings/3-example" class = "section-heading" >
2024-01-11 10:50:44 +03:00
< a href = "#currency_strings/3-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-06-06 17:49:53 +03:00
< pre > < code class = "makeup elixir" translate = "no" > < span class = "nc" > MyApp.Cldr.Currency< / span > < span class = "o" > .< / span > < span class = "n" > currency_strings< / span > < span class = "p" data-group-id = "9244596744-1" > (< / span > < span class = "s" > " en" < / span > < span class = "p" data-group-id = "9244596744-1" > )< / span > < span class = "w" >
< / span > < span class = "p" > => < / span > < span class = "w" > < / span > < span class = "p" data-group-id = "9244596744-2" > {< / span > < span class = "ss" > :ok< / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "p" data-group-id = "9244596744-3" > %{< / span > < span class = "w" >
2023-07-12 11:28:07 +03:00
< / span > < span class = "s" > " mexican silver pesos" < / span > < span class = "w" > < / span > < span class = "p" > => < / span > < span class = "w" > < / span > < span class = "ss" > :MXP< / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "s" > " sudanese dinar" < / span > < span class = "w" > < / span > < span class = "p" > => < / span > < span class = "w" > < / span > < span class = "ss" > :SDD< / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "s" > " bad" < / span > < span class = "w" > < / span > < span class = "p" > => < / span > < span class = "w" > < / span > < span class = "ss" > :BAD< / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "s" > " rsd" < / span > < span class = "w" > < / span > < span class = "p" > => < / span > < span class = "w" > < / span > < span class = "ss" > :RSD< / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "s" > " swazi lilangeni" < / span > < span class = "w" > < / span > < span class = "p" > => < / span > < span class = "w" > < / span > < span class = "ss" > :SZL< / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "s" > " zairean new zaire" < / span > < span class = "w" > < / span > < span class = "p" > => < / span > < span class = "w" > < / span > < span class = "ss" > :ZRN< / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "s" > " guyanaese dollars" < / span > < span class = "w" > < / span > < span class = "p" > => < / span > < span class = "w" > < / span > < span class = "ss" > :GYD< / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "s" > " equatorial guinean ekwele" < / span > < span class = "w" > < / span > < span class = "p" > => < / span > < span class = "w" > < / span > < span class = "ss" > :GQE< / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "n" > ...< / span > < span class = "w" >
2024-06-06 17:49:53 +03:00
< / span > < span class = "p" data-group-id = "9244596744-3" > }< / span > < span class = "p" data-group-id = "9244596744-2" > }< / span > < / code > < / pre >
2023-07-12 11:28:07 +03:00
< / section >
< / section >
< section class = "detail" id = "currency_strings!/3" >
< span id = "currency_strings!/1" > < / span >
< span id = "currency_strings!/2" > < / span >
< div class = "detail-header" >
< a href = "#currency_strings!/3" 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" > currency_strings!(locale_name, only \\ :all, except \\ nil)< / 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 > currency_strings!(
2024-01-11 10:50:44 +03:00
< a href = "https://hexdocs.pm/ex_cldr/2.37.5/Cldr.LanguageTag.html#t:t/0" > Cldr.LanguageTag.t< / a > () | < a href = "https://hexdocs.pm/ex_cldr/2.37.5/Cldr.Locale.html#t:locale_name/0" > Cldr.Locale.locale_name< / a > (),
only :: < a href = "https://hexdocs.pm/ex_cldr_currencies/2.15.1/Cldr.Currency.html#t:filter/0" > Cldr.Currency.filter< / a > (),
except :: < a href = "https://hexdocs.pm/ex_cldr_currencies/2.15.1/Cldr.Currency.html#t:filter/0" > Cldr.Currency.filter< / a > ()
2023-07-12 11:28:07 +03:00
) :: < a href = "https://hexdocs.pm/elixir/typespecs.html#basic-types" > map< / a > () | < a href = "https://hexdocs.pm/elixir/typespecs.html#built-in-types" > no_return< / a > ()< / pre >
< / div >
< p > Returns a map that matches a currency string to a
currency code or raises an exception.< / p > < p > A currency string is a localised name or symbol
representing a currency in a locale-specific manner.< / p > < h2 id = "currency_strings!/3-arguments" class = "section-heading" >
2024-01-11 10:50:44 +03:00
< a href = "#currency_strings!/3-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" > locale< / code > is any valid locale name returned by < code class = "inline" > MyApp.Cldr.known_locale_names/0< / code >
2024-01-11 10:50:44 +03:00
or a < a href = "https://hexdocs.pm/ex_cldr/2.37.5/Cldr.LanguageTag.html" > < code class = "inline" > Cldr.LanguageTag< / code > < / a > struct returned by < code class = "inline" > MyApp.Cldr.Locale.new!/1< / code > < / p > < / li > < li > < p > < code class = "inline" > currency_status< / code > is < code class = "inline" > :all< / code > , < code class = "inline" > :current< / code > , < code class = "inline" > :historic< / code > ,
2023-07-12 11:28:07 +03:00
< code class = "inline" > unannotated< / code > or < code class = "inline" > :tender< / code > ; or a list of one or more status.
2024-01-11 10:50:44 +03:00
The default is < code class = "inline" > :all< / code > . See < a href = "https://hexdocs.pm/ex_cldr_currencies/2.15.1/Cldr.Currency.html#currency_filter/2" > < code class = "inline" > Cldr.Currency.currency_filter/2< / code > < / a > .< / p > < / li > < / ul > < h2 id = "currency_strings!/3-returns" class = "section-heading" >
< a href = "#currency_strings!/3-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, currency_string_map}< / code > or< / p > < / li > < li > < p > raises an exception< / p > < / li > < / ul > < h2 id = "currency_strings!/3-example" class = "section-heading" >
2024-01-11 10:50:44 +03:00
< a href = "#currency_strings!/3-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-06-06 17:49:53 +03:00
< pre > < code class = "makeup elixir" translate = "no" > < span class = "nc" > MyApp.Cldr.Currency< / span > < span class = "o" > .< / span > < span class = "n" > currency_strings!< / span > < span class = "p" data-group-id = "3984550120-1" > (< / span > < span class = "s" > " en" < / span > < span class = "p" data-group-id = "3984550120-1" > )< / span > < span class = "w" >
< / span > < span class = "p" > => < / span > < span class = "w" > < / span > < span class = "p" data-group-id = "3984550120-2" > %{< / span > < span class = "w" >
2023-07-12 11:28:07 +03:00
< / span > < span class = "s" > " mexican silver pesos" < / span > < span class = "w" > < / span > < span class = "p" > => < / span > < span class = "w" > < / span > < span class = "ss" > :MXP< / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "s" > " sudanese dinar" < / span > < span class = "w" > < / span > < span class = "p" > => < / span > < span class = "w" > < / span > < span class = "ss" > :SDD< / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "s" > " bad" < / span > < span class = "w" > < / span > < span class = "p" > => < / span > < span class = "w" > < / span > < span class = "ss" > :BAD< / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "s" > " rsd" < / span > < span class = "w" > < / span > < span class = "p" > => < / span > < span class = "w" > < / span > < span class = "ss" > :RSD< / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "s" > " swazi lilangeni" < / span > < span class = "w" > < / span > < span class = "p" > => < / span > < span class = "w" > < / span > < span class = "ss" > :SZL< / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "s" > " zairean new zaire" < / span > < span class = "w" > < / span > < span class = "p" > => < / span > < span class = "w" > < / span > < span class = "ss" > :ZRN< / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "s" > " guyanaese dollars" < / span > < span class = "w" > < / span > < span class = "p" > => < / span > < span class = "w" > < / span > < span class = "ss" > :GYD< / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "s" > " equatorial guinean ekwele" < / span > < span class = "w" > < / span > < span class = "p" > => < / span > < span class = "w" > < / span > < span class = "ss" > :GQE< / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "n" > ...< / span > < span class = "w" >
2024-06-06 17:49:53 +03:00
< / span > < span class = "p" data-group-id = "3984550120-2" > }< / span > < / code > < / pre >
2023-07-12 11:28:07 +03:00
< / section >
< / section >
< section class = "detail" id = "current_currency_from_locale/1" >
< div class = "detail-header" >
< a href = "#current_currency_from_locale/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" > current_currency_from_locale(locale)< / 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 > Returns the current currency for a given locale.< / p > < p > This function does not consider the < code class = "inline" > U< / code > extenion
parameters < code class = "inline" > cu< / code > or < code class = "inline" > rg< / code > . It is recommended to us
2024-01-11 10:50:44 +03:00
< a href = "https://hexdocs.pm/ex_cldr_currencies/2.15.1/Cldr.Currency.html#currency_from_locale/1" > < code class = "inline" > Cldr.Currency.currency_from_locale/1< / code > < / a > in most
2023-07-12 11:28:07 +03:00
circumstances.< / p > < h2 id = "current_currency_from_locale/1-arguments" class = "section-heading" >
2024-01-11 10:50:44 +03:00
< a href = "#current_currency_from_locale/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" > locale< / code > is any valid locale name returned by < code class = "inline" > MyApp.Cldr.known_locale_names/0< / code >
2024-01-11 10:50:44 +03:00
or a < a href = "https://hexdocs.pm/ex_cldr/2.37.5/Cldr.LanguageTag.html" > < code class = "inline" > Cldr.LanguageTag< / code > < / a > struct returned by < code class = "inline" > MyApp.Cldr.Locale.new!/1< / code > < / li > < / ul > < h2 id = "current_currency_from_locale/1-example" class = "section-heading" >
< a href = "#current_currency_from_locale/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-06-06 17:49:53 +03:00
< pre > < code class = "makeup elixir" translate = "no" > < span class = "gp unselectable" > iex> < / span > < span class = "nc" > MyApp.Cldr.Currency< / span > < span class = "o" > .< / span > < span class = "n" > current_currency_from_locale< / span > < span class = "p" data-group-id = "6222737632-1" > (< / span > < span class = "s" > " en" < / span > < span class = "p" data-group-id = "6222737632-1" > )< / span > < span class = "w" >
2023-07-12 11:28:07 +03:00
< / span > < span class = "ss" > :USD< / span > < span class = "w" >
2024-06-06 17:49:53 +03:00
< / span > < span class = "gp unselectable" > iex> < / span > < span class = "nc" > MyApp.Cldr.Currency< / span > < span class = "o" > .< / span > < span class = "n" > current_currency_from_locale< / span > < span class = "p" data-group-id = "6222737632-2" > (< / span > < span class = "s" > " en-AU" < / span > < span class = "p" data-group-id = "6222737632-2" > )< / span > < span class = "w" >
2023-07-12 11:28:07 +03:00
< / span > < span class = "ss" > :AUD< / span > < / code > < / pre >
< / section >
< / section >
< section class = "detail" id = "current_territory_currencies/0" >
< div class = "detail-header" >
< a href = "#current_territory_currencies/0" 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" > current_territory_currencies()< / 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.15.0)< / span >
< / div >
< section class = "docstring" >
< div class = "specs" >
< pre translate = "no" > < span class = "attribute" > @spec< / span > current_territory_currencies() :: %{
2024-01-11 10:50:44 +03:00
required(< a href = "https://hexdocs.pm/ex_cldr/2.37.5/Cldr.Locale.html#t:territory_code/0" > Cldr.Locale.territory_code< / a > ()) => < a href = "https://hexdocs.pm/ex_cldr_currencies/2.15.1/Cldr.Currency.html#t:code/0" > Cldr.Currency.code< / a > ()
2023-07-12 11:28:07 +03:00
}< / pre >
< / div >
< p > Returns a mapping from a territory code to its
current currency code.< / p > < p > If a territory has no current currency (like
Antartica, territory code < code class = "inline" > :AQ< / code > ) then no
mapping is returned for that territory.< / p > < h2 id = "current_territory_currencies/0-returns" class = "section-heading" >
2024-01-11 10:50:44 +03:00
< a href = "#current_territory_currencies/0-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 > A map of < code class = "inline" > {territory_code => Cldr.Currency.t}< / code > < / li > < / ul > < h2 id = "current_territory_currencies/0-example" class = "section-heading" >
2024-01-11 10:50:44 +03:00
< a href = "#current_territory_currencies/0-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-06-06 17:49:53 +03:00
< pre > < code class = "makeup elixir" translate = "no" > < span class = "gp unselectable" > iex> < / span > < span class = "nc" > Plausible.Cldr.Currency< / span > < span class = "o" > .< / span > < span class = "n" > current_territory_currencies< / span > < span class = "p" data-group-id = "7282139692-1" > (< / span > < span class = "p" data-group-id = "7282139692-1" > )< / span > < / code > < / pre >
2023-07-12 11:28:07 +03:00
< / section >
< / section >
< section class = "detail" id = "known_currencies/0" >
< div class = "detail-header" >
< a href = "#known_currencies/0" 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" > known_currencies()< / 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 > See < a href = "#known_currency_codes/0" > < code class = "inline" > Plausible.Cldr.Currency.known_currency_codes/0< / code > < / a > .< / p >
< / section >
< / section >
< section class = "detail" id = "known_currency?/1" >
< div class = "detail-header" >
< a href = "#known_currency?/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" > known_currency?(code)< / 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 > See < a href = "#known_currency_code?/1" > < code class = "inline" > Plausible.Cldr.Currency.known_currency_code?/1< / code > < / a > .< / p >
< / section >
< / section >
< section class = "detail" id = "known_currency_code/1" >
< div class = "detail-header" >
< a href = "#known_currency_code/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" > known_currency_code(currency_code)< / 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" >
2024-01-11 10:50:44 +03:00
< pre translate = "no" > < span class = "attribute" > @spec< / span > known_currency_code(< a href = "https://hexdocs.pm/ex_cldr_currencies/2.15.1/Cldr.Currency.html#t:code/0" > Cldr.Currency.code< / a > ()) ::
{:ok, < a href = "https://hexdocs.pm/ex_cldr_currencies/2.15.1/Cldr.Currency.html#t:code/0" > Cldr.Currency.code< / a > ()} | {:error, {< a href = "https://hexdocs.pm/elixir/typespecs.html#built-in-types" > module< / a > (), < a href = "https://hexdocs.pm/elixir/String.html#t:t/0" > String.t< / a > ()}}< / pre >
2023-07-12 11:28:07 +03:00
< / div >
< p > Returns a 2-tuple indicating if the supplied currency code is known.< / p > < h2 id = "known_currency_code/1-arguments" class = "section-heading" >
2024-01-11 10:50:44 +03:00
< a href = "#known_currency_code/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" > currency_code< / code > is a < code class = "inline" > binary< / code > or < code class = "inline" > atom< / code > representing an ISO4217
currency code< / li > < / ul > < h2 id = "known_currency_code/1-returns" class = "section-heading" >
2024-01-11 10:50:44 +03:00
< a href = "#known_currency_code/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, currency_code}< / code > or< / p > < / li > < li > < p > < code class = "inline" > {:error, {exception, reason}}< / code > < / p > < / li > < / ul > < h2 id = "known_currency_code/1-examples" class = "section-heading" >
2024-01-11 10:50:44 +03:00
< a href = "#known_currency_code/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-06-06 17:49:53 +03:00
< pre > < code class = "makeup elixir" translate = "no" > < span class = "gp unselectable" > iex> < / span > < span class = "nc" > Plausible.Cldr.Currency< / span > < span class = "o" > .< / span > < span class = "n" > known_currency_code< / span > < span class = "p" data-group-id = "2018478534-1" > (< / span > < span class = "s" > " AUD" < / span > < span class = "p" data-group-id = "2018478534-1" > )< / span > < span class = "w" >
< / span > < span class = "p" data-group-id = "2018478534-2" > {< / span > < span class = "ss" > :ok< / span > < span class = "p" > ,< / span > < span class = "w" > < / span > < span class = "ss" > :AUD< / span > < span class = "p" data-group-id = "2018478534-2" > }< / span > < span class = "w" >
2023-07-12 11:28:07 +03:00
2024-06-06 17:49:53 +03:00
< / span > < span class = "gp unselectable" > iex> < / span > < span class = "nc" > Plausible.Cldr.Currency< / span > < span class = "o" > .< / span > < span class = "n" > known_currency_code< / span > < span class = "p" data-group-id = "2018478534-3" > (< / span > < span class = "s" > " GGG" < / span > < span class = "p" data-group-id = "2018478534-3" > )< / span > < span class = "w" >
< / span > < span class = "p" data-group-id = "2018478534-4" > {< / span > < span class = "ss" > :error< / span > < span class = "p" > ,< / span > < span class = "w" > < / span > < span class = "p" data-group-id = "2018478534-5" > {< / span > < span class = "nc" > Cldr.UnknownCurrencyError< / span > < span class = "p" > ,< / span > < span class = "w" > < / span > < span class = "s" > " The currency < / span > < span class = "se" > \" < / span > < span class = "s" > GGG< / span > < span class = "se" > \" < / span > < span class = "s" > is invalid" < / span > < span class = "p" data-group-id = "2018478534-5" > }< / span > < span class = "p" data-group-id = "2018478534-4" > }< / span > < / code > < / pre >
2023-07-12 11:28:07 +03:00
< / section >
< / section >
< section class = "detail" id = "known_currency_code?/1" >
< div class = "detail-header" >
< a href = "#known_currency_code?/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" > known_currency_code?(currency_code)< / 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" >
2024-01-11 10:50:44 +03:00
< pre translate = "no" > < span class = "attribute" > @spec< / span > known_currency_code?(< a href = "https://hexdocs.pm/ex_cldr_currencies/2.15.1/Cldr.Currency.html#t:code/0" > Cldr.Currency.code< / a > ()) :: < a href = "https://hexdocs.pm/elixir/typespecs.html#built-in-types" > boolean< / a > ()< / pre >
2023-07-12 11:28:07 +03:00
< / div >
< p > Returns a boolean indicating if the supplied currency code is known.< / p > < h2 id = "known_currency_code?/1-arguments" class = "section-heading" >
2024-01-11 10:50:44 +03:00
< a href = "#known_currency_code?/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" > currency_code< / code > is a < code class = "inline" > binary< / code > or < code class = "inline" > atom< / code > representing an ISO4217
currency code< / li > < / ul > < h2 id = "known_currency_code?/1-returns" class = "section-heading" >
2024-01-11 10:50:44 +03:00
< a href = "#known_currency_code?/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 > < code class = "inline" > true< / code > or < code class = "inline" > false< / code > < / li > < / ul > < h2 id = "known_currency_code?/1-examples" class = "section-heading" >
2024-01-11 10:50:44 +03:00
< a href = "#known_currency_code?/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-06-06 17:49:53 +03:00
< pre > < code class = "makeup elixir" translate = "no" > < span class = "gp unselectable" > iex> < / span > < span class = "nc" > Plausible.Cldr.Currency< / span > < span class = "o" > .< / span > < span class = "n" > known_currency_code?< / span > < span class = "p" data-group-id = "3805850896-1" > (< / span > < span class = "s" > " AUD" < / span > < span class = "p" data-group-id = "3805850896-1" > )< / span > < span class = "w" >
2023-07-12 11:28:07 +03:00
< / span > < span class = "no" > true< / span > < span class = "w" >
2024-06-06 17:49:53 +03:00
< / span > < span class = "gp unselectable" > iex> < / span > < span class = "nc" > Plausible.Cldr.Currency< / span > < span class = "o" > .< / span > < span class = "n" > known_currency_code?< / span > < span class = "p" data-group-id = "3805850896-2" > (< / span > < span class = "s" > " GGG" < / span > < span class = "p" data-group-id = "3805850896-2" > )< / span > < span class = "w" >
2023-07-12 11:28:07 +03:00
< / span > < span class = "no" > false< / span > < span class = "w" >
2024-06-06 17:49:53 +03:00
< / span > < span class = "gp unselectable" > iex> < / span > < span class = "nc" > Plausible.Cldr.Currency< / span > < span class = "o" > .< / span > < span class = "n" > known_currency_code?< / span > < span class = "p" data-group-id = "3805850896-3" > (< / span > < span class = "ss" > :XCV< / span > < span class = "p" data-group-id = "3805850896-3" > )< / span > < span class = "w" >
2023-07-12 11:28:07 +03:00
< / span > < span class = "no" > false< / span > < / code > < / pre >
< / section >
< / section >
< section class = "detail" id = "known_currency_codes/0" >
< div class = "detail-header" >
< a href = "#known_currency_codes/0" 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" > known_currency_codes()< / 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 > known_currency_codes() :: [< a href = "https://hexdocs.pm/elixir/typespecs.html#basic-types" > atom< / a > ()]< / pre >
< / div >
< p > Returns a list of all known currency codes.< / p > < h2 id = "known_currency_codes/0-example" class = "section-heading" >
2024-01-11 10:50:44 +03:00
< a href = "#known_currency_codes/0-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-06-06 17:49:53 +03:00
< pre > < code class = "makeup elixir" translate = "no" > < span class = "gp unselectable" > iex> < / span > < span class = "nc" > Plausible.Cldr.Currency< / span > < span class = "o" > .< / span > < span class = "n" > known_currency_codes< / span > < span class = "p" data-group-id = "0333409788-1" > (< / span > < span class = "p" data-group-id = "0333409788-1" > )< / span > < / code > < / pre >
2023-07-12 11:28:07 +03:00
< / section >
< / section >
< section class = "detail" id = "new/2" >
< span id = "new/1" > < / span >
< div class = "detail-header" >
< a href = "#new/2" 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" > new(currency, options \\ [])< / 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" >
2024-01-11 10:50:44 +03:00
< pre translate = "no" > < span class = "attribute" > @spec< / span > new(< a href = "https://hexdocs.pm/ex_cldr_currencies/2.15.1/Cldr.Currency.html#t:code/0" > Cldr.Currency.code< / a > (), < a href = "https://hexdocs.pm/elixir/typespecs.html#basic-types" > map< / a > () | < a href = "https://hexdocs.pm/elixir/Keyword.html#t:t/0" > Keyword.t< / a > ()) ::
{:ok, < a href = "https://hexdocs.pm/ex_cldr_currencies/2.15.1/Cldr.Currency.html#t:t/0" > Cldr.Currency.t< / a > ()} | {:error, {< a href = "https://hexdocs.pm/elixir/typespecs.html#built-in-types" > module< / a > (), < a href = "https://hexdocs.pm/elixir/String.html#t:t/0" > String.t< / a > ()}}< / pre >
2023-07-12 11:28:07 +03:00
< / div >
< p > Returns a < code class = "inline" > Currency< / code > struct created from the arguments.< / p > < h2 id = "new/2-arguments" class = "section-heading" >
2024-01-11 10:50:44 +03:00
< a href = "#new/2-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" > currency< / code > is a private use currency code in a format defined by
< a href = "https://en.wikipedia.org/wiki/ISO_4217" > ISO4217< / a >
which is < code class = "inline" > X< / code > followed by two alphanumeric characters.< / p > < / li > < li > < p > < code class = "inline" > options< / code > is a map of options representing the optional elements of
the < code class = "inline" > Cldr.Currency.t< / code > struct.< / p > < / li > < / ul > < h2 id = "new/2-options" class = "section-heading" >
2024-01-11 10:50:44 +03:00
< a href = "#new/2-options" 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" > Options< / span >
2023-07-12 11:28:07 +03:00
< / h2 >
< ul > < li > < code class = "inline" > :name< / code > is the name of the currency. Required.< / li > < li > < code class = "inline" > :digits< / code > is the precision of the currency. Required.< / li > < li > < code class = "inline" > :symbol< / code > is the currency symbol. Optional.< / li > < li > < code class = "inline" > :narrow_symbol< / code > is an alternative narrow symbol. Optional.< / li > < li > < code class = "inline" > :round_nearest< / code > is the rounding precision such as < code class = "inline" > 0.05< / code > . Optional.< / li > < li > < code class = "inline" > :alt_code< / code > is an alternative currency code for application use.< / li > < li > < code class = "inline" > :cash_digits< / code > is the precision of the currency when used as cash. Optional.< / li > < li > < code class = "inline" > :cash_rounding_nearest< / code > is the rounding precision when used as cash
such as < code class = "inline" > 0.05< / code > . Optional.< / li > < / ul > < h2 id = "new/2-returns" class = "section-heading" >
2024-01-11 10:50:44 +03:00
< a href = "#new/2-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, Cldr.Currency.t}< / code > or< / p > < / li > < li > < p > < code class = "inline" > {:error, {exception, message}}< / code > < / p > < / li > < / ul > < h2 id = "new/2-example" class = "section-heading" >
2024-01-11 10:50:44 +03:00
< a href = "#new/2-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-06-06 17:49:53 +03:00
< pre > < code class = "makeup elixir" translate = "no" > < span class = "gp unselectable" > iex> < / span > < span class = "nc" > Plausible.Cldr.Currency< / span > < span class = "o" > .< / span > < span class = "n" > new< / span > < span class = "p" data-group-id = "0683913324-1" > (< / span > < span class = "ss" > :XAE< / span > < span class = "p" > ,< / span > < span class = "w" > < / span > < span class = "ss" > name< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "s" > " Custom Name" < / span > < span class = "p" > ,< / span > < span class = "w" > < / span > < span class = "ss" > digits< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "mi" > 0< / span > < span class = "p" data-group-id = "0683913324-1" > )< / span > < span class = "w" >
< / span > < span class = "p" data-group-id = "0683913324-2" > {< / span > < span class = "ss" > :ok< / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "p" data-group-id = "0683913324-3" > %< / span > < span class = "nc" data-group-id = "0683913324-3" > Cldr.Currency< / span > < span class = "p" data-group-id = "0683913324-3" > {< / span > < span class = "w" >
2023-07-12 11:28:07 +03:00
< / span > < span class = "ss" > alt_code< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "ss" > :XAE< / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "ss" > cash_digits< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "mi" > 0< / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "ss" > cash_rounding< / 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" > code< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "ss" > :XAE< / span > < span class = "p" > ,< / span > < span class = "w" >
2024-06-06 17:49:53 +03:00
< / span > < span class = "ss" > count< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "p" data-group-id = "0683913324-4" > %{< / span > < span class = "ss" > other< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "s" > " Custom Name" < / span > < span class = "p" data-group-id = "0683913324-4" > }< / span > < span class = "p" > ,< / span > < span class = "w" >
2023-07-12 11:28:07 +03:00
< / span > < span class = "ss" > digits< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "mi" > 0< / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "ss" > from< / 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" > iso_digits< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "mi" > 0< / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "ss" > name< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "s" > " Custom Name" < / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "ss" > narrow_symbol< / 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" > rounding< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "mi" > 0< / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "ss" > symbol< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "s" > " XAE" < / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "ss" > tender< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "no" > false< / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "ss" > to< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "no" > nil< / span > < span class = "w" >
2024-06-06 17:49:53 +03:00
< / span > < span class = "p" data-group-id = "0683913324-3" > }< / span > < span class = "p" data-group-id = "0683913324-2" > }< / span > < span class = "w" >
< / span > < span class = "gp unselectable" > iex> < / span > < span class = "nc" > MyApp.Cldr.Currency< / span > < span class = "o" > .< / span > < span class = "n" > new< / span > < span class = "p" data-group-id = "0683913324-5" > (< / span > < span class = "ss" > :XAH< / span > < span class = "p" > ,< / span > < span class = "w" > < / span > < span class = "ss" > name< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "s" > " Custom Name" < / span > < span class = "p" data-group-id = "0683913324-5" > )< / span > < span class = "w" >
< / span > < span class = "p" data-group-id = "0683913324-6" > {< / span > < span class = "ss" > :error< / span > < span class = "p" > ,< / span > < span class = "w" > < / span > < span class = "s" > " Required options are missing. Required options are [:name, :digits]" < / span > < span class = "p" data-group-id = "0683913324-6" > }< / span > < span class = "w" >
< / span > < span class = "gp unselectable" > iex> < / span > < span class = "nc" > Plausible.Cldr.Currency< / span > < span class = "o" > .< / span > < span class = "n" > new< / span > < span class = "p" data-group-id = "0683913324-7" > (< / span > < span class = "ss" > :XAE< / span > < span class = "p" > ,< / span > < span class = "w" > < / span > < span class = "ss" > name< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "s" > " XAE" < / span > < span class = "p" > ,< / span > < span class = "w" > < / span > < span class = "ss" > digits< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "mi" > 0< / span > < span class = "p" data-group-id = "0683913324-7" > )< / span > < span class = "w" >
< / span > < span class = "p" data-group-id = "0683913324-8" > {< / span > < span class = "ss" > :error< / span > < span class = "p" > ,< / span > < span class = "w" > < / span > < span class = "p" data-group-id = "0683913324-9" > {< / span > < span class = "nc" > Cldr.CurrencyAlreadyDefined< / span > < span class = "p" > ,< / span > < span class = "w" > < / span > < span class = "s" > " Currency :XAE is already defined." < / span > < span class = "p" data-group-id = "0683913324-9" > }< / span > < span class = "p" data-group-id = "0683913324-8" > }< / span > < / code > < / pre >
2023-07-12 11:28:07 +03:00
< / section >
< / section >
< section class = "detail" id = "pluralize/3" >
< span id = "pluralize/2" > < / span >
< div class = "detail-header" >
< a href = "#pluralize/3" 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" > pluralize(number, currency, options \\ [])< / 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 > pluralize(< a href = "https://hexdocs.pm/elixir/typespecs.html#basic-types" > pos_integer< / a > (), < a href = "https://hexdocs.pm/elixir/typespecs.html#basic-types" > atom< / a > (), < a href = "https://hexdocs.pm/elixir/Keyword.html#t:t/0" > Keyword.t< / a > ()) ::
{:ok, < a href = "https://hexdocs.pm/elixir/String.html#t:t/0" > String.t< / a > ()} | {:error, {< a href = "https://hexdocs.pm/elixir/typespecs.html#built-in-types" > module< / a > (), < a href = "https://hexdocs.pm/elixir/String.html#t:t/0" > String.t< / a > ()}}< / pre >
< / div >
< p > Returns the appropriate currency display name for the < code class = "inline" > currency< / code > , based
on the plural rules in effect for the < code class = "inline" > locale< / code > .< / p > < h2 id = "pluralize/3-arguments" class = "section-heading" >
2024-01-11 10:50:44 +03:00
< a href = "#pluralize/3-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 >
2024-01-11 10:50:44 +03:00
< ul > < li > < p > < code class = "inline" > number< / code > is an integer, float or < a href = "https://hexdocs.pm/decimal/2.1.1/Decimal.html" > < code class = "inline" > Decimal< / code > < / a > < / p > < / li > < li > < p > < code class = "inline" > currency< / code > is any currency returned by < a href = "https://hexdocs.pm/ex_cldr_currencies/2.15.1/Cldr.Currency.html#known_currencies/0" > < code class = "inline" > Cldr.Currency.known_currencies/0< / code > < / a > < / p > < / li > < li > < p > < code class = "inline" > options< / code > is a keyword list of options< / p > < / li > < / ul > < h2 id = "pluralize/3-options" class = "section-heading" >
< a href = "#pluralize/3-options" 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" > Options< / span >
2023-07-12 11:28:07 +03:00
< / h2 >
< ul > < li > < code class = "inline" > locale< / code > is any valid locale name returned by < code class = "inline" > MyApp.Cldr.known_locale_names/0< / code >
2024-01-11 10:50:44 +03:00
or a < a href = "https://hexdocs.pm/ex_cldr/2.37.5/Cldr.LanguageTag.html" > < code class = "inline" > Cldr.LanguageTag< / code > < / a > struct returned by < code class = "inline" > MyApp.Cldr.Locale.new!/1< / code > . The
2023-07-12 11:28:07 +03:00
default is < a href = "Plausible.Cldr.html#get_locale/0" > < code class = "inline" > Plausible.Cldr.get_locale/0< / code > < / a > < / li > < / ul > < h2 id = "pluralize/3-returns" class = "section-heading" >
2024-01-11 10:50:44 +03:00
< a href = "#pluralize/3-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, plural_string}< / code > or< / p > < / li > < li > < p > < code class = "inline" > {:error, {exception, message}}< / code > < / p > < / li > < / ul > < h2 id = "pluralize/3-examples" class = "section-heading" >
2024-01-11 10:50:44 +03:00
< a href = "#pluralize/3-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-06-06 17:49:53 +03:00
< pre > < code class = "makeup elixir" translate = "no" > < span class = "gp unselectable" > iex> < / span > < span class = "nc" > Plausible.Cldr.Currency< / span > < span class = "o" > .< / span > < span class = "n" > pluralize< / span > < span class = "p" data-group-id = "2530662788-1" > (< / span > < span class = "mi" > 1< / span > < span class = "p" > ,< / span > < span class = "w" > < / span > < span class = "ss" > :USD< / span > < span class = "p" data-group-id = "2530662788-1" > )< / span > < span class = "w" >
< / span > < span class = "p" data-group-id = "2530662788-2" > {< / span > < span class = "ss" > :ok< / span > < span class = "p" > ,< / span > < span class = "w" > < / span > < span class = "s" > " US dollar" < / span > < span class = "p" data-group-id = "2530662788-2" > }< / span > < span class = "w" >
2023-07-12 11:28:07 +03:00
2024-06-06 17:49:53 +03:00
< / span > < span class = "gp unselectable" > iex> < / span > < span class = "nc" > Plausible.Cldr.Currency< / span > < span class = "o" > .< / span > < span class = "n" > pluralize< / span > < span class = "p" data-group-id = "2530662788-3" > (< / span > < span class = "mi" > 3< / span > < span class = "p" > ,< / span > < span class = "w" > < / span > < span class = "ss" > :USD< / span > < span class = "p" data-group-id = "2530662788-3" > )< / span > < span class = "w" >
< / span > < span class = "p" data-group-id = "2530662788-4" > {< / span > < span class = "ss" > :ok< / span > < span class = "p" > ,< / span > < span class = "w" > < / span > < span class = "s" > " US dollars" < / span > < span class = "p" data-group-id = "2530662788-4" > }< / span > < span class = "w" >
2023-07-12 11:28:07 +03:00
2024-06-06 17:49:53 +03:00
< / span > < span class = "gp unselectable" > iex> < / span > < span class = "nc" > Plausible.Cldr.Currency< / span > < span class = "o" > .< / span > < span class = "n" > pluralize< / span > < span class = "p" data-group-id = "2530662788-5" > (< / span > < span class = "mi" > 12< / span > < span class = "p" > ,< / span > < span class = "w" > < / span > < span class = "ss" > :USD< / span > < span class = "p" > ,< / span > < span class = "w" > < / span > < span class = "ss" > locale< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "s" > " zh" < / span > < span class = "p" data-group-id = "2530662788-5" > )< / span > < span class = "w" >
< / span > < span class = "p" data-group-id = "2530662788-6" > {< / span > < span class = "ss" > :ok< / span > < span class = "p" > ,< / span > < span class = "w" > < / span > < span class = "s" > " 美元" < / span > < span class = "p" data-group-id = "2530662788-6" > }< / span > < span class = "w" >
2023-07-12 11:28:07 +03:00
2024-06-06 17:49:53 +03:00
< / span > < span class = "gp unselectable" > iex> < / span > < span class = "nc" > Plausible.Cldr.Currency< / span > < span class = "o" > .< / span > < span class = "n" > pluralize< / span > < span class = "p" data-group-id = "2530662788-7" > (< / span > < span class = "mi" > 12< / span > < span class = "p" > ,< / span > < span class = "w" > < / span > < span class = "ss" > :USD< / span > < span class = "p" > ,< / span > < span class = "w" > < / span > < span class = "ss" > locale< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "s" > " fr" < / span > < span class = "p" data-group-id = "2530662788-7" > )< / span > < span class = "w" >
< / span > < span class = "p" data-group-id = "2530662788-8" > {< / span > < span class = "ss" > :ok< / span > < span class = "p" > ,< / span > < span class = "w" > < / span > < span class = "s" > " dollars des États-Unis" < / span > < span class = "p" data-group-id = "2530662788-8" > }< / span > < span class = "w" >
2023-07-12 11:28:07 +03:00
2024-06-06 17:49:53 +03:00
< / span > < span class = "gp unselectable" > iex> < / span > < span class = "nc" > Plausible.Cldr.Currency< / span > < span class = "o" > .< / span > < span class = "n" > pluralize< / span > < span class = "p" data-group-id = "2530662788-9" > (< / span > < span class = "mi" > 1< / span > < span class = "p" > ,< / span > < span class = "w" > < / span > < span class = "ss" > :USD< / span > < span class = "p" > ,< / span > < span class = "w" > < / span > < span class = "ss" > locale< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "s" > " fr" < / span > < span class = "p" data-group-id = "2530662788-9" > )< / span > < span class = "w" >
< / span > < span class = "p" data-group-id = "2530662788-10" > {< / span > < span class = "ss" > :ok< / span > < span class = "p" > ,< / span > < span class = "w" > < / span > < span class = "s" > " dollar des États-Unis" < / span > < span class = "p" data-group-id = "2530662788-10" > }< / span > < / code > < / pre >
2023-07-12 11:28:07 +03:00
< / section >
< / section >
< section class = "detail" id = "strings_for_currency/2" >
< div class = "detail-header" >
< a href = "#strings_for_currency/2" 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" > strings_for_currency(currency, locale)< / 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 > Returns the strings associated with a currency
in a given locale.< / p > < h2 id = "strings_for_currency/2-arguments" class = "section-heading" >
2024-01-11 10:50:44 +03:00
< a href = "#strings_for_currency/2-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" > currency< / code > is an ISO4217 currency code< / p > < / li > < li > < p > < code class = "inline" > locale< / code > is any valid locale name returned by < code class = "inline" > MyApp.Cldr.known_locale_names/0< / code >
2024-01-11 10:50:44 +03:00
or a < a href = "https://hexdocs.pm/ex_cldr/2.37.5/Cldr.LanguageTag.html" > < code class = "inline" > Cldr.LanguageTag< / code > < / a > struct returned by < code class = "inline" > MyApp.Cldr.Locale.new!/1< / code > < / p > < / li > < / ul > < h2 id = "strings_for_currency/2-returns" class = "section-heading" >
< a href = "#strings_for_currency/2-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 > A list of strings or< / p > < / li > < li > < p > < code class = "inline" > {:error, {exception, reason}}< / code > < / p > < / li > < / ul > < h2 id = "strings_for_currency/2-example" class = "section-heading" >
2024-01-11 10:50:44 +03:00
< a href = "#strings_for_currency/2-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-06-06 17:49:53 +03:00
< pre > < code class = "makeup elixir" translate = "no" > < span class = "gp unselectable" > iex> < / span > < span class = "nc" > MyApp.Cldr.Currency< / span > < span class = "o" > .< / span > < span class = "n" > strings_for_currency< / span > < span class = "p" data-group-id = "7032913797-1" > (< / span > < span class = "ss" > :AUD< / span > < span class = "p" > ,< / span > < span class = "w" > < / span > < span class = "s" > " en" < / span > < span class = "p" data-group-id = "7032913797-1" > )< / span > < span class = "w" >
< / span > < span class = "p" data-group-id = "7032913797-2" > [< / span > < span class = "s" > " a$" < / span > < span class = "p" > ,< / span > < span class = "w" > < / span > < span class = "s" > " australian dollars" < / span > < span class = "p" > ,< / span > < span class = "w" > < / span > < span class = "s" > " aud" < / span > < span class = "p" > ,< / span > < span class = "w" > < / span > < span class = "s" > " australian dollar" < / span > < span class = "p" data-group-id = "7032913797-2" > ]< / 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-16 10:41:49 +03:00
< a href = "https://github.com/elixir-lang/ex_doc" title = "ExDoc" target = "_blank" rel = "help noopener" translate = "no" > ExDoc< / a > (v0.31.1) 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 >