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.Number.System — 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-05-14 14:51:06 +03:00
< script src = "dist/sidebar_items-B75C87F2.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.Number.System< / 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 = "#number_system_for/2" translate = "no" > number_system_for(locale, system_name)< / a >
< / div >
< div class = "summary-synopsis" > < p > Returns the actual number system from a number system type.< / p > < / div >
< / div >
< div class = "summary-row" >
< div class = "summary-signature" >
< a href = "#number_system_from_locale/1" translate = "no" > number_system_from_locale(locale)< / a >
< / div >
< div class = "summary-synopsis" > < p > Returns the number system from a language tag or
locale name.< / p > < / div >
< / div >
< div class = "summary-row" >
< div class = "summary-signature" >
< a href = "#number_system_names_for/1" translate = "no" > number_system_names_for(locale)< / a >
< / div >
< div class = "summary-synopsis" > < p > Returns the number systems available for a locale
or < code class = "inline" > {:error, message}< / code > if the locale is not known.< / p > < / div >
< / div >
< div class = "summary-row" >
< div class = "summary-signature" >
< a href = "#number_system_names_for!/1" translate = "no" > number_system_names_for!(locale)< / a >
< / div >
< / div >
< div class = "summary-row" >
< div class = "summary-signature" >
< a href = "#number_system_types_for/1" translate = "no" > number_system_types_for(locale)< / a >
< / div >
< / div >
< div class = "summary-row" >
< div class = "summary-signature" >
< a href = "#number_systems_for/1" translate = "no" > number_systems_for(locale)< / a >
< / div >
< div class = "summary-synopsis" > < p > Returns the number systems available for a locale
or < code class = "inline" > {:error, message}< / code > if the locale is not known.< / p > < / div >
< / div >
< div class = "summary-row" >
< div class = "summary-signature" >
< a href = "#number_systems_for!/1" translate = "no" > number_systems_for!(locale)< / a >
< / div >
< / div >
< div class = "summary-row" >
< div class = "summary-signature" >
< a href = "#number_systems_like/2" translate = "no" > number_systems_like(locale, number_system)< / a >
< / div >
< / div >
< div class = "summary-row" >
< div class = "summary-signature" >
< a href = "#system_name_from/2" translate = "no" > system_name_from(system_name, locale)< / a >
< / div >
< div class = "summary-synopsis" > < p > Returns a number system name for a given locale and number system reference.< / p > < / div >
< / div >
< div class = "summary-row" >
< div class = "summary-signature" >
< a href = "#to_system/2" translate = "no" > to_system(number, system)< / a >
< / div >
< div class = "summary-synopsis" > < p > Converts a number into the representation of
a non-latin number system.< / p > < / div >
< / div >
< div class = "summary-row" >
< div class = "summary-signature" >
< a href = "#to_system!/2" translate = "no" > to_system!(number, system_name)< / a >
< / div >
< div class = "summary-synopsis" > < p > Converts a number into the representation of
a non-latin number system. Returns a converted
string or raises on error.< / 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 = "number_system_for/2" >
< div class = "detail-header" >
< a href = "#number_system_for/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" > number_system_for(locale, system_name)< / 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 > number_system_for(
2024-01-11 10:50:44 +03:00
< a href = "https://hexdocs.pm/ex_cldr/2.37.5/Cldr.Locale.html#t:locale_reference/0" > Cldr.Locale.locale_reference< / a > (),
< a href = "https://hexdocs.pm/ex_cldr_numbers/2.32.3/Cldr.Number.System.html#t:system_name/0" > Cldr.Number.System.system_name< / a > ()
2023-07-12 11:28:07 +03:00
) ::
{:ok, [< a href = "https://hexdocs.pm/elixir/typespecs.html#basic-types" > atom< / 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 >
2024-01-11 10:50:44 +03:00
< p > Returns the actual number system from a number system type.< / p > < ul > < li > < p > < 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/0" > < code class = "inline" > Cldr.known_locale_names/0< / 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 > < / p > < / li > < li > < p > < code class = "inline" > system_name< / code > is any number system name returned by
< a href = "https://hexdocs.pm/ex_cldr/2.37.5/Cldr.html#known_number_systems/0" > < code class = "inline" > Cldr.known_number_systems/0< / code > < / a > or a number system type
returned by < a href = "https://hexdocs.pm/ex_cldr/2.37.5/Cldr.html#known_number_system_types/0" > < code class = "inline" > Cldr.known_number_system_types/0< / code > < / a > < / p > < / li > < / ul > < p > This function will decode a number system type into the actual
2023-07-12 11:28:07 +03:00
number system. If the number system provided can't be decoded
it is returned as is.< / p > < h2 id = "number_system_for/2-examples" class = "section-heading" >
2024-01-11 10:50:44 +03:00
< a href = "#number_system_for/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 >
< pre > < code class = "makeup elixir" translate = "no" > < span class = "gp unselectable" > iex> < / span > < span class = "nc" > Plausible.Cldr.Number.System< / span > < span class = "o" > .< / span > < span class = "n" > number_system_for< / span > < span class = "w" > < / span > < span class = "s" > " th" < / span > < span class = "p" > ,< / span > < span class = "w" > < / span > < span class = "ss" > :latn< / span > < span class = "w" >
2024-05-15 11:51:25 +03:00
< / span > < span class = "p" data-group-id = "4971145356-1" > {< / span > < span class = "ss" > :ok< / span > < span class = "p" > ,< / span > < span class = "w" > < / span > < span class = "p" data-group-id = "4971145356-2" > %{< / span > < span class = "ss" > digits< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "s" > " 0123456789" < / span > < span class = "p" > ,< / span > < span class = "w" > < / span > < span class = "ss" > type< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "ss" > :numeric< / span > < span class = "p" data-group-id = "4971145356-2" > }< / span > < span class = "p" data-group-id = "4971145356-1" > }< / span > < span class = "w" >
2023-07-12 11:28:07 +03:00
< / span > < span class = "gp unselectable" > iex> < / span > < span class = "nc" > Plausible.Cldr.Number.System< / span > < span class = "o" > .< / span > < span class = "n" > number_system_for< / span > < span class = "w" > < / span > < span class = "s" > " en" < / span > < span class = "p" > ,< / span > < span class = "w" > < / span > < span class = "ss" > :default< / span > < span class = "w" >
2024-05-15 11:51:25 +03:00
< / span > < span class = "p" data-group-id = "4971145356-3" > {< / span > < span class = "ss" > :ok< / span > < span class = "p" > ,< / span > < span class = "w" > < / span > < span class = "p" data-group-id = "4971145356-4" > %{< / span > < span class = "ss" > digits< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "s" > " 0123456789" < / span > < span class = "p" > ,< / span > < span class = "w" > < / span > < span class = "ss" > type< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "ss" > :numeric< / span > < span class = "p" data-group-id = "4971145356-4" > }< / span > < span class = "p" data-group-id = "4971145356-3" > }< / span > < span class = "w" >
2023-07-12 11:28:07 +03:00
< / span > < span class = "gp unselectable" > iex> < / span > < span class = "nc" > Plausible.Cldr.Number.System< / span > < span class = "o" > .< / span > < span class = "n" > number_system_for< / span > < span class = "w" > < / span > < span class = "s" > " he" < / span > < span class = "p" > ,< / span > < span class = "w" > < / span > < span class = "ss" > :traditional< / span > < span class = "w" >
2024-05-15 11:51:25 +03:00
< / span > < span class = "p" data-group-id = "4971145356-5" > {< / span > < span class = "ss" > :ok< / span > < span class = "p" > ,< / span > < span class = "w" > < / span > < span class = "p" data-group-id = "4971145356-6" > %{< / span > < span class = "ss" > rules< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "s" > " hebrew" < / span > < span class = "p" > ,< / span > < span class = "w" > < / span > < span class = "ss" > type< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "ss" > :algorithmic< / span > < span class = "p" data-group-id = "4971145356-6" > }< / span > < span class = "p" data-group-id = "4971145356-5" > }< / span > < span class = "w" >
2023-07-12 11:28:07 +03:00
< / span > < span class = "gp unselectable" > iex> < / span > < span class = "nc" > Plausible.Cldr.Number.System< / span > < span class = "o" > .< / span > < span class = "n" > number_system_for< / span > < span class = "w" > < / span > < span class = "s" > " en" < / span > < span class = "p" > ,< / span > < span class = "w" > < / span > < span class = "ss" > :native< / span > < span class = "w" >
2024-05-15 11:51:25 +03:00
< / span > < span class = "p" data-group-id = "4971145356-7" > {< / span > < span class = "ss" > :ok< / span > < span class = "p" > ,< / span > < span class = "w" > < / span > < span class = "p" data-group-id = "4971145356-8" > %{< / span > < span class = "ss" > digits< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "s" > " 0123456789" < / span > < span class = "p" > ,< / span > < span class = "w" > < / span > < span class = "ss" > type< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "ss" > :numeric< / span > < span class = "p" data-group-id = "4971145356-8" > }< / span > < span class = "p" data-group-id = "4971145356-7" > }< / span > < span class = "w" >
2023-07-12 11:28:07 +03:00
< / span > < span class = "gp unselectable" > iex> < / span > < span class = "nc" > Plausible.Cldr.Number.System< / span > < span class = "o" > .< / span > < span class = "n" > number_system_for< / span > < span class = "w" > < / span > < span class = "s" > " en" < / span > < span class = "p" > ,< / span > < span class = "w" > < / span > < span class = "ss" > :finance< / span > < span class = "w" >
2024-05-15 11:51:25 +03:00
< / span > < span class = "p" data-group-id = "4971145356-9" > {< / span > < span class = "w" >
2023-07-12 11:28:07 +03:00
< / span > < span class = "ss" > :error< / span > < span class = "p" > ,< / span > < span class = "w" >
2024-05-15 11:51:25 +03:00
< / span > < span class = "p" data-group-id = "4971145356-10" > {< / span > < span class = "nc" > Cldr.UnknownNumberSystemError< / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "s" > " The number system :finance is unknown for the locale named :en. Valid number systems are %{default: :latn, native: :latn}" < / span > < span class = "p" data-group-id = "4971145356-10" > }< / span > < span class = "w" >
< / span > < span class = "p" data-group-id = "4971145356-9" > }< / span > < / code > < / pre >
2023-07-12 11:28:07 +03:00
< / section >
< / section >
< section class = "detail" id = "number_system_from_locale/1" >
< div class = "detail-header" >
< a href = "#number_system_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" > number_system_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" >
< div class = "specs" >
2024-01-11 10:50:44 +03:00
< pre translate = "no" > < span class = "attribute" > @spec< / span > number_system_from_locale(< a href = "https://hexdocs.pm/ex_cldr/2.37.5/Cldr.Locale.html#t:locale_reference/0" > Cldr.Locale.locale_reference< / a > ()) ::
< a href = "https://hexdocs.pm/ex_cldr_numbers/2.32.3/Cldr.Number.System.html#t:system_name/0" > Cldr.Number.System.system_name< / a > ()< / pre >
2023-07-12 11:28:07 +03:00
< / div >
< p > Returns the number system from a language tag or
locale name.< / p > < h2 id = "number_system_from_locale/1-arguments" class = "section-heading" >
2024-01-11 10:50:44 +03:00
< a href = "#number_system_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 any language tag returned be < a href = "https://hexdocs.pm/ex_cldr/2.37.5/Cldr.Locale.html#new/2" > < code class = "inline" > Cldr.Locale.new/2< / code > < / a >
or a locale name in the list 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 > < / li > < / ul > < h2 id = "number_system_from_locale/1-returns" class = "section-heading" >
< a href = "#number_system_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 number system name as an atom< / li > < / ul > < h2 id = "number_system_from_locale/1-examples" class = "section-heading" >
2024-01-11 10:50:44 +03:00
< a href = "#number_system_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 >
< pre > < code class = "makeup elixir" translate = "no" > < span class = "gp unselectable" > iex> < / span > < span class = "nc" > Plausible.Cldr.Number.System< / span > < span class = "o" > .< / span > < span class = "n" > number_system_from_locale< / span > < span class = "w" > < / span > < span class = "s" > " en-US-u-nu-thai" < / span > < span class = "w" >
< / span > < span class = "ss" > :thai< / span > < span class = "w" >
< / span > < span class = "gp unselectable" > iex> < / span > < span class = "nc" > Plausible.Cldr.Number.System< / span > < span class = "o" > .< / span > < span class = "n" > number_system_from_locale< / span > < span class = "w" > < / span > < span class = "s" > " en-US" < / span > < span class = "w" >
< / span > < span class = "ss" > :latn< / span > < / code > < / pre >
< / section >
< / section >
< section class = "detail" id = "number_system_names_for/1" >
< div class = "detail-header" >
< a href = "#number_system_names_for/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" > number_system_names_for(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 > number_system_names_for(< a href = "https://hexdocs.pm/ex_cldr/2.37.5/Cldr.Locale.html#t:locale_reference/0" > Cldr.Locale.locale_reference< / a > ()) ::
2023-07-12 11:28:07 +03:00
{:ok, [< a href = "https://hexdocs.pm/elixir/typespecs.html#basic-types" > atom< / 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 number systems available for a locale
or < code class = "inline" > {:error, message}< / code > if the locale is not known.< / p > < ul > < li > < code class = "inline" > locale< / code > is any valid locale name returned by < a href = "Plausible.Cldr.html#known_locale_names/0" > < code class = "inline" > Plausible.Cldr.known_locale_names/0< / code > < / a >
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 < a href = "Plausible.Cldr.Locale.html#new!/1" > < code class = "inline" > Plausible.Cldr.Locale.new!/1< / code > < / a > < / li > < / ul > < h2 id = "number_system_names_for/1-examples" class = "section-heading" >
< a href = "#number_system_names_for/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 >
< pre > < code class = "makeup elixir" translate = "no" > < span class = "gp unselectable" > iex> < / span > < span class = "nc" > Plausible.Cldr.Number.System< / span > < span class = "o" > .< / span > < span class = "n" > number_system_names_for< / span > < span class = "w" > < / span > < span class = "s" > " en" < / span > < span class = "w" >
2024-05-15 11:51:25 +03:00
< / span > < span class = "p" data-group-id = "7779600358-1" > {< / span > < span class = "ss" > :ok< / span > < span class = "p" > ,< / span > < span class = "w" > < / span > < span class = "p" data-group-id = "7779600358-2" > [< / span > < span class = "ss" > :latn< / span > < span class = "p" data-group-id = "7779600358-2" > ]< / span > < span class = "p" data-group-id = "7779600358-1" > }< / span > < span class = "w" >
2023-07-12 11:28:07 +03:00
< / span > < span class = "gp unselectable" > iex> < / span > < span class = "nc" > Plausible.Cldr.Number.System< / span > < span class = "o" > .< / span > < span class = "n" > number_system_names_for< / span > < span class = "w" > < / span > < span class = "s" > " zz" < / span > < span class = "w" >
2024-05-15 11:51:25 +03:00
< / span > < span class = "p" data-group-id = "7779600358-3" > {< / span > < span class = "ss" > :error< / span > < span class = "p" > ,< / span > < span class = "w" > < / span > < span class = "p" data-group-id = "7779600358-4" > {< / span > < span class = "nc" > Cldr.InvalidLanguageError< / span > < span class = "p" > ,< / span > < span class = "w" > < / span > < span class = "s" > " The language < / span > < span class = "se" > \" < / span > < span class = "s" > zz< / span > < span class = "se" > \" < / span > < span class = "s" > is invalid" < / span > < span class = "p" data-group-id = "7779600358-4" > }< / span > < span class = "p" data-group-id = "7779600358-3" > }< / span > < / code > < / pre >
2023-07-12 11:28:07 +03:00
< / section >
< / section >
< section class = "detail" id = "number_system_names_for!/1" >
< div class = "detail-header" >
< a href = "#number_system_names_for!/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" > number_system_names_for!(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" >
< / section >
< / section >
< section class = "detail" id = "number_system_types_for/1" >
< div class = "detail-header" >
< a href = "#number_system_types_for/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" > number_system_types_for(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" >
< / section >
< / section >
< section class = "detail" id = "number_systems_for/1" >
< div class = "detail-header" >
< a href = "#number_systems_for/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" > number_systems_for(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 > number_systems_for(< a href = "https://hexdocs.pm/ex_cldr/2.37.5/Cldr.Locale.html#t:locale_reference/0" > Cldr.Locale.locale_reference< / 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 the number systems available for a locale
or < code class = "inline" > {:error, message}< / code > if the locale is not known.< / p > < ul > < li > < code class = "inline" > locale< / code > is any valid locale name returned by < a href = "Plausible.Cldr.html#known_locale_names/0" > < code class = "inline" > Plausible.Cldr.known_locale_names/0< / code > < / a >
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 < a href = "Plausible.Cldr.Locale.html#new!/1" > < code class = "inline" > Plausible.Cldr.Locale.new!/1< / code > < / a > < / li > < / ul > < h2 id = "number_systems_for/1-examples" class = "section-heading" >
< a href = "#number_systems_for/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 >
< pre > < code class = "makeup elixir" translate = "no" > < span class = "gp unselectable" > iex> < / span > < span class = "nc" > Plausible.Cldr.Number.System< / span > < span class = "o" > .< / span > < span class = "n" > number_systems_for< / span > < span class = "w" > < / span > < span class = "s" > " en" < / span > < span class = "w" >
2024-05-15 11:51:25 +03:00
< / span > < span class = "p" data-group-id = "7596002904-1" > {< / span > < span class = "ss" > :ok< / span > < span class = "p" > ,< / span > < span class = "w" > < / span > < span class = "p" data-group-id = "7596002904-2" > %{< / span > < span class = "ss" > default< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "ss" > :latn< / span > < span class = "p" > ,< / span > < span class = "w" > < / span > < span class = "ss" > native< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "ss" > :latn< / span > < span class = "p" data-group-id = "7596002904-2" > }< / span > < span class = "p" data-group-id = "7596002904-1" > }< / span > < span class = "w" >
2023-07-12 11:28:07 +03:00
< / span > < span class = "gp unselectable" > iex> < / span > < span class = "nc" > Plausible.Cldr.Number.System< / span > < span class = "o" > .< / span > < span class = "n" > number_systems_for< / span > < span class = "w" > < / span > < span class = "s" > " th" < / span > < span class = "w" >
2024-05-15 11:51:25 +03:00
< / span > < span class = "p" data-group-id = "7596002904-3" > {< / span > < span class = "ss" > :ok< / span > < span class = "p" > ,< / span > < span class = "w" > < / span > < span class = "p" data-group-id = "7596002904-4" > %{< / span > < span class = "ss" > default< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "ss" > :latn< / span > < span class = "p" > ,< / span > < span class = "w" > < / span > < span class = "ss" > native< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "ss" > :thai< / span > < span class = "p" data-group-id = "7596002904-4" > }< / span > < span class = "p" data-group-id = "7596002904-3" > }< / span > < span class = "w" >
2023-07-12 11:28:07 +03:00
< / span > < span class = "gp unselectable" > iex> < / span > < span class = "nc" > Plausible.Cldr.Number.System< / span > < span class = "o" > .< / span > < span class = "n" > number_systems_for< / span > < span class = "w" > < / span > < span class = "s" > " zz" < / span > < span class = "w" >
2024-05-15 11:51:25 +03:00
< / span > < span class = "p" data-group-id = "7596002904-5" > {< / span > < span class = "ss" > :error< / span > < span class = "p" > ,< / span > < span class = "w" > < / span > < span class = "p" data-group-id = "7596002904-6" > {< / span > < span class = "nc" > Cldr.InvalidLanguageError< / span > < span class = "p" > ,< / span > < span class = "w" > < / span > < span class = "s" > " The language < / span > < span class = "se" > \" < / span > < span class = "s" > zz< / span > < span class = "se" > \" < / span > < span class = "s" > is invalid" < / span > < span class = "p" data-group-id = "7596002904-6" > }< / span > < span class = "p" data-group-id = "7596002904-5" > }< / span > < / code > < / pre >
2023-07-12 11:28:07 +03:00
< / section >
< / section >
< section class = "detail" id = "number_systems_for!/1" >
< div class = "detail-header" >
< a href = "#number_systems_for!/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" > number_systems_for!(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" >
< / section >
< / section >
< section class = "detail" id = "number_systems_like/2" >
< div class = "detail-header" >
< a href = "#number_systems_like/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" > number_systems_like(locale, number_system)< / 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 > number_systems_like(
2024-01-11 10:50:44 +03:00
< a href = "https://hexdocs.pm/ex_cldr/2.37.5/Cldr.Locale.html#t:locale_reference/0" > Cldr.Locale.locale_reference< / a > (),
< a href = "https://hexdocs.pm/ex_cldr_numbers/2.32.3/Cldr.Number.System.html#t:system_name/0" > Cldr.Number.System.system_name< / a > ()
2023-07-12 11:28:07 +03:00
) ::
{:ok, < a href = "https://hexdocs.pm/elixir/typespecs.html#built-in-types" > list< / a > ()} | {:error, < a href = "https://hexdocs.pm/elixir/typespecs.html#basic-types" > tuple< / a > ()}< / pre >
< / div >
< / section >
< / section >
< section class = "detail" id = "system_name_from/2" >
< div class = "detail-header" >
< a href = "#system_name_from/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" > system_name_from(system_name, 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" >
< pre translate = "no" > < span class = "attribute" > @spec< / span > system_name_from(
2024-01-11 10:50:44 +03:00
< a href = "https://hexdocs.pm/ex_cldr_numbers/2.32.3/Cldr.Number.System.html#t:system_name/0" > Cldr.Number.System.system_name< / a > (),
< 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 > ()
2023-07-12 11:28:07 +03:00
) :: {:ok, < a href = "https://hexdocs.pm/elixir/typespecs.html#basic-types" > atom< / 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 number system name for a given locale and number system reference.< / p > < ul > < li > < p > < code class = "inline" > system_name< / code > is any number system name returned by
< a href = "Plausible.Cldr.html#known_number_systems/0" > < code class = "inline" > Plausible.Cldr.known_number_systems/0< / code > < / a > or a number system type
returned by < a href = "Plausible.Cldr.html#known_number_system_types/0" > < code class = "inline" > Plausible.Cldr.known_number_system_types/0< / code > < / a > < / p > < / li > < li > < p > < code class = "inline" > locale< / code > is any valid locale name returned by < a href = "Plausible.Cldr.html#known_locale_names/0" > < code class = "inline" > Plausible.Cldr.known_locale_names/0< / code > < / a >
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 < a href = "Plausible.Cldr.Locale.html#new!/1" > < code class = "inline" > Plausible.Cldr.Locale.new!/1< / code > < / a > < / p > < / li > < / ul > < p > Number systems can be references in one of two ways:< / p > < ul > < li > < p > As a number system type such as :default, :native, :traditional and
2023-07-12 11:28:07 +03:00
:finance. This allows references to a number system for a locale in a
consistent fashion for a given use< / p > < / li > < li > < p > WIth the number system name directly, such as :latn, :arab or any of the
other 70 or so< / p > < / li > < / ul > < p > This function dereferences the supplied < code class = "inline" > system_name< / code > and returns the
actual system name.< / p > < h2 id = "system_name_from/2-examples" class = "section-heading" >
2024-01-11 10:50:44 +03:00
< a href = "#system_name_from/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-05-15 11:51:25 +03:00
< pre > < code class = "makeup elixir" translate = "no" > < span class = "n" > ex< / span > < span class = "o" > > < / span > < span class = "w" > < / span > < span class = "nc" > Plausible.Cldr.Number.System< / span > < span class = "o" > .< / span > < span class = "n" > system_name_from< / span > < span class = "p" data-group-id = "0520435152-1" > (< / span > < span class = "ss" > :default< / span > < span class = "p" > ,< / span > < span class = "w" > < / span > < span class = "s" > " en" < / span > < span class = "p" data-group-id = "0520435152-1" > )< / span > < span class = "w" >
< / span > < span class = "p" data-group-id = "0520435152-2" > {< / span > < span class = "ss" > :ok< / span > < span class = "p" > ,< / span > < span class = "w" > < / span > < span class = "ss" > :latn< / span > < span class = "p" data-group-id = "0520435152-2" > }< / span > < span class = "w" >
2023-07-12 11:28:07 +03:00
2024-05-15 11:51:25 +03:00
< / span > < span class = "gp unselectable" > iex> < / span > < span class = "nc" > Plausible.Cldr.Number.System< / span > < span class = "o" > .< / span > < span class = "n" > system_name_from< / span > < span class = "p" data-group-id = "0520435152-3" > (< / span > < span class = "s" > " latn" < / span > < span class = "p" > ,< / span > < span class = "w" > < / span > < span class = "s" > " en" < / span > < span class = "p" data-group-id = "0520435152-3" > )< / span > < span class = "w" >
< / span > < span class = "p" data-group-id = "0520435152-4" > {< / span > < span class = "ss" > :ok< / span > < span class = "p" > ,< / span > < span class = "w" > < / span > < span class = "ss" > :latn< / span > < span class = "p" data-group-id = "0520435152-4" > }< / span > < span class = "w" >
2023-07-12 11:28:07 +03:00
2024-05-15 11:51:25 +03:00
< / span > < span class = "gp unselectable" > iex> < / span > < span class = "nc" > Plausible.Cldr.Number.System< / span > < span class = "o" > .< / span > < span class = "n" > system_name_from< / span > < span class = "p" data-group-id = "0520435152-5" > (< / span > < span class = "ss" > :native< / span > < span class = "p" > ,< / span > < span class = "w" > < / span > < span class = "s" > " en" < / span > < span class = "p" data-group-id = "0520435152-5" > )< / span > < span class = "w" >
< / span > < span class = "p" data-group-id = "0520435152-6" > {< / span > < span class = "ss" > :ok< / span > < span class = "p" > ,< / span > < span class = "w" > < / span > < span class = "ss" > :latn< / span > < span class = "p" data-group-id = "0520435152-6" > }< / span > < span class = "w" >
2023-07-12 11:28:07 +03:00
2024-05-15 11:51:25 +03:00
< / span > < span class = "gp unselectable" > iex> < / span > < span class = "nc" > Plausible.Cldr.Number.System< / span > < span class = "o" > .< / span > < span class = "n" > system_name_from< / span > < span class = "p" data-group-id = "0520435152-7" > (< / span > < span class = "ss" > :nope< / span > < span class = "p" > ,< / span > < span class = "w" > < / span > < span class = "s" > " en" < / span > < span class = "p" data-group-id = "0520435152-7" > )< / span > < span class = "w" >
< / span > < span class = "p" data-group-id = "0520435152-8" > {< / span > < span class = "w" >
2023-07-12 11:28:07 +03:00
< / span > < span class = "ss" > :error< / span > < span class = "p" > ,< / span > < span class = "w" >
2024-05-15 11:51:25 +03:00
< / span > < span class = "p" data-group-id = "0520435152-9" > {< / span > < span class = "nc" > Cldr.UnknownNumberSystemError< / span > < span class = "p" > ,< / span > < span class = "w" > < / span > < span class = "s" > " The number system :nope is unknown" < / span > < span class = "p" data-group-id = "0520435152-9" > }< / span > < span class = "w" >
< / span > < span class = "p" data-group-id = "0520435152-8" > }< / span > < / code > < / pre > < p > Note that return value is not guaranteed to be a valid
2023-07-12 11:28:07 +03:00
number system for the given locale as demonstrated in the third example.< / p >
< / section >
< / section >
< section class = "detail" id = "to_system/2" >
< div class = "detail-header" >
< a href = "#to_system/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" > to_system(number, system)< / 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 > Converts a number into the representation of
a non-latin number system.< / p > < p > This function converts numbers to a known
number system only, it does not provide number
formatting.< / p > < ul > < li > < p > < code class = "inline" > number< / code > is a < code class = "inline" > float< / code > , < code class = "inline" > integer< / code > 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" > system_name< / code > is any number system name returned by
2024-01-11 10:50:44 +03:00
< a href = "https://hexdocs.pm/ex_cldr/2.37.5/Cldr.html#known_number_systems/0" > < code class = "inline" > Cldr.known_number_systems/0< / code > < / a > or a number system type
returned by < a href = "https://hexdocs.pm/ex_cldr/2.37.5/Cldr.html#known_number_system_types/0" > < code class = "inline" > Cldr.known_number_system_types/0< / code > < / a > < / p > < / li > < / ul > < p > There are two types of number systems in CLDR:< / p > < ul > < li > < p > < code class = "inline" > :numeric< / code > in which the number system defines
2023-07-12 11:28:07 +03:00
a direct mapping between the latin digits < code class = "inline" > 0..9< / code >
into a the number system equivalent. In this case,
2024-01-11 10:50:44 +03:00
< a href = "#to_system/2" > < code class = "inline" > to_system/2< / code > < / a > invokes < a href = "https://hexdocs.pm/ex_cldr_numbers/2.32.3/Cldr.Number.Transliterate.html#transliterate_digits/3" > < code class = "inline" > Cldr.Number.Transliterate.transliterate_digits/3< / code > < / a >
2023-07-12 11:28:07 +03:00
for the given number.< / p > < / li > < li > < p > < code class = "inline" > :algorithmic< / code > in which the number system
does not have the same structure as the < code class = "inline" > :latn< / code >
number system and therefore the conversion is
done algorithmically. For CLDR the algorithm
2024-01-11 10:50:44 +03:00
is implemented through < a href = "https://hexdocs.pm/ex_cldr_numbers/2.32.3/Cldr.Rbnf.html" > < code class = "inline" > Cldr.Rbnf< / code > < / a > rulesets.
2023-07-12 11:28:07 +03:00
These rulesets are considered by CLDR to be
less rigorous than the < code class = "inline" > :numeric< / code > number systems
and caution and testing for a specific use case
is recommended.< / p > < / li > < / ul > < h2 id = "to_system/2-examples" class = "section-heading" >
2024-01-11 10:50:44 +03:00
< a href = "#to_system/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 >
< pre > < code class = "makeup elixir" translate = "no" > < span class = "gp unselectable" > iex> < / span > < span class = "nc" > Plausible.Cldr.Number.System< / span > < span class = "o" > .< / span > < span class = "n" > to_system< / span > < span class = "w" > < / span > < span class = "mi" > 123456< / span > < span class = "p" > ,< / span > < span class = "w" > < / span > < span class = "ss" > :hebr< / span > < span class = "w" >
2024-05-15 11:51:25 +03:00
< / span > < span class = "p" data-group-id = "4487167175-1" > {< / span > < span class = "ss" > :ok< / span > < span class = "p" > ,< / span > < span class = "w" > < / span > < span class = "s" > " קכ״ג׳תנ״ו" < / span > < span class = "p" data-group-id = "4487167175-1" > }< / span > < span class = "w" >
2023-07-12 11:28:07 +03:00
< / span > < span class = "gp unselectable" > iex> < / span > < span class = "nc" > Plausible.Cldr.Number.System< / span > < span class = "o" > .< / span > < span class = "n" > to_system< / span > < span class = "w" > < / span > < span class = "mi" > 123< / span > < span class = "p" > ,< / span > < span class = "w" > < / span > < span class = "ss" > :hans< / span > < span class = "w" >
2024-05-15 11:51:25 +03:00
< / span > < span class = "p" data-group-id = "4487167175-2" > {< / span > < span class = "ss" > :ok< / span > < span class = "p" > ,< / span > < span class = "w" > < / span > < span class = "s" > " 一百二十三" < / span > < span class = "p" data-group-id = "4487167175-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.Number.System< / span > < span class = "o" > .< / span > < span class = "n" > to_system< / span > < span class = "w" > < / span > < span class = "mi" > 123< / span > < span class = "p" > ,< / span > < span class = "w" > < / span > < span class = "ss" > :hant< / span > < span class = "w" >
2024-05-15 11:51:25 +03:00
< / span > < span class = "p" data-group-id = "4487167175-3" > {< / span > < span class = "ss" > :ok< / span > < span class = "p" > ,< / span > < span class = "w" > < / span > < span class = "s" > " 一百二十三" < / span > < span class = "p" data-group-id = "4487167175-3" > }< / span > < span class = "w" >
2023-07-12 11:28:07 +03:00
< / span > < span class = "gp unselectable" > iex> < / span > < span class = "nc" > Plausible.Cldr.Number.System< / span > < span class = "o" > .< / span > < span class = "n" > to_system< / span > < span class = "w" > < / span > < span class = "mi" > 123< / span > < span class = "p" > ,< / span > < span class = "w" > < / span > < span class = "ss" > :hansfin< / span > < span class = "w" >
2024-05-15 11:51:25 +03:00
< / span > < span class = "p" data-group-id = "4487167175-4" > {< / span > < span class = "ss" > :ok< / span > < span class = "p" > ,< / span > < span class = "w" > < / span > < span class = "s" > " 壹佰贰拾叁" < / span > < span class = "p" data-group-id = "4487167175-4" > }< / span > < / code > < / pre >
2023-07-12 11:28:07 +03:00
< / section >
< / section >
< section class = "detail" id = "to_system!/2" >
< div class = "detail-header" >
< a href = "#to_system!/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" > to_system!(number, system_name)< / 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 > Converts a number into the representation of
a non-latin number system. Returns a converted
string or raises on error.< / p > < ul > < li > < p > < code class = "inline" > number< / code > is a < code class = "inline" > float< / code > , < code class = "inline" > integer< / code > 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" > system_name< / code > is any number system name returned by
< a href = "Plausible.Cldr.html#known_number_systems/0" > < code class = "inline" > Plausible.Cldr.known_number_systems/0< / code > < / a > or a number system type
returned by < a href = "Plausible.Cldr.html#known_number_system_types/0" > < code class = "inline" > Plausible.Cldr.known_number_system_types/0< / code > < / a > < / p > < / li > < / ul > < p > See < a href = "#to_system/2" > < code class = "inline" > Plausible.Cldr.Number.System.to_system/2< / code > < / a > for further
information.< / p > < h2 id = "to_system!/2-examples" class = "section-heading" >
2024-01-11 10:50:44 +03:00
< a href = "#to_system!/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 >
< pre > < code class = "makeup elixir" translate = "no" > < span class = "gp unselectable" > iex> < / span > < span class = "nc" > Plausible.Cldr.Number.System< / span > < span class = "o" > .< / span > < span class = "n" > to_system!< / span > < span class = "w" > < / span > < span class = "mi" > 123< / span > < span class = "p" > ,< / span > < span class = "w" > < / span > < span class = "ss" > :hans< / span > < span class = "w" >
< / span > < span class = "s" > " 一百二十三" < / span > < span class = "w" >
< / span > < span class = "gp unselectable" > iex> < / span > < span class = "nc" > Plausible.Cldr.Number.System< / span > < span class = "o" > .< / span > < span class = "n" > to_system!< / span > < span class = "w" > < / span > < span class = "mi" > 123< / span > < span class = "p" > ,< / span > < span class = "w" > < / span > < span class = "ss" > :hant< / span > < span class = "w" >
< / span > < span class = "s" > " 一百二十三" < / span > < span class = "w" >
< / span > < span class = "gp unselectable" > iex> < / span > < span class = "nc" > Plausible.Cldr.Number.System< / span > < span class = "o" > .< / span > < span class = "n" > to_system!< / span > < span class = "w" > < / span > < span class = "mi" > 123< / span > < span class = "p" > ,< / span > < span class = "w" > < / span > < span class = "ss" > :hansfin< / span > < span class = "w" >
< / span > < span class = "s" > " 壹佰贰拾叁" < / span > < / code > < / pre >
< / 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 >