mirror of
https://github.com/plausible/analytics.git
synced 2024-11-23 11:12:15 +03:00
899 lines
62 KiB
HTML
899 lines
62 KiB
HTML
<!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">
|
||
<meta name="generator" content="ExDoc v0.31.1">
|
||
<meta name="project" content="Plausible v0.0.1">
|
||
|
||
|
||
<title>Plausible.Cldr.Number.Format — Plausible v0.0.1</title>
|
||
<link rel="stylesheet" href="dist/html-elixir-FM2CSD74.css" />
|
||
|
||
|
||
<script src="dist/handlebars.runtime-NWIB6V2M.js"></script>
|
||
<script src="dist/handlebars.templates-43PMFBC7.js"></script>
|
||
<script src="dist/sidebar_items-7C6BA389.js"></script>
|
||
|
||
<script src="docs_config.js"></script>
|
||
|
||
<script async src="dist/html-L4O5OK2K.js"></script>
|
||
|
||
|
||
</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">
|
||
|
||
<button id="sidebar-menu" class="sidebar-button sidebar-toggle" aria-label="toggle sidebar" aria-controls="sidebar">
|
||
<i class="ri-menu-line ri-lg" title="Collapse/expand sidebar"></i>
|
||
</button>
|
||
|
||
<div class="background-layer"></div>
|
||
|
||
<nav id="sidebar" class="sidebar">
|
||
|
||
<div class="sidebar-header">
|
||
<div class="sidebar-projectInfo">
|
||
|
||
<a href="readme.html" class="sidebar-projectImage">
|
||
<img src="assets/logo.png" alt="Plausible" />
|
||
</a>
|
||
|
||
<div>
|
||
<a href="readme.html" class="sidebar-projectName" translate="no">
|
||
Plausible
|
||
</a>
|
||
<div class="sidebar-projectVersion" translate="no">
|
||
v0.0.1
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<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>
|
||
|
||
</ul>
|
||
</div>
|
||
|
||
<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>
|
||
|
||
<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>
|
||
|
||
|
||
<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>
|
||
|
||
<main class="content">
|
||
<output role="status" id="toast"></output>
|
||
<div class="content-outer">
|
||
<div id="content" class="content-inner">
|
||
<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>
|
||
<div class="autocomplete">
|
||
</div>
|
||
<button class="icon-settings display-settings">
|
||
<i class="ri-settings-3-line"></i>
|
||
<span class="sr-only">Settings</span>
|
||
</button>
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<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.Format</span>
|
||
<small class="app-vsn" translate="no">(Plausible v0.0.1)</small>
|
||
|
||
</h1>
|
||
|
||
|
||
<section id="moduledoc">
|
||
<p>Functions to manage the collection of number patterns defined in Cldr.</p><p>Number patterns affect how numbers are interpreted in a localized context.
|
||
Here are some examples, based on the French locale. The "." shows where the
|
||
decimal point should go. The "," shows where the thousands separator should
|
||
go. A "0" indicates zero-padding: if the number is too short, a zero (in the
|
||
locale's numeric set) will go there. A "#" indicates no padding: if the
|
||
number is too short, nothing goes there. A "¤" shows where the currency sign
|
||
will go. The following illustrates the effects of different patterns for the
|
||
French locale, with the number "1234.567". Notice how the pattern characters
|
||
',' and '.' are replaced by the characters appropriate for the locale.</p><h2 id="module-number-pattern-examples" class="section-heading">
|
||
<a href="#module-number-pattern-examples" class="hover-link">
|
||
<i class="ri-link-m" aria-hidden="true"></i>
|
||
</a>
|
||
<span class="text">Number Pattern Examples</span>
|
||
</h2>
|
||
<table><thead><tr><th style="text-align: left;">Pattern</th><th style="text-align: center;">Currency</th><th style="text-align: right;">Text</th></tr></thead><tbody><tr><td style="text-align: left;">#,##0.##</td><td style="text-align: center;">n/a</td><td style="text-align: right;">1 234,57</td></tr><tr><td style="text-align: left;">#,##0.###</td><td style="text-align: center;">n/a</td><td style="text-align: right;">1 234,567</td></tr><tr><td style="text-align: left;">###0.#####</td><td style="text-align: center;">n/a</td><td style="text-align: right;">1234,567</td></tr><tr><td style="text-align: left;">###0.0000#</td><td style="text-align: center;">n/a</td><td style="text-align: right;">1234,5670</td></tr><tr><td style="text-align: left;">00000.0000</td><td style="text-align: center;">n/a</td><td style="text-align: right;">01234,5670</td></tr><tr><td style="text-align: left;">#,##0.00 ¤</td><td style="text-align: center;">EUR</td><td style="text-align: right;">1 234,57 €</td></tr></tbody></table><p>The number of # placeholder characters before the decimal do not matter,
|
||
since no limit is placed on the maximum number of digits. There should,
|
||
however, be at least one zero some place in the pattern. In currency formats,
|
||
the number of digits after the decimal also do not matter, since the
|
||
information in the supplemental data (see Supplemental Currency Data) is used
|
||
to override the number of decimal places — and the rounding — according to
|
||
the currency that is being formatted. That can be seen in the above chart,
|
||
with the difference between Yen and Euro formatting.</p><p>Details of the number formats are described in the
|
||
<a href="http://unicode.org/reports/tr35/tr35-numbers.html#Number_Format_Patterns">Unicode documentation</a></p>
|
||
</section>
|
||
|
||
|
||
<section id="summary" class="details-list">
|
||
<h1 class="section-heading">
|
||
<a class="hover-link" href="#summary">
|
||
<i class="ri-link-m" aria-hidden="true"></i>
|
||
</a>
|
||
<span class="text">Summary</span>
|
||
</h1>
|
||
<div class="summary-functions summary">
|
||
<h2>
|
||
<a href="#functions">Functions</a>
|
||
</h2>
|
||
|
||
<div class="summary-row">
|
||
<div class="summary-signature">
|
||
<a href="#all_formats_for/1" translate="no">all_formats_for(locale \\ Plausible.Cldr.get_locale())</a>
|
||
|
||
</div>
|
||
|
||
<div class="summary-synopsis"><p>Returns the decimal formats defined for a given locale.</p></div>
|
||
|
||
</div>
|
||
|
||
<div class="summary-row">
|
||
<div class="summary-signature">
|
||
<a href="#all_formats_for!/1" translate="no">all_formats_for!(locale \\ Plausible.Cldr.get_locale())</a>
|
||
|
||
</div>
|
||
|
||
<div class="summary-synopsis"><p>Returns the decimal formats defined for a given locale.</p></div>
|
||
|
||
</div>
|
||
|
||
<div class="summary-row">
|
||
<div class="summary-signature">
|
||
<a href="#currency_spacing/2" translate="no">currency_spacing(locale, number_system)</a>
|
||
|
||
</div>
|
||
|
||
<div class="summary-synopsis"><p>Returns the currency space for a given locale and
|
||
number system.</p></div>
|
||
|
||
</div>
|
||
|
||
<div class="summary-row">
|
||
<div class="summary-signature">
|
||
<a href="#decimal_format_list/0" translate="no">decimal_format_list()</a>
|
||
|
||
</div>
|
||
|
||
<div class="summary-synopsis"><p>Returns the list of decimal formats in the configured locales including
|
||
the list of locales configured for precompilation in <code class="inline">config.exs</code>.</p></div>
|
||
|
||
</div>
|
||
|
||
<div class="summary-row">
|
||
<div class="summary-signature">
|
||
<a href="#decimal_format_list_for/1" translate="no">decimal_format_list_for(locale \\ Plausible.Cldr.get_locale())</a>
|
||
|
||
</div>
|
||
|
||
<div class="summary-synopsis"><p>Returns the list of decimal formats for a configured locale.</p></div>
|
||
|
||
</div>
|
||
|
||
<div class="summary-row">
|
||
<div class="summary-signature">
|
||
<a href="#default_grouping_for/1" translate="no">default_grouping_for(locale \\ Plausible.Cldr.get_locale())</a>
|
||
|
||
</div>
|
||
|
||
<div class="summary-synopsis"><p>Returns the default grouping for a locale as a map.</p></div>
|
||
|
||
</div>
|
||
|
||
<div class="summary-row">
|
||
<div class="summary-signature">
|
||
<a href="#default_grouping_for!/1" translate="no">default_grouping_for!(locale)</a>
|
||
|
||
</div>
|
||
|
||
<div class="summary-synopsis"><p>Returns the default grouping for a locale
|
||
or raises on error.</p></div>
|
||
|
||
</div>
|
||
|
||
<div class="summary-row">
|
||
<div class="summary-signature">
|
||
<a href="#formats_for/2" translate="no">formats_for(locale \\ Plausible.Cldr.default_locale(), number_system \\ Cldr.Number.System.default_number_system_type())</a>
|
||
|
||
</div>
|
||
|
||
<div class="summary-synopsis"><p>Return the predfined formats for a given <code class="inline">locale</code> and <code class="inline">number_system</code>.</p></div>
|
||
|
||
</div>
|
||
|
||
<div class="summary-row">
|
||
<div class="summary-signature">
|
||
<a href="#formats_for!/2" translate="no">formats_for!(locale \\ Plausible.Cldr.default_locale(), number_system \\ Cldr.Number.System.default_number_system_type())</a>
|
||
|
||
</div>
|
||
|
||
</div>
|
||
|
||
<div class="summary-row">
|
||
<div class="summary-signature">
|
||
<a href="#minimum_grouping_digits_for/1" translate="no">minimum_grouping_digits_for(locale \\ Plausible.Cldr.get_locale())</a>
|
||
|
||
</div>
|
||
|
||
<div class="summary-synopsis"><p>Returns the minimum grouping digits for a locale.</p></div>
|
||
|
||
</div>
|
||
|
||
<div class="summary-row">
|
||
<div class="summary-signature">
|
||
<a href="#minimum_grouping_digits_for!/1" translate="no">minimum_grouping_digits_for!(locale)</a>
|
||
|
||
</div>
|
||
|
||
<div class="summary-synopsis"><p>Returns the minimum grouping digits for a locale
|
||
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>
|
||
</a>
|
||
<span class="text">Functions</span>
|
||
</h1>
|
||
<div class="functions-list">
|
||
<section class="detail" id="all_formats_for/1">
|
||
|
||
<span id="all_formats_for/0"></span>
|
||
|
||
<div class="detail-header">
|
||
<a href="#all_formats_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">all_formats_for(locale \\ Plausible.Cldr.get_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> all_formats_for(<a href="https://hexdocs.pm/ex_cldr/2.39.2/Cldr.Locale.html#t:locale_reference/0">Cldr.Locale.locale_reference</a>()) ::
|
||
{:ok, %{required(<a href="https://hexdocs.pm/ex_cldr_numbers/2.33.1/Cldr.Number.System.html#t:system_name/0">Cldr.Number.System.system_name</a>()) => <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> all_formats_for(<a href="https://hexdocs.pm/ex_cldr/2.39.2/Cldr.Locale.html#t:locale_reference/0">Cldr.Locale.locale_reference</a>()) ::
|
||
%{required(<a href="https://hexdocs.pm/ex_cldr_numbers/2.33.1/Cldr.Number.System.html#t:system_name/0">Cldr.Number.System.system_name</a>()) => <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 the decimal formats defined for a given locale.</p><h2 id="all_formats_for/1-arguments" class="section-heading">
|
||
<a href="#all_formats_for/1-arguments" class="hover-link">
|
||
<i class="ri-link-m" aria-hidden="true"></i>
|
||
</a>
|
||
<span class="text">Arguments</span>
|
||
</h2>
|
||
<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>
|
||
or a <a href="https://hexdocs.pm/ex_cldr/2.39.2/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>. The default
|
||
is <a href="Plausible.Cldr.html#get_locale/0"><code class="inline">Plausible.Cldr.get_locale/0</code></a>.</li></ul><h2 id="all_formats_for/1-returns" class="section-heading">
|
||
<a href="#all_formats_for/1-returns" class="hover-link">
|
||
<i class="ri-link-m" aria-hidden="true"></i>
|
||
</a>
|
||
<span class="text">Returns</span>
|
||
</h2>
|
||
<ul><li><p><code class="inline">{:ok, map}</code> where map is a map of decimal formats
|
||
keyed by number system or</p></li><li><p><code class="inline">{:error, {exception, message}}</code></p></li></ul>
|
||
</section>
|
||
</section>
|
||
<section class="detail" id="all_formats_for!/1">
|
||
|
||
<span id="all_formats_for!/0"></span>
|
||
|
||
<div class="detail-header">
|
||
<a href="#all_formats_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">all_formats_for!(locale \\ Plausible.Cldr.get_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 decimal formats defined for a given locale.</p><h2 id="all_formats_for!/1-arguments" class="section-heading">
|
||
<a href="#all_formats_for!/1-arguments" class="hover-link">
|
||
<i class="ri-link-m" aria-hidden="true"></i>
|
||
</a>
|
||
<span class="text">Arguments</span>
|
||
</h2>
|
||
<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>
|
||
or a <a href="https://hexdocs.pm/ex_cldr/2.39.2/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>. The default
|
||
is <a href="Plausible.Cldr.html#get_locale/0"><code class="inline">Plausible.Cldr.get_locale/0</code></a>.</li></ul><h2 id="all_formats_for!/1-returns" class="section-heading">
|
||
<a href="#all_formats_for!/1-returns" class="hover-link">
|
||
<i class="ri-link-m" aria-hidden="true"></i>
|
||
</a>
|
||
<span class="text">Returns</span>
|
||
</h2>
|
||
<ul><li><p><code class="inline">{:ok, map}</code> where map is a map of decimal formats
|
||
keyed by number system or</p></li><li><p>raises an exception.</p></li></ul><p>See <code class="inline">Plausible.Cldr.Number.Format.Number.Format.all_formats_for/1</code> for further information.</p>
|
||
</section>
|
||
</section>
|
||
<section class="detail" id="currency_spacing/2">
|
||
|
||
<div class="detail-header">
|
||
<a href="#currency_spacing/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_spacing(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> currency_spacing(
|
||
<a href="https://hexdocs.pm/ex_cldr/2.39.2/Cldr.LanguageTag.html#t:t/0">Cldr.LanguageTag.t</a>() | <a href="https://hexdocs.pm/ex_cldr/2.39.2/Cldr.Locale.html#t:locale_name/0">Cldr.Locale.locale_name</a>(),
|
||
<a href="https://hexdocs.pm/ex_cldr_numbers/2.33.1/Cldr.Number.System.html#t:system_name/0">Cldr.Number.System.system_name</a>()
|
||
) :: <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 currency space for a given locale and
|
||
number system.</p>
|
||
</section>
|
||
</section>
|
||
<section class="detail" id="decimal_format_list/0">
|
||
|
||
<div class="detail-header">
|
||
<a href="#decimal_format_list/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">decimal_format_list()</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> decimal_format_list() :: [<a href="https://hexdocs.pm/ex_cldr_numbers/2.33.1/Cldr.Number.Format.html#t:format/0">Cldr.Number.Format.format</a>()]</pre>
|
||
|
||
</div>
|
||
|
||
<p>Returns the list of decimal formats in the configured locales including
|
||
the list of locales configured for precompilation in <code class="inline">config.exs</code>.</p><p>This function exists to allow the decimal formatter
|
||
to precompile all the known formats at compile time.</p><h2 id="decimal_format_list/0-example" class="section-heading">
|
||
<a href="#decimal_format_list/0-example" class="hover-link">
|
||
<i class="ri-link-m" aria-hidden="true"></i>
|
||
</a>
|
||
<span class="text">Example</span>
|
||
</h2>
|
||
<pre><code class="makeup elixir" translate="no"><span class="c1">#=> Plausible.Cldr.Number.Format.Format.decimal_format_list</span><span class="w">
|
||
</span><span class="p" data-group-id="9460266790-1">[</span><span class="s">"#"</span><span class="p">,</span><span class="w"> </span><span class="s">"#,##,##0%"</span><span class="p">,</span><span class="w">
|
||
</span><span class="s">"#,##,##0.###"</span><span class="p">,</span><span class="w"> </span><span class="s">"#,##,##0.00¤"</span><span class="p">,</span><span class="w"> </span><span class="s">"#,##,##0.00¤;(#,##,##0.00¤)"</span><span class="p">,</span><span class="w">
|
||
</span><span class="s">"#,##,##0 %"</span><span class="p">,</span><span class="w"> </span><span class="s">"#,##0%"</span><span class="p">,</span><span class="w"> </span><span class="s">"#,##0.###"</span><span class="p">,</span><span class="w"> </span><span class="s">"#,##0.00 ¤"</span><span class="p">,</span><span class="w">
|
||
</span><span class="s">"#,##0.00 ¤;(#,##0.00 ¤)"</span><span class="p">,</span><span class="w"> </span><span class="s">"#,##0.00¤"</span><span class="p">,</span><span class="w"> </span><span class="s">"#,##0.00¤;(#,##0.00¤)"</span><span class="p">,</span><span class="w">
|
||
</span><span class="s">"#,##0 %"</span><span class="p">,</span><span class="w"> </span><span class="s">"#0%"</span><span class="p">,</span><span class="w"> </span><span class="s">"#0.######"</span><span class="p">,</span><span class="w"> </span><span class="s">"#0.00 ¤"</span><span class="p">,</span><span class="w"> </span><span class="s">"#E0"</span><span class="p">,</span><span class="w"> </span><span class="s">"%#,##0"</span><span class="p">,</span><span class="w"> </span><span class="s">"% #,##0"</span><span class="p">,</span><span class="w">
|
||
</span><span class="s">"0"</span><span class="p">,</span><span class="w"> </span><span class="s">"0.000000E+000"</span><span class="p">,</span><span class="w"> </span><span class="s">"0000 M ¤"</span><span class="p">,</span><span class="w"> </span><span class="s">"0000¤"</span><span class="p">,</span><span class="w"> </span><span class="s">"000G ¤"</span><span class="p">,</span><span class="w"> </span><span class="s">"000K ¤"</span><span class="p">,</span><span class="w"> </span><span class="s">"000M ¤"</span><span class="p">,</span><span class="w">
|
||
</span><span class="s">"000T ¤"</span><span class="p">,</span><span class="w"> </span><span class="s">"000mM ¤"</span><span class="p">,</span><span class="w"> </span><span class="s">"000m ¤"</span><span class="p">,</span><span class="w"> </span><span class="s">"000 Bio'.' ¤"</span><span class="p">,</span><span class="w"> </span><span class="s">"000 Bln ¤"</span><span class="p">,</span><span class="w"> </span><span class="s">"000 Bn ¤"</span><span class="p">,</span><span class="w">
|
||
</span><span class="s">"000 B ¤"</span><span class="p">,</span><span class="w"> </span><span class="s">"000 E ¤"</span><span class="p">,</span><span class="w"> </span><span class="s">"000 K ¤"</span><span class="p">,</span><span class="w"> </span><span class="s">"000 MRD ¤"</span><span class="p">,</span><span class="w"> </span><span class="s">"000 Md ¤"</span><span class="p">,</span><span class="w"> </span><span class="s">"000 Mio'.' ¤"</span><span class="p">,</span><span class="w">
|
||
</span><span class="s">"000 Mio ¤"</span><span class="p">,</span><span class="w"> </span><span class="s">"000 Mld ¤"</span><span class="p">,</span><span class="w"> </span><span class="s">"000 Mln ¤"</span><span class="p">,</span><span class="w"> </span><span class="s">"000 Mn ¤"</span><span class="p">,</span><span class="w"> </span><span class="s">"000 Mrd'.' ¤"</span><span class="p">,</span><span class="w">
|
||
</span><span class="s">"000 Mrd ¤"</span><span class="p">,</span><span class="w"> </span><span class="s">"000 Mr ¤"</span><span class="p">,</span><span class="w"> </span><span class="s">"000 M ¤"</span><span class="p">,</span><span class="w"> </span><span class="s">"000 NT ¤"</span><span class="p">,</span><span class="w"> </span><span class="s">"000 N ¤"</span><span class="p">,</span><span class="w"> </span><span class="s">"000 Tn ¤"</span><span class="p">,</span><span class="w">
|
||
</span><span class="s">"000 Tr ¤"</span><span class="p">,</span><span class="w"> </span><span class="n">...</span><span class="p" data-group-id="9460266790-1">]</span></code></pre>
|
||
</section>
|
||
</section>
|
||
<section class="detail" id="decimal_format_list_for/1">
|
||
|
||
<span id="decimal_format_list_for/0"></span>
|
||
|
||
<div class="detail-header">
|
||
<a href="#decimal_format_list_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">decimal_format_list_for(locale \\ Plausible.Cldr.get_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> decimal_format_list_for(<a href="https://hexdocs.pm/ex_cldr/2.39.2/Cldr.LanguageTag.html#t:t/0">Cldr.LanguageTag.t</a>() | <a href="https://hexdocs.pm/ex_cldr/2.39.2/Cldr.Locale.html#t:locale_name/0">Cldr.Locale.locale_name</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 list of decimal formats for a configured locale.</p><h2 id="decimal_format_list_for/1-arguments" class="section-heading">
|
||
<a href="#decimal_format_list_for/1-arguments" class="hover-link">
|
||
<i class="ri-link-m" aria-hidden="true"></i>
|
||
</a>
|
||
<span class="text">Arguments</span>
|
||
</h2>
|
||
<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>
|
||
or a <a href="https://hexdocs.pm/ex_cldr/2.39.2/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>. The default
|
||
is <a href="Plausible.Cldr.html#get_locale/0"><code class="inline">Plausible.Cldr.get_locale/0</code></a>.</li></ul><p>This function exists to allow the decimal formatter to precompile all
|
||
the known formats at compile time. Its use is not otherwise recommended.</p><h2 id="decimal_format_list_for/1-example" class="section-heading">
|
||
<a href="#decimal_format_list_for/1-example" class="hover-link">
|
||
<i class="ri-link-m" aria-hidden="true"></i>
|
||
</a>
|
||
<span class="text">Example</span>
|
||
</h2>
|
||
<pre><code class="makeup elixir" translate="no"><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr.Number.Format</span><span class="o">.</span><span class="n">decimal_format_list_for</span><span class="p" data-group-id="6614833382-1">(</span><span class="ss">:en</span><span class="p" data-group-id="6614833382-1">)</span><span class="w">
|
||
</span><span class="p" data-group-id="6614833382-2">{</span><span class="ss">:ok</span><span class="p">,</span><span class="w"> </span><span class="p" data-group-id="6614833382-3">[</span><span class="s">"#,##0%"</span><span class="p">,</span><span class="w"> </span><span class="s">"#,##0.###"</span><span class="p">,</span><span class="w"> </span><span class="s">"#,##0.00"</span><span class="p">,</span><span class="w"> </span><span class="s">"#,##0.00;(#,##0.00)"</span><span class="p">,</span><span class="s">"#E0"</span><span class="p">,</span><span class="w">
|
||
</span><span class="s">"0 billion"</span><span class="p">,</span><span class="w"> </span><span class="s">"0 million"</span><span class="p">,</span><span class="w"> </span><span class="s">"0 thousand"</span><span class="p">,</span><span class="w">
|
||
</span><span class="s">"0 trillion"</span><span class="p">,</span><span class="w"> </span><span class="s">"00 billion"</span><span class="p">,</span><span class="w"> </span><span class="s">"00 million"</span><span class="p">,</span><span class="w"> </span><span class="s">"00 thousand"</span><span class="p">,</span><span class="w"> </span><span class="s">"00 trillion"</span><span class="p">,</span><span class="w">
|
||
</span><span class="s">"000 billion"</span><span class="p">,</span><span class="w"> </span><span class="s">"000 million"</span><span class="p">,</span><span class="w"> </span><span class="s">"000 thousand"</span><span class="p">,</span><span class="w"> </span><span class="s">"000 trillion"</span><span class="p">,</span><span class="w"> </span><span class="s">"000B"</span><span class="p">,</span><span class="w"> </span><span class="s">"000K"</span><span class="p">,</span><span class="w">
|
||
</span><span class="s">"000M"</span><span class="p">,</span><span class="w"> </span><span class="s">"000T"</span><span class="p">,</span><span class="w"> </span><span class="s">"00B"</span><span class="p">,</span><span class="w"> </span><span class="s">"00K"</span><span class="p">,</span><span class="w"> </span><span class="s">"00M"</span><span class="p">,</span><span class="w"> </span><span class="s">"00T"</span><span class="p">,</span><span class="w"> </span><span class="s">"0B"</span><span class="p">,</span><span class="w"> </span><span class="s">"0K"</span><span class="p">,</span><span class="w"> </span><span class="s">"0M"</span><span class="p">,</span><span class="w"> </span><span class="s">"0T"</span><span class="p">,</span><span class="w">
|
||
</span><span class="s">"¤#,##0.00"</span><span class="p">,</span><span class="w"> </span><span class="s">"¤#,##0.00;(¤#,##0.00)"</span><span class="p">,</span><span class="w"> </span><span class="s">"¤000B"</span><span class="p">,</span><span class="w"> </span><span class="s">"¤000K"</span><span class="p">,</span><span class="w"> </span><span class="s">"¤000M"</span><span class="p">,</span><span class="w">
|
||
</span><span class="s">"¤000T"</span><span class="p">,</span><span class="w"> </span><span class="s">"¤00B"</span><span class="p">,</span><span class="w"> </span><span class="s">"¤00K"</span><span class="p">,</span><span class="w"> </span><span class="s">"¤00M"</span><span class="p">,</span><span class="w"> </span><span class="s">"¤00T"</span><span class="p">,</span><span class="w"> </span><span class="s">"¤0B"</span><span class="p">,</span><span class="w"> </span><span class="s">"¤0K"</span><span class="p">,</span><span class="w"> </span><span class="s">"¤0M"</span><span class="p">,</span><span class="w"> </span><span class="s">"¤0T"</span><span class="p">,</span><span class="w">
|
||
</span><span class="s">"¤ #,##0.00"</span><span class="p">,</span><span class="w"> </span><span class="s">"¤ #,##0.00;(¤ #,##0.00)"</span><span class="p">,</span><span class="w"> </span><span class="s">"¤ 000B"</span><span class="p">,</span><span class="w"> </span><span class="s">"¤ 000K"</span><span class="p">,</span><span class="w"> </span><span class="s">"¤ 000M"</span><span class="p">,</span><span class="w">
|
||
</span><span class="s">"¤ 000T"</span><span class="p">,</span><span class="w"> </span><span class="s">"¤ 00B"</span><span class="p">,</span><span class="w"> </span><span class="s">"¤ 00K"</span><span class="p">,</span><span class="w"> </span><span class="s">"¤ 00M"</span><span class="p">,</span><span class="w"> </span><span class="s">"¤ 00T"</span><span class="p">,</span><span class="w"> </span><span class="s">"¤ 0B"</span><span class="p">,</span><span class="w"> </span><span class="s">"¤ 0K"</span><span class="p">,</span><span class="w"> </span><span class="s">"¤ 0M"</span><span class="p">,</span><span class="w"> </span><span class="s">"¤ 0T"</span><span class="p" data-group-id="6614833382-3">]</span><span class="p" data-group-id="6614833382-2">}</span></code></pre>
|
||
</section>
|
||
</section>
|
||
<section class="detail" id="default_grouping_for/1">
|
||
|
||
<span id="default_grouping_for/0"></span>
|
||
|
||
<div class="detail-header">
|
||
<a href="#default_grouping_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">default_grouping_for(locale \\ Plausible.Cldr.get_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> default_grouping_for(<a href="https://hexdocs.pm/ex_cldr/2.39.2/Cldr.Locale.html#t:locale_reference/0">Cldr.Locale.locale_reference</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>
|
||
|
||
</div>
|
||
|
||
<p>Returns the default grouping for a locale as a map.</p><h2 id="default_grouping_for/1-arguments" class="section-heading">
|
||
<a href="#default_grouping_for/1-arguments" class="hover-link">
|
||
<i class="ri-link-m" aria-hidden="true"></i>
|
||
</a>
|
||
<span class="text">Arguments</span>
|
||
</h2>
|
||
<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>
|
||
or a <a href="https://hexdocs.pm/ex_cldr/2.39.2/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>. The default
|
||
is <a href="Plausible.Cldr.html#get_locale/0"><code class="inline">Plausible.Cldr.get_locale/0</code></a>.</li></ul><h2 id="default_grouping_for/1-returns" class="section-heading">
|
||
<a href="#default_grouping_for/1-returns" class="hover-link">
|
||
<i class="ri-link-m" aria-hidden="true"></i>
|
||
</a>
|
||
<span class="text">Returns</span>
|
||
</h2>
|
||
<ul><li><p><code class="inline">{:ok, grouping}</code> or</p></li><li><p><code class="inline">{:error, {exception, message}}</code></p></li></ul><h2 id="default_grouping_for/1-examples" class="section-heading">
|
||
<a href="#default_grouping_for/1-examples" class="hover-link">
|
||
<i class="ri-link-m" aria-hidden="true"></i>
|
||
</a>
|
||
<span class="text">Examples</span>
|
||
</h2>
|
||
<pre><code class="makeup elixir" translate="no"><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr.Number.Format</span><span class="o">.</span><span class="n">default_grouping_for</span><span class="p" data-group-id="8694752128-1">(</span><span class="ss">:en</span><span class="p" data-group-id="8694752128-1">)</span><span class="w">
|
||
</span><span class="p" data-group-id="8694752128-2">{</span><span class="ss">:ok</span><span class="p">,</span><span class="w"> </span><span class="p" data-group-id="8694752128-3">%{</span><span class="ss">fraction</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="8694752128-4">%{</span><span class="ss">first</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">rest</span><span class="p">:</span><span class="w"> </span><span class="mi">0</span><span class="p" data-group-id="8694752128-4">}</span><span class="p">,</span><span class="w"> </span><span class="ss">integer</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="8694752128-5">%{</span><span class="ss">first</span><span class="p">:</span><span class="w"> </span><span class="mi">3</span><span class="p">,</span><span class="w"> </span><span class="ss">rest</span><span class="p">:</span><span class="w"> </span><span class="mi">3</span><span class="p" data-group-id="8694752128-5">}</span><span class="p" data-group-id="8694752128-3">}</span><span class="p" data-group-id="8694752128-2">}</span></code></pre>
|
||
</section>
|
||
</section>
|
||
<section class="detail" id="default_grouping_for!/1">
|
||
|
||
<div class="detail-header">
|
||
<a href="#default_grouping_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">default_grouping_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">
|
||
|
||
<pre translate="no"><span class="attribute">@spec</span> default_grouping_for!(<a href="https://hexdocs.pm/ex_cldr/2.39.2/Cldr.Locale.html#t:locale_reference/0">Cldr.Locale.locale_reference</a>()) ::
|
||
%{
|
||
fraction: %{first: <a href="https://hexdocs.pm/elixir/typespecs.html#basic-types">non_neg_integer</a>(), rest: <a href="https://hexdocs.pm/elixir/typespecs.html#basic-types">non_neg_integer</a>()},
|
||
integer: %{first: <a href="https://hexdocs.pm/elixir/typespecs.html#basic-types">non_neg_integer</a>(), rest: <a href="https://hexdocs.pm/elixir/typespecs.html#basic-types">non_neg_integer</a>()}
|
||
}
|
||
| <a href="https://hexdocs.pm/elixir/typespecs.html#built-in-types">no_return</a>()</pre>
|
||
|
||
</div>
|
||
|
||
<p>Returns the default grouping for a locale
|
||
or raises on error.</p><h2 id="default_grouping_for!/1-arguments" class="section-heading">
|
||
<a href="#default_grouping_for!/1-arguments" class="hover-link">
|
||
<i class="ri-link-m" aria-hidden="true"></i>
|
||
</a>
|
||
<span class="text">Arguments</span>
|
||
</h2>
|
||
<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>
|
||
or a <a href="https://hexdocs.pm/ex_cldr/2.39.2/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>. The default
|
||
is <a href="Plausible.Cldr.html#get_locale/0"><code class="inline">Plausible.Cldr.get_locale/0</code></a>.</li></ul><h2 id="default_grouping_for!/1-returns" class="section-heading">
|
||
<a href="#default_grouping_for!/1-returns" class="hover-link">
|
||
<i class="ri-link-m" aria-hidden="true"></i>
|
||
</a>
|
||
<span class="text">Returns</span>
|
||
</h2>
|
||
<ul><li><p><code class="inline">grouping</code> as a map or</p></li><li><p>raises an exception.</p></li></ul><h2 id="default_grouping_for!/1-examples" class="section-heading">
|
||
<a href="#default_grouping_for!/1-examples" class="hover-link">
|
||
<i class="ri-link-m" aria-hidden="true"></i>
|
||
</a>
|
||
<span class="text">Examples</span>
|
||
</h2>
|
||
<pre><code class="makeup elixir" translate="no"><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr.Number.Format</span><span class="o">.</span><span class="n">default_grouping_for!</span><span class="p" data-group-id="0646290731-1">(</span><span class="ss">:en</span><span class="p" data-group-id="0646290731-1">)</span><span class="w">
|
||
</span><span class="p" data-group-id="0646290731-2">%{</span><span class="ss">fraction</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="0646290731-3">%{</span><span class="ss">first</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">rest</span><span class="p">:</span><span class="w"> </span><span class="mi">0</span><span class="p" data-group-id="0646290731-3">}</span><span class="p">,</span><span class="w"> </span><span class="ss">integer</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="0646290731-4">%{</span><span class="ss">first</span><span class="p">:</span><span class="w"> </span><span class="mi">3</span><span class="p">,</span><span class="w"> </span><span class="ss">rest</span><span class="p">:</span><span class="w"> </span><span class="mi">3</span><span class="p" data-group-id="0646290731-4">}</span><span class="p" data-group-id="0646290731-2">}</span></code></pre>
|
||
</section>
|
||
</section>
|
||
<section class="detail" id="formats_for/2">
|
||
|
||
<span id="formats_for/0"></span>
|
||
|
||
<span id="formats_for/1"></span>
|
||
|
||
<div class="detail-header">
|
||
<a href="#formats_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">formats_for(locale \\ Plausible.Cldr.default_locale(), number_system \\ Cldr.Number.System.default_number_system_type())</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> formats_for(<a href="https://hexdocs.pm/ex_cldr/2.39.2/Cldr.LanguageTag.html#t:t/0">Cldr.LanguageTag.t</a>() | <a href="https://hexdocs.pm/elixir/typespecs.html#built-in-types">binary</a>(), <a href="https://hexdocs.pm/elixir/typespecs.html#basic-types">atom</a>() | <a href="https://hexdocs.pm/elixir/String.html#t:t/0">String.t</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>
|
||
|
||
</div>
|
||
|
||
<p>Return the predfined formats for a given <code class="inline">locale</code> and <code class="inline">number_system</code>.</p><h2 id="formats_for/2-arguments" class="section-heading">
|
||
<a href="#formats_for/2-arguments" class="hover-link">
|
||
<i class="ri-link-m" aria-hidden="true"></i>
|
||
</a>
|
||
<span class="text">Arguments</span>
|
||
</h2>
|
||
<ul><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>
|
||
or a <a href="https://hexdocs.pm/ex_cldr/2.39.2/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>. The default
|
||
is <a href="Plausible.Cldr.html#get_locale/0"><code class="inline">Plausible.Cldr.get_locale/0</code></a>.</p></li><li><p><code class="inline">number_system</code> is any valid number system or number system type returned
|
||
by <a href="Plausible.Cldr.Number.System.html#number_systems_for/1"><code class="inline">Plausible.Cldr.Number.System.number_systems_for/1</code></a>.</p></li></ul><h2 id="formats_for/2-example" class="section-heading">
|
||
<a href="#formats_for/2-example" class="hover-link">
|
||
<i class="ri-link-m" aria-hidden="true"></i>
|
||
</a>
|
||
<span class="text">Example</span>
|
||
</h2>
|
||
<pre><code class="makeup elixir" translate="no"><span class="nc">Plausible.Cldr.Number.Format</span><span class="o">.</span><span class="n">formats_for</span><span class="w"> </span><span class="ss">:fr</span><span class="p">,</span><span class="w"> </span><span class="ss">:native</span><span class="w">
|
||
</span><span class="c1">#=> %Cldr.Number.Format{</span><span class="w">
|
||
</span><span class="ss">accounting</span><span class="p">:</span><span class="w"> </span><span class="s">"#,##0.00 ¤;(#,##0.00 ¤)"</span><span class="p">,</span><span class="w">
|
||
</span><span class="ss">currency</span><span class="p">:</span><span class="w"> </span><span class="s">"#,##0.00 ¤"</span><span class="p">,</span><span class="w">
|
||
</span><span class="ss">percent</span><span class="p">:</span><span class="w"> </span><span class="s">"#,##0 %"</span><span class="p">,</span><span class="w">
|
||
</span><span class="ss">scientific</span><span class="p">:</span><span class="w"> </span><span class="s">"#E0"</span><span class="p">,</span><span class="w">
|
||
</span><span class="ss">standard</span><span class="p">:</span><span class="w"> </span><span class="s">"#,##0.###"</span><span class="w">
|
||
</span><span class="ss">currency_short</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="5707445228-1">[</span><span class="p" data-group-id="5707445228-2">{</span><span class="s">"1000"</span><span class="p">,</span><span class="w"> </span><span class="p" data-group-id="5707445228-3">[</span><span class="ss">one</span><span class="p">:</span><span class="w"> </span><span class="s">"0 k ¤"</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">"0 k ¤"</span><span class="p" data-group-id="5707445228-3">]</span><span class="p" data-group-id="5707445228-2">}</span><span class="p">,</span><span class="w">
|
||
</span><span class="p" data-group-id="5707445228-4">{</span><span class="s">"10000"</span><span class="p">,</span><span class="w"> </span><span class="p" data-group-id="5707445228-5">[</span><span class="ss">one</span><span class="p">:</span><span class="w"> </span><span class="s">"00 k ¤"</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">"00 k ¤"</span><span class="p" data-group-id="5707445228-5">]</span><span class="p" data-group-id="5707445228-4">}</span><span class="p">,</span><span class="w">
|
||
</span><span class="p" data-group-id="5707445228-6">{</span><span class="s">"100000"</span><span class="p">,</span><span class="w"> </span><span class="p" data-group-id="5707445228-7">[</span><span class="ss">one</span><span class="p">:</span><span class="w"> </span><span class="s">"000 k ¤"</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">"000 k ¤"</span><span class="p" data-group-id="5707445228-7">]</span><span class="p" data-group-id="5707445228-6">}</span><span class="p">,</span><span class="w">
|
||
</span><span class="p" data-group-id="5707445228-8">{</span><span class="s">"1000000"</span><span class="p">,</span><span class="w"> </span><span class="p" data-group-id="5707445228-9">[</span><span class="ss">one</span><span class="p">:</span><span class="w"> </span><span class="s">"0 M ¤"</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">"0 M ¤"</span><span class="p" data-group-id="5707445228-9">]</span><span class="p" data-group-id="5707445228-8">}</span><span class="p">,</span><span class="w">
|
||
</span><span class="p" data-group-id="5707445228-10">{</span><span class="s">"10000000"</span><span class="p">,</span><span class="w"> </span><span class="p" data-group-id="5707445228-11">[</span><span class="ss">one</span><span class="p">:</span><span class="w"> </span><span class="s">"00 M ¤"</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">"00 M ¤"</span><span class="p" data-group-id="5707445228-11">]</span><span class="p" data-group-id="5707445228-10">}</span><span class="p">,</span><span class="w">
|
||
</span><span class="p" data-group-id="5707445228-12">{</span><span class="s">"100000000"</span><span class="p">,</span><span class="w"> </span><span class="p" data-group-id="5707445228-13">[</span><span class="ss">one</span><span class="p">:</span><span class="w"> </span><span class="s">"000 M ¤"</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">"000 M ¤"</span><span class="p" data-group-id="5707445228-13">]</span><span class="p" data-group-id="5707445228-12">}</span><span class="p">,</span><span class="w">
|
||
</span><span class="p" data-group-id="5707445228-14">{</span><span class="s">"1000000000"</span><span class="p">,</span><span class="w"> </span><span class="p" data-group-id="5707445228-15">[</span><span class="ss">one</span><span class="p">:</span><span class="w"> </span><span class="s">"0 Md ¤"</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">"0 Md ¤"</span><span class="p" data-group-id="5707445228-15">]</span><span class="p" data-group-id="5707445228-14">}</span><span class="p">,</span><span class="w">
|
||
</span><span class="p" data-group-id="5707445228-16">{</span><span class="s">"10000000000"</span><span class="p">,</span><span class="w"> </span><span class="p" data-group-id="5707445228-17">[</span><span class="ss">one</span><span class="p">:</span><span class="w"> </span><span class="s">"00 Md ¤"</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">"00 Md ¤"</span><span class="p" data-group-id="5707445228-17">]</span><span class="p" data-group-id="5707445228-16">}</span><span class="p">,</span><span class="w">
|
||
</span><span class="p" data-group-id="5707445228-18">{</span><span class="s">"100000000000"</span><span class="p">,</span><span class="w"> </span><span class="p" data-group-id="5707445228-19">[</span><span class="ss">one</span><span class="p">:</span><span class="w"> </span><span class="s">"000 Md ¤"</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">"000 Md ¤"</span><span class="p" data-group-id="5707445228-19">]</span><span class="p" data-group-id="5707445228-18">}</span><span class="p">,</span><span class="w">
|
||
</span><span class="p" data-group-id="5707445228-20">{</span><span class="s">"1000000000000"</span><span class="p">,</span><span class="w"> </span><span class="p" data-group-id="5707445228-21">[</span><span class="ss">one</span><span class="p">:</span><span class="w"> </span><span class="s">"0 Bn ¤"</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">"0 Bn ¤"</span><span class="p" data-group-id="5707445228-21">]</span><span class="p" data-group-id="5707445228-20">}</span><span class="p">,</span><span class="w">
|
||
</span><span class="p" data-group-id="5707445228-22">{</span><span class="s">"10000000000000"</span><span class="p">,</span><span class="w"> </span><span class="p" data-group-id="5707445228-23">[</span><span class="ss">one</span><span class="p">:</span><span class="w"> </span><span class="s">"00 Bn ¤"</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">"00 Bn ¤"</span><span class="p" data-group-id="5707445228-23">]</span><span class="p" data-group-id="5707445228-22">}</span><span class="p">,</span><span class="w">
|
||
</span><span class="p" data-group-id="5707445228-24">{</span><span class="s">"100000000000000"</span><span class="p">,</span><span class="w"> </span><span class="p" data-group-id="5707445228-25">[</span><span class="ss">one</span><span class="p">:</span><span class="w"> </span><span class="s">"000 Bn ¤"</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">"000 Bn ¤"</span><span class="p" data-group-id="5707445228-25">]</span><span class="p" data-group-id="5707445228-24">}</span><span class="p" data-group-id="5707445228-1">]</span><span class="p">,</span><span class="w">
|
||
</span><span class="n">...</span><span class="w">
|
||
</span><span class="err">}</span></code></pre>
|
||
</section>
|
||
</section>
|
||
<section class="detail" id="formats_for!/2">
|
||
|
||
<span id="formats_for!/0"></span>
|
||
|
||
<span id="formats_for!/1"></span>
|
||
|
||
<div class="detail-header">
|
||
<a href="#formats_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">formats_for!(locale \\ Plausible.Cldr.default_locale(), number_system \\ Cldr.Number.System.default_number_system_type())</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> formats_for!(
|
||
<a href="https://hexdocs.pm/ex_cldr/2.39.2/Cldr.LanguageTag.html#t:t/0">Cldr.LanguageTag.t</a>() | <a href="https://hexdocs.pm/ex_cldr/2.39.2/Cldr.Locale.html#t:locale_name/0">Cldr.Locale.locale_name</a>(),
|
||
<a href="https://hexdocs.pm/ex_cldr_numbers/2.33.1/Cldr.Number.System.html#t:system_name/0">Cldr.Number.System.system_name</a>()
|
||
) ::
|
||
<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>
|
||
|
||
|
||
</section>
|
||
</section>
|
||
<section class="detail" id="minimum_grouping_digits_for/1">
|
||
|
||
<span id="minimum_grouping_digits_for/0"></span>
|
||
|
||
<div class="detail-header">
|
||
<a href="#minimum_grouping_digits_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">minimum_grouping_digits_for(locale \\ Plausible.Cldr.get_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> minimum_grouping_digits_for(<a href="https://hexdocs.pm/ex_cldr/2.39.2/Cldr.Locale.html#t:locale_reference/0">Cldr.Locale.locale_reference</a>()) ::
|
||
{:ok, <a href="https://hexdocs.pm/elixir/typespecs.html#basic-types">non_neg_integer</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 minimum grouping digits for a locale.</p><h2 id="minimum_grouping_digits_for/1-arguments" class="section-heading">
|
||
<a href="#minimum_grouping_digits_for/1-arguments" class="hover-link">
|
||
<i class="ri-link-m" aria-hidden="true"></i>
|
||
</a>
|
||
<span class="text">Arguments</span>
|
||
</h2>
|
||
<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>
|
||
or a <a href="https://hexdocs.pm/ex_cldr/2.39.2/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>. The default
|
||
is <a href="Plausible.Cldr.html#get_locale/0"><code class="inline">Plausible.Cldr.get_locale/0</code></a>.</li></ul><h2 id="minimum_grouping_digits_for/1-returns" class="section-heading">
|
||
<a href="#minimum_grouping_digits_for/1-returns" class="hover-link">
|
||
<i class="ri-link-m" aria-hidden="true"></i>
|
||
</a>
|
||
<span class="text">Returns</span>
|
||
</h2>
|
||
<ul><li><p><code class="inline">{:ok, minumum_digits}</code> or</p></li><li><p><code class="inline">{:error, {exception, message}}</code></p></li></ul><h2 id="minimum_grouping_digits_for/1-examples" class="section-heading">
|
||
<a href="#minimum_grouping_digits_for/1-examples" class="hover-link">
|
||
<i class="ri-link-m" aria-hidden="true"></i>
|
||
</a>
|
||
<span class="text">Examples</span>
|
||
</h2>
|
||
<pre><code class="makeup elixir" translate="no"><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr.Number.Format</span><span class="o">.</span><span class="n">minimum_grouping_digits_for</span><span class="p" data-group-id="6271164053-1">(</span><span class="s">"en"</span><span class="p" data-group-id="6271164053-1">)</span><span class="w">
|
||
</span><span class="p" data-group-id="6271164053-2">{</span><span class="ss">:ok</span><span class="p">,</span><span class="w"> </span><span class="mi">1</span><span class="p" data-group-id="6271164053-2">}</span></code></pre>
|
||
</section>
|
||
</section>
|
||
<section class="detail" id="minimum_grouping_digits_for!/1">
|
||
|
||
<div class="detail-header">
|
||
<a href="#minimum_grouping_digits_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">minimum_grouping_digits_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">
|
||
|
||
<pre translate="no"><span class="attribute">@spec</span> minimum_grouping_digits_for!(<a href="https://hexdocs.pm/ex_cldr/2.39.2/Cldr.Locale.html#t:locale_reference/0">Cldr.Locale.locale_reference</a>()) ::
|
||
<a href="https://hexdocs.pm/elixir/typespecs.html#basic-types">non_neg_integer</a>() | <a href="https://hexdocs.pm/elixir/typespecs.html#built-in-types">no_return</a>()</pre>
|
||
|
||
</div>
|
||
|
||
<p>Returns the minimum grouping digits for a locale
|
||
or raises on error.</p><h2 id="minimum_grouping_digits_for!/1-arguments" class="section-heading">
|
||
<a href="#minimum_grouping_digits_for!/1-arguments" class="hover-link">
|
||
<i class="ri-link-m" aria-hidden="true"></i>
|
||
</a>
|
||
<span class="text">Arguments</span>
|
||
</h2>
|
||
<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>
|
||
or a <a href="https://hexdocs.pm/ex_cldr/2.39.2/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>. The default
|
||
is <a href="Plausible.Cldr.html#get_locale/0"><code class="inline">Plausible.Cldr.get_locale/0</code></a>.</li></ul><h2 id="minimum_grouping_digits_for!/1-returns" class="section-heading">
|
||
<a href="#minimum_grouping_digits_for!/1-returns" class="hover-link">
|
||
<i class="ri-link-m" aria-hidden="true"></i>
|
||
</a>
|
||
<span class="text">Returns</span>
|
||
</h2>
|
||
<ul><li><p><code class="inline">minumum_digits</code> or</p></li><li><p>raises an exception.</p></li></ul><h2 id="minimum_grouping_digits_for!/1-examples" class="section-heading">
|
||
<a href="#minimum_grouping_digits_for!/1-examples" class="hover-link">
|
||
<i class="ri-link-m" aria-hidden="true"></i>
|
||
</a>
|
||
<span class="text">Examples</span>
|
||
</h2>
|
||
<pre><code class="makeup elixir" translate="no"><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr.Number.Format</span><span class="o">.</span><span class="n">minimum_grouping_digits_for!</span><span class="p" data-group-id="9770550453-1">(</span><span class="s">"en"</span><span class="p" data-group-id="9770550453-1">)</span><span class="w">
|
||
</span><span class="mi">1</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
|
||
<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
|
||
|
||
<a href="https://elixir-lang.org" title="Elixir" target="_blank" translate="no">Elixir programming language</a>
|
||
|
||
</p>
|
||
</footer>
|
||
</div>
|
||
</div>
|
||
</main>
|
||
</div>
|
||
|
||
<script src="https://cdn.jsdelivr.net/npm/mermaid/dist/mermaid.min.js"></script>
|
||
<script>mermaid.initialize({startOnLoad: true})</script>
|
||
|
||
</body>
|
||
</html>
|