mirror of
https://github.com/plausible/analytics.git
synced 2024-12-25 10:33:01 +03:00
871 lines
61 KiB
HTML
871 lines
61 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.29.4">
|
||
<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-HHVY3JYD.css" />
|
||
|
||
|
||
<script src="dist/handlebars.runtime-NWIB6V2M.js"></script>
|
||
<script src="dist/handlebars.templates-XWGFFSCD.js"></script>
|
||
<script src="dist/sidebar_items-625D214B.js"></script>
|
||
|
||
<script src="docs_config.js"></script>
|
||
|
||
<script async src="dist/html-JDI3AVDD.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 class="sidebar-button sidebar-toggle" aria-label="toggle sidebar">
|
||
<i class="ri-menu-line ri-lg" title="Collapse/expand sidebar"></i>
|
||
</button>
|
||
|
||
<section class="sidebar">
|
||
<form class="sidebar-search" action="search.html">
|
||
<button type="submit" class="search-button" aria-label="Submit Search">
|
||
<i class="ri-search-2-line" aria-hidden="true" title="Submit search"></i>
|
||
</button>
|
||
<button type="button" tabindex="-1" class="search-close-button" aria-label="Cancel Search">
|
||
<i class="ri-close-line ri-lg" aria-hidden="true" title="Cancel search"></i>
|
||
</button>
|
||
<label class="search-label">
|
||
<p class="sr-only">Search</p>
|
||
<input name="q" type="text" class="search-input" placeholder="Search..." aria-label="Input your search terms" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" />
|
||
</label>
|
||
</form>
|
||
|
||
<div class="autocomplete">
|
||
<div class="autocomplete-results">
|
||
</div>
|
||
</div>
|
||
|
||
<div class="sidebar-header">
|
||
|
||
<a href="readme.html">
|
||
<img src="assets/logo.png" alt="Plausible" class="sidebar-projectImage">
|
||
</a>
|
||
|
||
<div class="sidebar-projectDetails">
|
||
<a href="readme.html" class="sidebar-projectName" translate="no">
|
||
Plausible
|
||
</a>
|
||
<div class="sidebar-projectVersion" translate="no">
|
||
v0.0.1
|
||
</div>
|
||
</div>
|
||
<ul class="sidebar-listNav">
|
||
<li><a id="extras-list-link" href="#full-list">Pages</a></li>
|
||
|
||
<li><a id="modules-list-link" href="#full-list">Modules</a></li>
|
||
|
||
|
||
<li><a id="tasks-list-link" href="#full-list"><span translate="no">Mix</span> Tasks</a></li>
|
||
|
||
</ul>
|
||
</div>
|
||
|
||
<div class="gradient"></div>
|
||
<ul id="full-list"></ul>
|
||
</section>
|
||
|
||
<section class="content">
|
||
<output role="status" id="toast"></output>
|
||
<div class="content-outer">
|
||
<div id="content" class="content-inner">
|
||
|
||
<h1>
|
||
<button class="icon-action display-settings">
|
||
<i class="ri-settings-3-line"></i>
|
||
<span class="sr-only">Settings</span>
|
||
</button>
|
||
|
||
|
||
<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>
|
||
<p class="sr-only">number-pattern-examples</p>
|
||
</a>
|
||
Number Pattern Examples
|
||
</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>
|
||
<span class="sr-only">Link to this section</span>
|
||
</a>
|
||
Summary
|
||
</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>
|
||
<span class="sr-only">Link to this section</span>
|
||
</a>
|
||
Functions
|
||
</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.36.0/Cldr.LanguageTag.html#t:t/0">Cldr.LanguageTag.t</a>() | <a href="https://hexdocs.pm/ex_cldr/2.36.0/Cldr.Locale.html#t:locale_name/0">Cldr.Locale.locale_name</a>()) ::
|
||
{:ok, <a href="https://hexdocs.pm/elixir/typespecs.html#basic-types">map</a>()} | {:error, {<a href="https://hexdocs.pm/elixir/typespecs.html#built-in-types">module</a>(), <a href="https://hexdocs.pm/elixir/String.html#t:t/0">String.t</a>()}}</pre>
|
||
|
||
</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>
|
||
<p class="sr-only">arguments</p>
|
||
</a>
|
||
Arguments
|
||
</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.36.0/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>
|
||
<p class="sr-only">returns</p>
|
||
</a>
|
||
Returns
|
||
</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">
|
||
|
||
<div class="specs">
|
||
|
||
<pre translate="no"><span class="attribute">@spec</span> all_formats_for!(<a href="https://hexdocs.pm/ex_cldr/2.36.0/Cldr.LanguageTag.html#t:t/0">Cldr.LanguageTag.t</a>() | <a href="https://hexdocs.pm/ex_cldr/2.36.0/Cldr.Locale.html#t:locale_name/0">Cldr.Locale.locale_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>
|
||
<p class="sr-only">arguments</p>
|
||
</a>
|
||
Arguments
|
||
</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.36.0/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>
|
||
<p class="sr-only">returns</p>
|
||
</a>
|
||
Returns
|
||
</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.36.0/Cldr.LanguageTag.html#t:t/0">Cldr.LanguageTag.t</a>() | <a href="https://hexdocs.pm/ex_cldr/2.36.0/Cldr.Locale.html#t:locale_name/0">Cldr.Locale.locale_name</a>(),
|
||
<a href="https://hexdocs.pm/ex_cldr_numbers/2.30.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.30.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>
|
||
<p class="sr-only">example</p>
|
||
</a>
|
||
Example
|
||
</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="0815556124-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="0815556124-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.36.0/Cldr.LanguageTag.html#t:t/0">Cldr.LanguageTag.t</a>() | <a href="https://hexdocs.pm/ex_cldr/2.36.0/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>
|
||
<p class="sr-only">arguments</p>
|
||
</a>
|
||
Arguments
|
||
</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.36.0/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>
|
||
<p class="sr-only">example</p>
|
||
</a>
|
||
Example
|
||
</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="1721410816-1">(</span><span class="ss">:en</span><span class="p" data-group-id="1721410816-1">)</span><span class="w">
|
||
</span><span class="p" data-group-id="1721410816-2">{</span><span class="ss">:ok</span><span class="p">,</span><span class="w"> </span><span class="p" data-group-id="1721410816-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="1721410816-3">]</span><span class="p" data-group-id="1721410816-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.36.0/Cldr.LanguageTag.html#t:t/0">Cldr.LanguageTag.t</a>() | <a href="https://hexdocs.pm/ex_cldr/2.36.0/Cldr.Locale.html#t:locale_name/0">Cldr.Locale.locale_name</a>()) ::
|
||
{:ok, <a href="https://hexdocs.pm/elixir/typespecs.html#basic-types">map</a>()} | {:error, {<a href="https://hexdocs.pm/elixir/typespecs.html#built-in-types">module</a>(), <a href="https://hexdocs.pm/elixir/String.html#t:t/0">String.t</a>()}}</pre>
|
||
|
||
</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>
|
||
<p class="sr-only">arguments</p>
|
||
</a>
|
||
Arguments
|
||
</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.36.0/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>
|
||
<p class="sr-only">returns</p>
|
||
</a>
|
||
Returns
|
||
</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>
|
||
<p class="sr-only">examples</p>
|
||
</a>
|
||
Examples
|
||
</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="2775075432-1">(</span><span class="ss">:en</span><span class="p" data-group-id="2775075432-1">)</span><span class="w">
|
||
</span><span class="p" data-group-id="2775075432-2">{</span><span class="ss">:ok</span><span class="p">,</span><span class="w"> </span><span class="p" data-group-id="2775075432-3">%{</span><span class="ss">fraction</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="2775075432-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="2775075432-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="2775075432-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="2775075432-5">}</span><span class="p" data-group-id="2775075432-3">}</span><span class="p" data-group-id="2775075432-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.36.0/Cldr.LanguageTag.html#t:t/0">Cldr.LanguageTag.t</a>() | <a href="https://hexdocs.pm/ex_cldr/2.36.0/Cldr.Locale.html#t:locale_name/0">Cldr.Locale.locale_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 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>
|
||
<p class="sr-only">arguments</p>
|
||
</a>
|
||
Arguments
|
||
</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.36.0/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>
|
||
<p class="sr-only">returns</p>
|
||
</a>
|
||
Returns
|
||
</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>
|
||
<p class="sr-only">examples</p>
|
||
</a>
|
||
Examples
|
||
</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="9568411351-1">(</span><span class="ss">:en</span><span class="p" data-group-id="9568411351-1">)</span><span class="w">
|
||
</span><span class="p" data-group-id="9568411351-2">%{</span><span class="ss">fraction</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="9568411351-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="9568411351-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="9568411351-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="9568411351-4">}</span><span class="p" data-group-id="9568411351-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.36.0/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>
|
||
<p class="sr-only">arguments</p>
|
||
</a>
|
||
Arguments
|
||
</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.36.0/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>
|
||
<p class="sr-only">example</p>
|
||
</a>
|
||
Example
|
||
</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="3942899569-1">[</span><span class="p" data-group-id="3942899569-2">{</span><span class="s">"1000"</span><span class="p">,</span><span class="w"> </span><span class="p" data-group-id="3942899569-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="3942899569-3">]</span><span class="p" data-group-id="3942899569-2">}</span><span class="p">,</span><span class="w">
|
||
</span><span class="p" data-group-id="3942899569-4">{</span><span class="s">"10000"</span><span class="p">,</span><span class="w"> </span><span class="p" data-group-id="3942899569-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="3942899569-5">]</span><span class="p" data-group-id="3942899569-4">}</span><span class="p">,</span><span class="w">
|
||
</span><span class="p" data-group-id="3942899569-6">{</span><span class="s">"100000"</span><span class="p">,</span><span class="w"> </span><span class="p" data-group-id="3942899569-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="3942899569-7">]</span><span class="p" data-group-id="3942899569-6">}</span><span class="p">,</span><span class="w">
|
||
</span><span class="p" data-group-id="3942899569-8">{</span><span class="s">"1000000"</span><span class="p">,</span><span class="w"> </span><span class="p" data-group-id="3942899569-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="3942899569-9">]</span><span class="p" data-group-id="3942899569-8">}</span><span class="p">,</span><span class="w">
|
||
</span><span class="p" data-group-id="3942899569-10">{</span><span class="s">"10000000"</span><span class="p">,</span><span class="w"> </span><span class="p" data-group-id="3942899569-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="3942899569-11">]</span><span class="p" data-group-id="3942899569-10">}</span><span class="p">,</span><span class="w">
|
||
</span><span class="p" data-group-id="3942899569-12">{</span><span class="s">"100000000"</span><span class="p">,</span><span class="w"> </span><span class="p" data-group-id="3942899569-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="3942899569-13">]</span><span class="p" data-group-id="3942899569-12">}</span><span class="p">,</span><span class="w">
|
||
</span><span class="p" data-group-id="3942899569-14">{</span><span class="s">"1000000000"</span><span class="p">,</span><span class="w"> </span><span class="p" data-group-id="3942899569-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="3942899569-15">]</span><span class="p" data-group-id="3942899569-14">}</span><span class="p">,</span><span class="w">
|
||
</span><span class="p" data-group-id="3942899569-16">{</span><span class="s">"10000000000"</span><span class="p">,</span><span class="w"> </span><span class="p" data-group-id="3942899569-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="3942899569-17">]</span><span class="p" data-group-id="3942899569-16">}</span><span class="p">,</span><span class="w">
|
||
</span><span class="p" data-group-id="3942899569-18">{</span><span class="s">"100000000000"</span><span class="p">,</span><span class="w"> </span><span class="p" data-group-id="3942899569-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="3942899569-19">]</span><span class="p" data-group-id="3942899569-18">}</span><span class="p">,</span><span class="w">
|
||
</span><span class="p" data-group-id="3942899569-20">{</span><span class="s">"1000000000000"</span><span class="p">,</span><span class="w"> </span><span class="p" data-group-id="3942899569-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="3942899569-21">]</span><span class="p" data-group-id="3942899569-20">}</span><span class="p">,</span><span class="w">
|
||
</span><span class="p" data-group-id="3942899569-22">{</span><span class="s">"10000000000000"</span><span class="p">,</span><span class="w"> </span><span class="p" data-group-id="3942899569-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="3942899569-23">]</span><span class="p" data-group-id="3942899569-22">}</span><span class="p">,</span><span class="w">
|
||
</span><span class="p" data-group-id="3942899569-24">{</span><span class="s">"100000000000000"</span><span class="p">,</span><span class="w"> </span><span class="p" data-group-id="3942899569-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="3942899569-25">]</span><span class="p" data-group-id="3942899569-24">}</span><span class="p" data-group-id="3942899569-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.36.0/Cldr.LanguageTag.html#t:t/0">Cldr.LanguageTag.t</a>() | <a href="https://hexdocs.pm/ex_cldr/2.36.0/Cldr.Locale.html#t:locale_name/0">Cldr.Locale.locale_name</a>(),
|
||
<a href="https://hexdocs.pm/ex_cldr_numbers/2.30.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.36.0/Cldr.LanguageTag.html#t:t/0">Cldr.LanguageTag.t</a>() | <a href="https://hexdocs.pm/ex_cldr/2.36.0/Cldr.Locale.html#t:locale_name/0">Cldr.Locale.locale_name</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>
|
||
<p class="sr-only">arguments</p>
|
||
</a>
|
||
Arguments
|
||
</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.36.0/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>
|
||
<p class="sr-only">returns</p>
|
||
</a>
|
||
Returns
|
||
</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>
|
||
<p class="sr-only">examples</p>
|
||
</a>
|
||
Examples
|
||
</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="4521670856-1">(</span><span class="s">"en"</span><span class="p" data-group-id="4521670856-1">)</span><span class="w">
|
||
</span><span class="p" data-group-id="4521670856-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="4521670856-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.36.0/Cldr.LanguageTag.html#t:t/0">Cldr.LanguageTag.t</a>() | <a href="https://hexdocs.pm/ex_cldr/2.36.0/Cldr.Locale.html#t:locale_name/0">Cldr.Locale.locale_name</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>
|
||
<p class="sr-only">arguments</p>
|
||
</a>
|
||
Arguments
|
||
</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.36.0/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>
|
||
<p class="sr-only">returns</p>
|
||
</a>
|
||
Returns
|
||
</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>
|
||
<p class="sr-only">examples</p>
|
||
</a>
|
||
Examples
|
||
</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="6043797346-1">(</span><span class="s">"en"</span><span class="p" data-group-id="6043797346-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.29.4) for the
|
||
|
||
<a href="https://elixir-lang.org" title="Elixir" target="_blank" translate="no">Elixir programming language</a>
|
||
|
||
</p>
|
||
</footer>
|
||
</div>
|
||
</div>
|
||
</section>
|
||
</div>
|
||
|
||
<script src="https://cdn.jsdelivr.net/npm/mermaid/dist/mermaid.min.js"></script>
|
||
<script>mermaid.initialize({startOnLoad: true})</script>
|
||
|
||
</body>
|
||
</html>
|