mirror of
https://github.com/plausible/analytics.git
synced 2024-11-23 11:12:15 +03:00
deploy: b0fc527eb2
This commit is contained in:
parent
90904dea5f
commit
99f23da33f
@ -1153,23 +1153,23 @@ pool to disconnect within the given interval.</p><p>See <a href="https://hexdocs
|
||||
|
||||
<section class="docstring">
|
||||
|
||||
<p>Similar to <a href="#insert_all/2"><code class="inline">insert_all/2</code></a> but with the following differences:</p><ul><li>accepts rows as streams or lists</li><li>sends rows as a chunked request</li><li>doesn't autogenerate ids or does any other preprocessing</li></ul><p>Example:</p><pre><code class="makeup elixir" translate="no"><span class="nc">Repo</span><span class="o">.</span><span class="n">query!</span><span class="p" data-group-id="1589228611-1">(</span><span class="s">"create table ecto_ch_demo(a UInt64, b String) engine Null"</span><span class="p" data-group-id="1589228611-1">)</span><span class="w">
|
||||
<p>Similar to <a href="#insert_all/2"><code class="inline">insert_all/2</code></a> but with the following differences:</p><ul><li>accepts rows as streams or lists</li><li>sends rows as a chunked request</li><li>doesn't autogenerate ids or does any other preprocessing</li></ul><p>Example:</p><pre><code class="makeup elixir" translate="no"><span class="nc">Repo</span><span class="o">.</span><span class="n">query!</span><span class="p" data-group-id="0164742217-1">(</span><span class="s">"create table ecto_ch_demo(a UInt64, b String) engine Null"</span><span class="p" data-group-id="0164742217-1">)</span><span class="w">
|
||||
|
||||
</span><span class="kd">defmodule</span><span class="w"> </span><span class="nc">Demo</span><span class="w"> </span><span class="k" data-group-id="1589228611-2">do</span><span class="w">
|
||||
</span><span class="kd">defmodule</span><span class="w"> </span><span class="nc">Demo</span><span class="w"> </span><span class="k" data-group-id="0164742217-2">do</span><span class="w">
|
||||
</span><span class="kn">use</span><span class="w"> </span><span class="nc">Ecto.Schema</span><span class="w">
|
||||
|
||||
</span><span class="na">@primary_key</span><span class="w"> </span><span class="no">false</span><span class="w">
|
||||
</span><span class="n">schema</span><span class="w"> </span><span class="s">"ecto_ch_demo"</span><span class="w"> </span><span class="k" data-group-id="1589228611-3">do</span><span class="w">
|
||||
</span><span class="n">schema</span><span class="w"> </span><span class="s">"ecto_ch_demo"</span><span class="w"> </span><span class="k" data-group-id="0164742217-3">do</span><span class="w">
|
||||
</span><span class="n">field</span><span class="w"> </span><span class="ss">:a</span><span class="p">,</span><span class="w"> </span><span class="nc">Ch</span><span class="p">,</span><span class="w"> </span><span class="ss">type</span><span class="p">:</span><span class="w"> </span><span class="s">"UInt64"</span><span class="w">
|
||||
</span><span class="n">field</span><span class="w"> </span><span class="ss">:b</span><span class="p">,</span><span class="w"> </span><span class="ss">:string</span><span class="w">
|
||||
</span><span class="k" data-group-id="1589228611-3">end</span><span class="w">
|
||||
</span><span class="k" data-group-id="1589228611-2">end</span><span class="w">
|
||||
</span><span class="k" data-group-id="0164742217-3">end</span><span class="w">
|
||||
</span><span class="k" data-group-id="0164742217-2">end</span><span class="w">
|
||||
|
||||
</span><span class="n">rows</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nc">Stream</span><span class="o">.</span><span class="n">map</span><span class="p" data-group-id="1589228611-4">(</span><span class="mi">1</span><span class="o">..</span><span class="mi">100_000</span><span class="p">,</span><span class="w"> </span><span class="k" data-group-id="1589228611-5">fn</span><span class="w"> </span><span class="n">i</span><span class="w"> </span><span class="o">-></span><span class="w"> </span><span class="p" data-group-id="1589228611-6">%{</span><span class="ss">a</span><span class="p">:</span><span class="w"> </span><span class="n">i</span><span class="p">,</span><span class="w"> </span><span class="ss">b</span><span class="p">:</span><span class="w"> </span><span class="n">to_string</span><span class="p" data-group-id="1589228611-7">(</span><span class="n">i</span><span class="p" data-group-id="1589228611-7">)</span><span class="p" data-group-id="1589228611-6">}</span><span class="w"> </span><span class="k" data-group-id="1589228611-5">end</span><span class="p" data-group-id="1589228611-4">)</span><span class="w">
|
||||
</span><span class="p" data-group-id="1589228611-8">{</span><span class="mi">100_000</span><span class="p">,</span><span class="w"> </span><span class="no">nil</span><span class="p" data-group-id="1589228611-8">}</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nc">Repo</span><span class="o">.</span><span class="n">insert_stream</span><span class="p" data-group-id="1589228611-9">(</span><span class="nc">Demo</span><span class="p">,</span><span class="w"> </span><span class="n">rows</span><span class="p" data-group-id="1589228611-9">)</span><span class="w">
|
||||
</span><span class="n">rows</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nc">Stream</span><span class="o">.</span><span class="n">map</span><span class="p" data-group-id="0164742217-4">(</span><span class="mi">1</span><span class="o">..</span><span class="mi">100_000</span><span class="p">,</span><span class="w"> </span><span class="k" data-group-id="0164742217-5">fn</span><span class="w"> </span><span class="n">i</span><span class="w"> </span><span class="o">-></span><span class="w"> </span><span class="p" data-group-id="0164742217-6">%{</span><span class="ss">a</span><span class="p">:</span><span class="w"> </span><span class="n">i</span><span class="p">,</span><span class="w"> </span><span class="ss">b</span><span class="p">:</span><span class="w"> </span><span class="n">to_string</span><span class="p" data-group-id="0164742217-7">(</span><span class="n">i</span><span class="p" data-group-id="0164742217-7">)</span><span class="p" data-group-id="0164742217-6">}</span><span class="w"> </span><span class="k" data-group-id="0164742217-5">end</span><span class="p" data-group-id="0164742217-4">)</span><span class="w">
|
||||
</span><span class="p" data-group-id="0164742217-8">{</span><span class="mi">100_000</span><span class="p">,</span><span class="w"> </span><span class="no">nil</span><span class="p" data-group-id="0164742217-8">}</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nc">Repo</span><span class="o">.</span><span class="n">insert_stream</span><span class="p" data-group-id="0164742217-9">(</span><span class="nc">Demo</span><span class="p">,</span><span class="w"> </span><span class="n">rows</span><span class="p" data-group-id="0164742217-9">)</span><span class="w">
|
||||
|
||||
</span><span class="c1"># schemaless</span><span class="w">
|
||||
</span><span class="p" data-group-id="1589228611-10">{</span><span class="mi">100_000</span><span class="p">,</span><span class="w"> </span><span class="no">nil</span><span class="p" data-group-id="1589228611-10">}</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nc">Repo</span><span class="o">.</span><span class="n">insert_stream</span><span class="p" data-group-id="1589228611-11">(</span><span class="s">"ecto_ch_demo"</span><span class="p">,</span><span class="w"> </span><span class="n">rows</span><span class="p">,</span><span class="w"> </span><span class="ss">types</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="1589228611-12">[</span><span class="ss">a</span><span class="p">:</span><span class="w"> </span><span class="nc">Ch.Types</span><span class="o">.</span><span class="n">u64</span><span class="p" data-group-id="1589228611-13">(</span><span class="p" data-group-id="1589228611-13">)</span><span class="p">,</span><span class="w"> </span><span class="ss">b</span><span class="p">:</span><span class="w"> </span><span class="ss">:string</span><span class="p" data-group-id="1589228611-12">]</span><span class="p" data-group-id="1589228611-11">)</span></code></pre>
|
||||
</span><span class="p" data-group-id="0164742217-10">{</span><span class="mi">100_000</span><span class="p">,</span><span class="w"> </span><span class="no">nil</span><span class="p" data-group-id="0164742217-10">}</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nc">Repo</span><span class="o">.</span><span class="n">insert_stream</span><span class="p" data-group-id="0164742217-11">(</span><span class="s">"ecto_ch_demo"</span><span class="p">,</span><span class="w"> </span><span class="n">rows</span><span class="p">,</span><span class="w"> </span><span class="ss">types</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="0164742217-12">[</span><span class="ss">a</span><span class="p">:</span><span class="w"> </span><span class="nc">Ch.Types</span><span class="o">.</span><span class="n">u64</span><span class="p" data-group-id="0164742217-13">(</span><span class="p" data-group-id="0164742217-13">)</span><span class="p">,</span><span class="w"> </span><span class="ss">b</span><span class="p">:</span><span class="w"> </span><span class="ss">:string</span><span class="p" data-group-id="0164742217-12">]</span><span class="p" data-group-id="0164742217-11">)</span></code></pre>
|
||||
</section>
|
||||
</section>
|
||||
<section class="detail" id="load/2">
|
||||
@ -1508,7 +1508,7 @@ pool to disconnect within the given interval.</p><p>See <a href="https://hexdocs
|
||||
|
||||
</div>
|
||||
|
||||
<p>Similar to <a href="#to_sql/2"><code class="inline">to_sql/2</code></a> but inlines the parameters into the SQL query.</p><p>See <a href="https://hexdocs.pm/ecto_ch/0.3.4/Ecto.Adapters.ClickHouse.html#to_inline_sql/2"><code class="inline">Ecto.Adapters.ClickHouse.to_inline_sql/2</code></a> for more information.</p>
|
||||
<p>Similar to <a href="#to_sql/2"><code class="inline">to_sql/2</code></a> but inlines the parameters into the SQL query.</p><p>See <a href="https://hexdocs.pm/ecto_ch/0.3.5/Ecto.Adapters.ClickHouse.html#to_inline_sql/2"><code class="inline">Ecto.Adapters.ClickHouse.to_inline_sql/2</code></a> for more information.</p>
|
||||
</section>
|
||||
</section>
|
||||
<section class="detail" id="to_sql/2">
|
||||
|
@ -727,12 +727,12 @@ this user owns + StatsAPI if the user has a configured Stats API key.</p><p>Give
|
||||
|
||||
<p>Queries the ClickHouse database for the monthly pageview usage. If the given user's
|
||||
subscription is <code class="inline">active</code>, <code class="inline">past_due</code>, or a <code class="inline">deleted</code> (but not yet expired), a map
|
||||
with the following structure is returned:</p><pre><code class="makeup elixir" translate="no"><span class="p" data-group-id="7963996739-1">%{</span><span class="w">
|
||||
</span><span class="ss">current_cycle</span><span class="p">:</span><span class="w"> </span><span class="n">usage_cycle</span><span class="p" data-group-id="7963996739-2">(</span><span class="p" data-group-id="7963996739-2">)</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">last_cycle</span><span class="p">:</span><span class="w"> </span><span class="n">usage_cycle</span><span class="p" data-group-id="7963996739-3">(</span><span class="p" data-group-id="7963996739-3">)</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">penultimate_cycle</span><span class="p">:</span><span class="w"> </span><span class="n">usage_cycle</span><span class="p" data-group-id="7963996739-4">(</span><span class="p" data-group-id="7963996739-4">)</span><span class="w">
|
||||
</span><span class="p" data-group-id="7963996739-1">}</span></code></pre><p>In all other cases of the subscription status (or a <code class="inline">free_10k</code> subscription which
|
||||
does not have a <code class="inline">last_bill_date</code> defined) - the following structure is returned:</p><pre><code class="makeup elixir" translate="no"><span class="p" data-group-id="3328692370-1">%{</span><span class="ss">last_30_days</span><span class="p">:</span><span class="w"> </span><span class="n">usage_cycle</span><span class="p" data-group-id="3328692370-2">(</span><span class="p" data-group-id="3328692370-2">)</span><span class="p" data-group-id="3328692370-1">}</span></code></pre><p>Given only a user as input, the usage is queried from across all the sites that the
|
||||
with the following structure is returned:</p><pre><code class="makeup elixir" translate="no"><span class="p" data-group-id="9026488826-1">%{</span><span class="w">
|
||||
</span><span class="ss">current_cycle</span><span class="p">:</span><span class="w"> </span><span class="n">usage_cycle</span><span class="p" data-group-id="9026488826-2">(</span><span class="p" data-group-id="9026488826-2">)</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">last_cycle</span><span class="p">:</span><span class="w"> </span><span class="n">usage_cycle</span><span class="p" data-group-id="9026488826-3">(</span><span class="p" data-group-id="9026488826-3">)</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">penultimate_cycle</span><span class="p">:</span><span class="w"> </span><span class="n">usage_cycle</span><span class="p" data-group-id="9026488826-4">(</span><span class="p" data-group-id="9026488826-4">)</span><span class="w">
|
||||
</span><span class="p" data-group-id="9026488826-1">}</span></code></pre><p>In all other cases of the subscription status (or a <code class="inline">free_10k</code> subscription which
|
||||
does not have a <code class="inline">last_bill_date</code> defined) - the following structure is returned:</p><pre><code class="makeup elixir" translate="no"><span class="p" data-group-id="7930224047-1">%{</span><span class="ss">last_30_days</span><span class="p">:</span><span class="w"> </span><span class="n">usage_cycle</span><span class="p" data-group-id="7930224047-2">(</span><span class="p" data-group-id="7930224047-2">)</span><span class="p" data-group-id="7930224047-1">}</span></code></pre><p>Given only a user as input, the usage is queried from across all the sites that the
|
||||
user owns. Alternatively, given an optional argument of <code class="inline">site_ids</code>, the usage from
|
||||
across all those sites is queried instead.</p>
|
||||
</section>
|
||||
|
@ -148,7 +148,7 @@ Pages
|
||||
the set of natural languages that are preferred as a response to the request.
|
||||
Language tags function are provided in <a href="https://hexdocs.pm/ex_cldr/2.37.5/Cldr.LanguageTag.html"><code class="inline">Cldr.LanguageTag</code></a>.</p><p>The format of an <code class="inline">Accept-Language</code> header is as follows in <code class="inline">ABNF</code> format:</p><pre><code class="makeup elixir" translate="no"><span class="w"> </span><span class="nc">Accept</span><span class="o">-</span><span class="nc">Language</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">"Accept-Language"</span><span class="w"> </span><span class="s">":"</span><span class="w">
|
||||
</span><span class="mi">1</span><span class="c1">#( language-range [ ";" "q" "=" qvalue ] )</span><span class="w">
|
||||
</span><span class="n">language</span><span class="o">-</span><span class="n">range</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="p" data-group-id="7263439675-1">(</span><span class="w"> </span><span class="p" data-group-id="7263439675-2">(</span><span class="w"> </span><span class="mi">1</span><span class="o">*</span><span class="mi">8</span><span class="nc">ALPHA</span><span class="w"> </span><span class="o">*</span><span class="p" data-group-id="7263439675-3">(</span><span class="w"> </span><span class="s">"-"</span><span class="w"> </span><span class="mi">1</span><span class="o">*</span><span class="mi">8</span><span class="nc">ALPHA</span><span class="w"> </span><span class="p" data-group-id="7263439675-3">)</span><span class="w"> </span><span class="p" data-group-id="7263439675-2">)</span><span class="w"> </span><span class="o">|</span><span class="w"> </span><span class="s">"*"</span><span class="w"> </span><span class="p" data-group-id="7263439675-1">)</span></code></pre><p>Each language-range MAY be given an associated quality value which represents an
|
||||
</span><span class="n">language</span><span class="o">-</span><span class="n">range</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="p" data-group-id="6581190573-1">(</span><span class="w"> </span><span class="p" data-group-id="6581190573-2">(</span><span class="w"> </span><span class="mi">1</span><span class="o">*</span><span class="mi">8</span><span class="nc">ALPHA</span><span class="w"> </span><span class="o">*</span><span class="p" data-group-id="6581190573-3">(</span><span class="w"> </span><span class="s">"-"</span><span class="w"> </span><span class="mi">1</span><span class="o">*</span><span class="mi">8</span><span class="nc">ALPHA</span><span class="w"> </span><span class="p" data-group-id="6581190573-3">)</span><span class="w"> </span><span class="p" data-group-id="6581190573-2">)</span><span class="w"> </span><span class="o">|</span><span class="w"> </span><span class="s">"*"</span><span class="w"> </span><span class="p" data-group-id="6581190573-1">)</span></code></pre><p>Each language-range MAY be given an associated quality value which represents an
|
||||
estimate of the user's preference for the languages specified by that range. The
|
||||
quality value defaults to "q=1". For example,</p><pre><code class="makeup elixir" translate="no"><span class="w"> </span><span class="nc">Accept</span><span class="o">-</span><span class="ss">Language</span><span class="p">:</span><span class="w"> </span><span class="n">da</span><span class="p">,</span><span class="w"> </span><span class="n">en</span><span class="o">-</span><span class="n">gb</span><span class="p">;</span><span class="n">q</span><span class="o">=</span><span class="mf">0.8</span><span class="p">,</span><span class="w"> </span><span class="n">en</span><span class="p">;</span><span class="n">q</span><span class="o">=</span><span class="mf">0.7</span></code></pre><p>would mean: "I prefer Danish, but will accept British English and other types of English."</p>
|
||||
</section>
|
||||
@ -261,54 +261,54 @@ a configured <a href="https://hexdocs.pm/ex_cldr/2.37.5/Cldr.html"><code class="
|
||||
</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.AcceptLanguage</span><span class="o">.</span><span class="n">best_match</span><span class="p" data-group-id="9800692871-1">(</span><span class="s">"da;q=0.1,zh-TW;q=0.3"</span><span class="p">,</span><span class="w"> </span><span class="nc">TestBackend.Cldr</span><span class="p" data-group-id="9800692871-1">)</span><span class="w">
|
||||
</span><span class="p" data-group-id="9800692871-2">{</span><span class="ss">:ok</span><span class="p">,</span><span class="w">
|
||||
</span><span class="p" data-group-id="9800692871-3">%</span><span class="nc" data-group-id="9800692871-3">Cldr.LanguageTag</span><span class="p" data-group-id="9800692871-3">{</span><span class="w">
|
||||
<pre><code class="makeup elixir" translate="no"><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr.AcceptLanguage</span><span class="o">.</span><span class="n">best_match</span><span class="p" data-group-id="2390852805-1">(</span><span class="s">"da;q=0.1,zh-TW;q=0.3"</span><span class="p">,</span><span class="w"> </span><span class="nc">TestBackend.Cldr</span><span class="p" data-group-id="2390852805-1">)</span><span class="w">
|
||||
</span><span class="p" data-group-id="2390852805-2">{</span><span class="ss">:ok</span><span class="p">,</span><span class="w">
|
||||
</span><span class="p" data-group-id="2390852805-3">%</span><span class="nc" data-group-id="2390852805-3">Cldr.LanguageTag</span><span class="p" data-group-id="2390852805-3">{</span><span class="w">
|
||||
</span><span class="ss">backend</span><span class="p">:</span><span class="w"> </span><span class="nc">TestBackend.Cldr</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">canonical_locale_name</span><span class="p">:</span><span class="w"> </span><span class="s">"zh-TW"</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">cldr_locale_name</span><span class="p">:</span><span class="w"> </span><span class="ss">:"zh-Hant"</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">language_subtags</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="9800692871-4">[</span><span class="p" data-group-id="9800692871-4">]</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">extensions</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="9800692871-5">%{</span><span class="p" data-group-id="9800692871-5">}</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">language_subtags</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="2390852805-4">[</span><span class="p" data-group-id="2390852805-4">]</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">extensions</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="2390852805-5">%{</span><span class="p" data-group-id="2390852805-5">}</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">gettext_locale_name</span><span class="p">:</span><span class="w"> </span><span class="no">nil</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">language</span><span class="p">:</span><span class="w"> </span><span class="s">"zh"</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">locale</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="9800692871-6">%{</span><span class="p" data-group-id="9800692871-6">}</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">private_use</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="9800692871-7">[</span><span class="p" data-group-id="9800692871-7">]</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">locale</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="2390852805-6">%{</span><span class="p" data-group-id="2390852805-6">}</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">private_use</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="2390852805-7">[</span><span class="p" data-group-id="2390852805-7">]</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">rbnf_locale_name</span><span class="p">:</span><span class="w"> </span><span class="ss">:"zh-Hant"</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">requested_locale_name</span><span class="p">:</span><span class="w"> </span><span class="s">"zh-TW"</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">script</span><span class="p">:</span><span class="w"> </span><span class="ss">:Hant</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">territory</span><span class="p">:</span><span class="w"> </span><span class="ss">:TW</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">transform</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="9800692871-8">%{</span><span class="p" data-group-id="9800692871-8">}</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">language_variants</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="9800692871-9">[</span><span class="p" data-group-id="9800692871-9">]</span><span class="w">
|
||||
</span><span class="p" data-group-id="9800692871-3">}</span><span class="p" data-group-id="9800692871-2">}</span><span class="w">
|
||||
</span><span class="ss">transform</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="2390852805-8">%{</span><span class="p" data-group-id="2390852805-8">}</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">language_variants</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="2390852805-9">[</span><span class="p" data-group-id="2390852805-9">]</span><span class="w">
|
||||
</span><span class="p" data-group-id="2390852805-3">}</span><span class="p" data-group-id="2390852805-2">}</span><span class="w">
|
||||
|
||||
</span><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr.AcceptLanguage</span><span class="o">.</span><span class="n">best_match</span><span class="p" data-group-id="9800692871-10">(</span><span class="s">"da;q=0.1,zh-TW;q=0.3"</span><span class="p">,</span><span class="w"> </span><span class="nc">TestBackend.Cldr</span><span class="p" data-group-id="9800692871-10">)</span><span class="w">
|
||||
</span><span class="p" data-group-id="9800692871-11">{</span><span class="ss">:ok</span><span class="p">,</span><span class="w">
|
||||
</span><span class="p" data-group-id="9800692871-12">%</span><span class="nc" data-group-id="9800692871-12">Cldr.LanguageTag</span><span class="p" data-group-id="9800692871-12">{</span><span class="w">
|
||||
</span><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr.AcceptLanguage</span><span class="o">.</span><span class="n">best_match</span><span class="p" data-group-id="2390852805-10">(</span><span class="s">"da;q=0.1,zh-TW;q=0.3"</span><span class="p">,</span><span class="w"> </span><span class="nc">TestBackend.Cldr</span><span class="p" data-group-id="2390852805-10">)</span><span class="w">
|
||||
</span><span class="p" data-group-id="2390852805-11">{</span><span class="ss">:ok</span><span class="p">,</span><span class="w">
|
||||
</span><span class="p" data-group-id="2390852805-12">%</span><span class="nc" data-group-id="2390852805-12">Cldr.LanguageTag</span><span class="p" data-group-id="2390852805-12">{</span><span class="w">
|
||||
</span><span class="ss">backend</span><span class="p">:</span><span class="w"> </span><span class="nc">TestBackend.Cldr</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">canonical_locale_name</span><span class="p">:</span><span class="w"> </span><span class="s">"zh-TW"</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">cldr_locale_name</span><span class="p">:</span><span class="w"> </span><span class="ss">:"zh-Hant"</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">language_subtags</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="9800692871-13">[</span><span class="p" data-group-id="9800692871-13">]</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">extensions</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="9800692871-14">%{</span><span class="p" data-group-id="9800692871-14">}</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">language_subtags</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="2390852805-13">[</span><span class="p" data-group-id="2390852805-13">]</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">extensions</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="2390852805-14">%{</span><span class="p" data-group-id="2390852805-14">}</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">gettext_locale_name</span><span class="p">:</span><span class="w"> </span><span class="no">nil</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">language</span><span class="p">:</span><span class="w"> </span><span class="s">"zh"</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">locale</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="9800692871-15">%{</span><span class="p" data-group-id="9800692871-15">}</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">private_use</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="9800692871-16">[</span><span class="p" data-group-id="9800692871-16">]</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">locale</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="2390852805-15">%{</span><span class="p" data-group-id="2390852805-15">}</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">private_use</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="2390852805-16">[</span><span class="p" data-group-id="2390852805-16">]</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">rbnf_locale_name</span><span class="p">:</span><span class="w"> </span><span class="ss">:"zh-Hant"</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">requested_locale_name</span><span class="p">:</span><span class="w"> </span><span class="s">"zh-TW"</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">script</span><span class="p">:</span><span class="w"> </span><span class="ss">:Hant</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">territory</span><span class="p">:</span><span class="w"> </span><span class="ss">:TW</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">transform</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="9800692871-17">%{</span><span class="p" data-group-id="9800692871-17">}</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">language_variants</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="9800692871-18">[</span><span class="p" data-group-id="9800692871-18">]</span><span class="w">
|
||||
</span><span class="p" data-group-id="9800692871-12">}</span><span class="p" data-group-id="9800692871-11">}</span><span class="w">
|
||||
</span><span class="ss">transform</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="2390852805-17">%{</span><span class="p" data-group-id="2390852805-17">}</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">language_variants</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="2390852805-18">[</span><span class="p" data-group-id="2390852805-18">]</span><span class="w">
|
||||
</span><span class="p" data-group-id="2390852805-12">}</span><span class="p" data-group-id="2390852805-11">}</span><span class="w">
|
||||
|
||||
</span><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr.AcceptLanguage</span><span class="o">.</span><span class="n">best_match</span><span class="p" data-group-id="9800692871-19">(</span><span class="s">"xx,yy;q=0.3"</span><span class="p" data-group-id="9800692871-19">)</span><span class="w">
|
||||
</span><span class="p" data-group-id="9800692871-20">{</span><span class="ss">:error</span><span class="p">,</span><span class="w">
|
||||
</span><span class="p" data-group-id="9800692871-21">{</span><span class="nc">Cldr.NoMatchingLocale</span><span class="p">,</span><span class="w">
|
||||
</span><span class="s">"No configured locale could be matched to </span><span class="se">\"</span><span class="s">xx,yy;q=0.3</span><span class="se">\"</span><span class="s">"</span><span class="p" data-group-id="9800692871-21">}</span><span class="p" data-group-id="9800692871-20">}</span><span class="w">
|
||||
</span><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr.AcceptLanguage</span><span class="o">.</span><span class="n">best_match</span><span class="p" data-group-id="2390852805-19">(</span><span class="s">"xx,yy;q=0.3"</span><span class="p" data-group-id="2390852805-19">)</span><span class="w">
|
||||
</span><span class="p" data-group-id="2390852805-20">{</span><span class="ss">:error</span><span class="p">,</span><span class="w">
|
||||
</span><span class="p" data-group-id="2390852805-21">{</span><span class="nc">Cldr.NoMatchingLocale</span><span class="p">,</span><span class="w">
|
||||
</span><span class="s">"No configured locale could be matched to </span><span class="se">\"</span><span class="s">xx,yy;q=0.3</span><span class="se">\"</span><span class="s">"</span><span class="p" data-group-id="2390852805-21">}</span><span class="p" data-group-id="2390852805-20">}</span><span class="w">
|
||||
|
||||
</span><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr.AcceptLanguage</span><span class="o">.</span><span class="n">best_match</span><span class="p" data-group-id="9800692871-22">(</span><span class="s">"invalid_tag"</span><span class="p" data-group-id="9800692871-22">)</span><span class="w">
|
||||
</span><span class="p" data-group-id="9800692871-23">{</span><span class="ss">:error</span><span class="p">,</span><span class="w"> </span><span class="p" data-group-id="9800692871-24">{</span><span class="nc">Cldr.LanguageTag.ParseError</span><span class="p">,</span><span class="w">
|
||||
</span><span class="s">"Expected a BCP47 language tag. Could not parse the remaining </span><span class="se">\"</span><span class="s">g</span><span class="se">\"</span><span class="s"> starting at position 11"</span><span class="p" data-group-id="9800692871-24">}</span><span class="p" data-group-id="9800692871-23">}</span></code></pre>
|
||||
</span><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr.AcceptLanguage</span><span class="o">.</span><span class="n">best_match</span><span class="p" data-group-id="2390852805-22">(</span><span class="s">"invalid_tag"</span><span class="p" data-group-id="2390852805-22">)</span><span class="w">
|
||||
</span><span class="p" data-group-id="2390852805-23">{</span><span class="ss">:error</span><span class="p">,</span><span class="w"> </span><span class="p" data-group-id="2390852805-24">{</span><span class="nc">Cldr.LanguageTag.ParseError</span><span class="p">,</span><span class="w">
|
||||
</span><span class="s">"Expected a BCP47 language tag. Could not parse the remaining </span><span class="se">\"</span><span class="s">g</span><span class="se">\"</span><span class="s"> starting at position 11"</span><span class="p" data-group-id="2390852805-24">}</span><span class="p" data-group-id="2390852805-23">}</span></code></pre>
|
||||
</section>
|
||||
</section>
|
||||
<section class="detail" id="parse/1">
|
||||
@ -369,95 +369,95 @@ wuth an error tuple for each invalid tag added at the end of the list.</p><h2 id
|
||||
</a>
|
||||
<span class="text">Example</span>
|
||||
</h2>
|
||||
<pre><code class="makeup elixir" translate="no"><span class="gp unselectable">iex> </span><span class="nc">Cldr.AcceptLanguage</span><span class="o">.</span><span class="n">parse</span><span class="p" data-group-id="7204189767-1">(</span><span class="s">"da,zh-TW;q=0.3"</span><span class="p">,</span><span class="w"> </span><span class="nc">TestBackend.Cldr</span><span class="p" data-group-id="7204189767-1">)</span><span class="w">
|
||||
</span><span class="p" data-group-id="7204189767-2">{</span><span class="ss">:ok</span><span class="p">,</span><span class="w">
|
||||
</span><span class="p" data-group-id="7204189767-3">[</span><span class="w">
|
||||
</span><span class="p" data-group-id="7204189767-4">{</span><span class="mf">1.0</span><span class="p">,</span><span class="w">
|
||||
</span><span class="p" data-group-id="7204189767-5">%</span><span class="nc" data-group-id="7204189767-5">Cldr.LanguageTag</span><span class="p" data-group-id="7204189767-5">{</span><span class="w">
|
||||
<pre><code class="makeup elixir" translate="no"><span class="gp unselectable">iex> </span><span class="nc">Cldr.AcceptLanguage</span><span class="o">.</span><span class="n">parse</span><span class="p" data-group-id="1048082895-1">(</span><span class="s">"da,zh-TW;q=0.3"</span><span class="p">,</span><span class="w"> </span><span class="nc">TestBackend.Cldr</span><span class="p" data-group-id="1048082895-1">)</span><span class="w">
|
||||
</span><span class="p" data-group-id="1048082895-2">{</span><span class="ss">:ok</span><span class="p">,</span><span class="w">
|
||||
</span><span class="p" data-group-id="1048082895-3">[</span><span class="w">
|
||||
</span><span class="p" data-group-id="1048082895-4">{</span><span class="mf">1.0</span><span class="p">,</span><span class="w">
|
||||
</span><span class="p" data-group-id="1048082895-5">%</span><span class="nc" data-group-id="1048082895-5">Cldr.LanguageTag</span><span class="p" data-group-id="1048082895-5">{</span><span class="w">
|
||||
</span><span class="ss">backend</span><span class="p">:</span><span class="w"> </span><span class="nc">TestBackend.Cldr</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">canonical_locale_name</span><span class="p">:</span><span class="w"> </span><span class="s">"da"</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">cldr_locale_name</span><span class="p">:</span><span class="w"> </span><span class="ss">:da</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">language_subtags</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="7204189767-6">[</span><span class="p" data-group-id="7204189767-6">]</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">extensions</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="7204189767-7">%{</span><span class="p" data-group-id="7204189767-7">}</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">language_subtags</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="1048082895-6">[</span><span class="p" data-group-id="1048082895-6">]</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">extensions</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="1048082895-7">%{</span><span class="p" data-group-id="1048082895-7">}</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">gettext_locale_name</span><span class="p">:</span><span class="w"> </span><span class="no">nil</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">language</span><span class="p">:</span><span class="w"> </span><span class="s">"da"</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">locale</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="7204189767-8">%{</span><span class="p" data-group-id="7204189767-8">}</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">private_use</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="7204189767-9">[</span><span class="p" data-group-id="7204189767-9">]</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">locale</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="1048082895-8">%{</span><span class="p" data-group-id="1048082895-8">}</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">private_use</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="1048082895-9">[</span><span class="p" data-group-id="1048082895-9">]</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">rbnf_locale_name</span><span class="p">:</span><span class="w"> </span><span class="ss">:da</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">requested_locale_name</span><span class="p">:</span><span class="w"> </span><span class="s">"da"</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">script</span><span class="p">:</span><span class="w"> </span><span class="ss">:Latn</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">territory</span><span class="p">:</span><span class="w"> </span><span class="ss">:DK</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">transform</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="7204189767-10">%{</span><span class="p" data-group-id="7204189767-10">}</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">language_variants</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="7204189767-11">[</span><span class="p" data-group-id="7204189767-11">]</span><span class="w">
|
||||
</span><span class="p" data-group-id="7204189767-5">}</span><span class="p" data-group-id="7204189767-4">}</span><span class="p">,</span><span class="w">
|
||||
</span><span class="p" data-group-id="7204189767-12">{</span><span class="mf">0.3</span><span class="p">,</span><span class="w">
|
||||
</span><span class="p" data-group-id="7204189767-13">%</span><span class="nc" data-group-id="7204189767-13">Cldr.LanguageTag</span><span class="p" data-group-id="7204189767-13">{</span><span class="w">
|
||||
</span><span class="ss">transform</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="1048082895-10">%{</span><span class="p" data-group-id="1048082895-10">}</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">language_variants</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="1048082895-11">[</span><span class="p" data-group-id="1048082895-11">]</span><span class="w">
|
||||
</span><span class="p" data-group-id="1048082895-5">}</span><span class="p" data-group-id="1048082895-4">}</span><span class="p">,</span><span class="w">
|
||||
</span><span class="p" data-group-id="1048082895-12">{</span><span class="mf">0.3</span><span class="p">,</span><span class="w">
|
||||
</span><span class="p" data-group-id="1048082895-13">%</span><span class="nc" data-group-id="1048082895-13">Cldr.LanguageTag</span><span class="p" data-group-id="1048082895-13">{</span><span class="w">
|
||||
</span><span class="ss">backend</span><span class="p">:</span><span class="w"> </span><span class="nc">TestBackend.Cldr</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">canonical_locale_name</span><span class="p">:</span><span class="w"> </span><span class="s">"zh-TW"</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">cldr_locale_name</span><span class="p">:</span><span class="w"> </span><span class="ss">:"zh-Hant"</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">language_subtags</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="7204189767-14">[</span><span class="p" data-group-id="7204189767-14">]</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">extensions</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="7204189767-15">%{</span><span class="p" data-group-id="7204189767-15">}</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">language_subtags</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="1048082895-14">[</span><span class="p" data-group-id="1048082895-14">]</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">extensions</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="1048082895-15">%{</span><span class="p" data-group-id="1048082895-15">}</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">gettext_locale_name</span><span class="p">:</span><span class="w"> </span><span class="no">nil</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">language</span><span class="p">:</span><span class="w"> </span><span class="s">"zh"</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">locale</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="7204189767-16">%{</span><span class="p" data-group-id="7204189767-16">}</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">private_use</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="7204189767-17">[</span><span class="p" data-group-id="7204189767-17">]</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">locale</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="1048082895-16">%{</span><span class="p" data-group-id="1048082895-16">}</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">private_use</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="1048082895-17">[</span><span class="p" data-group-id="1048082895-17">]</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">rbnf_locale_name</span><span class="p">:</span><span class="w"> </span><span class="ss">:"zh-Hant"</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">requested_locale_name</span><span class="p">:</span><span class="w"> </span><span class="s">"zh-TW"</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">script</span><span class="p">:</span><span class="w"> </span><span class="ss">:Hant</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">territory</span><span class="p">:</span><span class="w"> </span><span class="ss">:TW</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">transform</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="7204189767-18">%{</span><span class="p" data-group-id="7204189767-18">}</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">language_variants</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="7204189767-19">[</span><span class="p" data-group-id="7204189767-19">]</span><span class="w">
|
||||
</span><span class="p" data-group-id="7204189767-13">}</span><span class="p" data-group-id="7204189767-12">}</span><span class="w">
|
||||
</span><span class="p" data-group-id="7204189767-3">]</span><span class="p" data-group-id="7204189767-2">}</span><span class="w">
|
||||
</span><span class="ss">transform</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="1048082895-18">%{</span><span class="p" data-group-id="1048082895-18">}</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">language_variants</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="1048082895-19">[</span><span class="p" data-group-id="1048082895-19">]</span><span class="w">
|
||||
</span><span class="p" data-group-id="1048082895-13">}</span><span class="p" data-group-id="1048082895-12">}</span><span class="w">
|
||||
</span><span class="p" data-group-id="1048082895-3">]</span><span class="p" data-group-id="1048082895-2">}</span><span class="w">
|
||||
|
||||
</span><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr.AcceptLanguage</span><span class="o">.</span><span class="n">parse</span><span class="p" data-group-id="7204189767-20">(</span><span class="s">"invalid_tag"</span><span class="p" data-group-id="7204189767-20">)</span><span class="w">
|
||||
</span><span class="p" data-group-id="7204189767-21">{</span><span class="ss">:error</span><span class="p">,</span><span class="w">
|
||||
</span><span class="p" data-group-id="7204189767-22">{</span><span class="nc">Cldr.LanguageTag.ParseError</span><span class="p">,</span><span class="w">
|
||||
</span><span class="s">"Expected a BCP47 language tag. Could not parse the remaining </span><span class="se">\"</span><span class="s">g</span><span class="se">\"</span><span class="s"> starting at position 11"</span><span class="p" data-group-id="7204189767-22">}</span><span class="p" data-group-id="7204189767-21">}</span><span class="w">
|
||||
</span><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr.AcceptLanguage</span><span class="o">.</span><span class="n">parse</span><span class="p" data-group-id="1048082895-20">(</span><span class="s">"invalid_tag"</span><span class="p" data-group-id="1048082895-20">)</span><span class="w">
|
||||
</span><span class="p" data-group-id="1048082895-21">{</span><span class="ss">:error</span><span class="p">,</span><span class="w">
|
||||
</span><span class="p" data-group-id="1048082895-22">{</span><span class="nc">Cldr.LanguageTag.ParseError</span><span class="p">,</span><span class="w">
|
||||
</span><span class="s">"Expected a BCP47 language tag. Could not parse the remaining </span><span class="se">\"</span><span class="s">g</span><span class="se">\"</span><span class="s"> starting at position 11"</span><span class="p" data-group-id="1048082895-22">}</span><span class="p" data-group-id="1048082895-21">}</span><span class="w">
|
||||
|
||||
</span><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr.AcceptLanguage</span><span class="o">.</span><span class="n">parse</span><span class="p" data-group-id="7204189767-23">(</span><span class="s">"da,zh-TW;q=0.3,invalid_tag"</span><span class="p" data-group-id="7204189767-23">)</span><span class="w">
|
||||
</span><span class="p" data-group-id="7204189767-24">{</span><span class="ss">:ok</span><span class="p">,</span><span class="w">
|
||||
</span><span class="p" data-group-id="7204189767-25">[</span><span class="w">
|
||||
</span><span class="p" data-group-id="7204189767-26">{</span><span class="mf">1.0</span><span class="p">,</span><span class="w">
|
||||
</span><span class="p" data-group-id="7204189767-27">%</span><span class="nc" data-group-id="7204189767-27">Cldr.LanguageTag</span><span class="p" data-group-id="7204189767-27">{</span><span class="w">
|
||||
</span><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr.AcceptLanguage</span><span class="o">.</span><span class="n">parse</span><span class="p" data-group-id="1048082895-23">(</span><span class="s">"da,zh-TW;q=0.3,invalid_tag"</span><span class="p" data-group-id="1048082895-23">)</span><span class="w">
|
||||
</span><span class="p" data-group-id="1048082895-24">{</span><span class="ss">:ok</span><span class="p">,</span><span class="w">
|
||||
</span><span class="p" data-group-id="1048082895-25">[</span><span class="w">
|
||||
</span><span class="p" data-group-id="1048082895-26">{</span><span class="mf">1.0</span><span class="p">,</span><span class="w">
|
||||
</span><span class="p" data-group-id="1048082895-27">%</span><span class="nc" data-group-id="1048082895-27">Cldr.LanguageTag</span><span class="p" data-group-id="1048082895-27">{</span><span class="w">
|
||||
</span><span class="ss">backend</span><span class="p">:</span><span class="w"> </span><span class="nc">TestBackend.Cldr</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">canonical_locale_name</span><span class="p">:</span><span class="w"> </span><span class="s">"da"</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">cldr_locale_name</span><span class="p">:</span><span class="w"> </span><span class="ss">:da</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">language_subtags</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="7204189767-28">[</span><span class="p" data-group-id="7204189767-28">]</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">extensions</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="7204189767-29">%{</span><span class="p" data-group-id="7204189767-29">}</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">language_subtags</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="1048082895-28">[</span><span class="p" data-group-id="1048082895-28">]</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">extensions</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="1048082895-29">%{</span><span class="p" data-group-id="1048082895-29">}</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">gettext_locale_name</span><span class="p">:</span><span class="w"> </span><span class="no">nil</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">language</span><span class="p">:</span><span class="w"> </span><span class="s">"da"</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">locale</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="7204189767-30">%{</span><span class="p" data-group-id="7204189767-30">}</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">private_use</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="7204189767-31">[</span><span class="p" data-group-id="7204189767-31">]</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">locale</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="1048082895-30">%{</span><span class="p" data-group-id="1048082895-30">}</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">private_use</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="1048082895-31">[</span><span class="p" data-group-id="1048082895-31">]</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">rbnf_locale_name</span><span class="p">:</span><span class="w"> </span><span class="ss">:da</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">requested_locale_name</span><span class="p">:</span><span class="w"> </span><span class="s">"da"</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">script</span><span class="p">:</span><span class="w"> </span><span class="ss">:Latn</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">territory</span><span class="p">:</span><span class="w"> </span><span class="ss">:DK</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">transform</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="7204189767-32">%{</span><span class="p" data-group-id="7204189767-32">}</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">language_variants</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="7204189767-33">[</span><span class="p" data-group-id="7204189767-33">]</span><span class="w">
|
||||
</span><span class="p" data-group-id="7204189767-27">}</span><span class="p" data-group-id="7204189767-26">}</span><span class="p">,</span><span class="w">
|
||||
</span><span class="p" data-group-id="7204189767-34">{</span><span class="mf">0.3</span><span class="p">,</span><span class="w">
|
||||
</span><span class="p" data-group-id="7204189767-35">%</span><span class="nc" data-group-id="7204189767-35">Cldr.LanguageTag</span><span class="p" data-group-id="7204189767-35">{</span><span class="w">
|
||||
</span><span class="ss">transform</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="1048082895-32">%{</span><span class="p" data-group-id="1048082895-32">}</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">language_variants</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="1048082895-33">[</span><span class="p" data-group-id="1048082895-33">]</span><span class="w">
|
||||
</span><span class="p" data-group-id="1048082895-27">}</span><span class="p" data-group-id="1048082895-26">}</span><span class="p">,</span><span class="w">
|
||||
</span><span class="p" data-group-id="1048082895-34">{</span><span class="mf">0.3</span><span class="p">,</span><span class="w">
|
||||
</span><span class="p" data-group-id="1048082895-35">%</span><span class="nc" data-group-id="1048082895-35">Cldr.LanguageTag</span><span class="p" data-group-id="1048082895-35">{</span><span class="w">
|
||||
</span><span class="ss">backend</span><span class="p">:</span><span class="w"> </span><span class="nc">TestBackend.Cldr</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">canonical_locale_name</span><span class="p">:</span><span class="w"> </span><span class="s">"zh-TW"</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">cldr_locale_name</span><span class="p">:</span><span class="w"> </span><span class="ss">:"zh-Hant"</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">language_subtags</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="7204189767-36">[</span><span class="p" data-group-id="7204189767-36">]</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">extensions</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="7204189767-37">%{</span><span class="p" data-group-id="7204189767-37">}</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">language_subtags</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="1048082895-36">[</span><span class="p" data-group-id="1048082895-36">]</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">extensions</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="1048082895-37">%{</span><span class="p" data-group-id="1048082895-37">}</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">gettext_locale_name</span><span class="p">:</span><span class="w"> </span><span class="no">nil</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">language</span><span class="p">:</span><span class="w"> </span><span class="s">"zh"</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">locale</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="7204189767-38">%{</span><span class="p" data-group-id="7204189767-38">}</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">private_use</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="7204189767-39">[</span><span class="p" data-group-id="7204189767-39">]</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">locale</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="1048082895-38">%{</span><span class="p" data-group-id="1048082895-38">}</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">private_use</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="1048082895-39">[</span><span class="p" data-group-id="1048082895-39">]</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">rbnf_locale_name</span><span class="p">:</span><span class="w"> </span><span class="ss">:"zh-Hant"</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">requested_locale_name</span><span class="p">:</span><span class="w"> </span><span class="s">"zh-TW"</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">script</span><span class="p">:</span><span class="w"> </span><span class="ss">:Hant</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">territory</span><span class="p">:</span><span class="w"> </span><span class="ss">:TW</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">transform</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="7204189767-40">%{</span><span class="p" data-group-id="7204189767-40">}</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">language_variants</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="7204189767-41">[</span><span class="p" data-group-id="7204189767-41">]</span><span class="w">
|
||||
</span><span class="p" data-group-id="7204189767-35">}</span><span class="p" data-group-id="7204189767-34">}</span><span class="p">,</span><span class="w">
|
||||
</span><span class="p" data-group-id="7204189767-42">{</span><span class="ss">:error</span><span class="p">,</span><span class="w">
|
||||
</span><span class="p" data-group-id="7204189767-43">{</span><span class="nc">Cldr.LanguageTag.ParseError</span><span class="p">,</span><span class="w">
|
||||
</span><span class="s">"Expected a BCP47 language tag. Could not parse the remaining </span><span class="se">\"</span><span class="s">g</span><span class="se">\"</span><span class="s"> starting at position 11"</span><span class="p" data-group-id="7204189767-43">}</span><span class="p" data-group-id="7204189767-42">}</span><span class="w">
|
||||
</span><span class="p" data-group-id="7204189767-25">]</span><span class="p" data-group-id="7204189767-24">}</span></code></pre>
|
||||
</span><span class="ss">transform</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="1048082895-40">%{</span><span class="p" data-group-id="1048082895-40">}</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">language_variants</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="1048082895-41">[</span><span class="p" data-group-id="1048082895-41">]</span><span class="w">
|
||||
</span><span class="p" data-group-id="1048082895-35">}</span><span class="p" data-group-id="1048082895-34">}</span><span class="p">,</span><span class="w">
|
||||
</span><span class="p" data-group-id="1048082895-42">{</span><span class="ss">:error</span><span class="p">,</span><span class="w">
|
||||
</span><span class="p" data-group-id="1048082895-43">{</span><span class="nc">Cldr.LanguageTag.ParseError</span><span class="p">,</span><span class="w">
|
||||
</span><span class="s">"Expected a BCP47 language tag. Could not parse the remaining </span><span class="se">\"</span><span class="s">g</span><span class="se">\"</span><span class="s"> starting at position 11"</span><span class="p" data-group-id="1048082895-43">}</span><span class="p" data-group-id="1048082895-42">}</span><span class="w">
|
||||
</span><span class="p" data-group-id="1048082895-25">]</span><span class="p" data-group-id="1048082895-24">}</span></code></pre>
|
||||
</section>
|
||||
</section>
|
||||
<section class="detail" id="parse!/1">
|
||||
@ -502,92 +502,92 @@ wuth an error tuple for each invalid tag added at the end of the list.</p><h2 id
|
||||
</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.AcceptLanguage</span><span class="o">.</span><span class="n">parse!</span><span class="p" data-group-id="4322719398-1">(</span><span class="s">"da,zh-TW;q=0.3"</span><span class="p" data-group-id="4322719398-1">)</span><span class="w">
|
||||
</span><span class="p" data-group-id="4322719398-2">[</span><span class="w">
|
||||
</span><span class="p" data-group-id="4322719398-3">{</span><span class="mf">1.0</span><span class="p">,</span><span class="w">
|
||||
</span><span class="p" data-group-id="4322719398-4">%</span><span class="nc" data-group-id="4322719398-4">Cldr.LanguageTag</span><span class="p" data-group-id="4322719398-4">{</span><span class="w">
|
||||
<pre><code class="makeup elixir" translate="no"><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr.AcceptLanguage</span><span class="o">.</span><span class="n">parse!</span><span class="p" data-group-id="0014137621-1">(</span><span class="s">"da,zh-TW;q=0.3"</span><span class="p" data-group-id="0014137621-1">)</span><span class="w">
|
||||
</span><span class="p" data-group-id="0014137621-2">[</span><span class="w">
|
||||
</span><span class="p" data-group-id="0014137621-3">{</span><span class="mf">1.0</span><span class="p">,</span><span class="w">
|
||||
</span><span class="p" data-group-id="0014137621-4">%</span><span class="nc" data-group-id="0014137621-4">Cldr.LanguageTag</span><span class="p" data-group-id="0014137621-4">{</span><span class="w">
|
||||
</span><span class="ss">backend</span><span class="p">:</span><span class="w"> </span><span class="nc">TestBackend.Cldr</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">canonical_locale_name</span><span class="p">:</span><span class="w"> </span><span class="s">"da"</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">cldr_locale_name</span><span class="p">:</span><span class="w"> </span><span class="ss">:da</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">language_subtags</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="4322719398-5">[</span><span class="p" data-group-id="4322719398-5">]</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">extensions</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="4322719398-6">%{</span><span class="p" data-group-id="4322719398-6">}</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">language_subtags</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="0014137621-5">[</span><span class="p" data-group-id="0014137621-5">]</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">extensions</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="0014137621-6">%{</span><span class="p" data-group-id="0014137621-6">}</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">gettext_locale_name</span><span class="p">:</span><span class="w"> </span><span class="no">nil</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">language</span><span class="p">:</span><span class="w"> </span><span class="s">"da"</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">locale</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="4322719398-7">%{</span><span class="p" data-group-id="4322719398-7">}</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">private_use</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="4322719398-8">[</span><span class="p" data-group-id="4322719398-8">]</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">locale</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="0014137621-7">%{</span><span class="p" data-group-id="0014137621-7">}</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">private_use</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="0014137621-8">[</span><span class="p" data-group-id="0014137621-8">]</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">rbnf_locale_name</span><span class="p">:</span><span class="w"> </span><span class="ss">:da</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">requested_locale_name</span><span class="p">:</span><span class="w"> </span><span class="s">"da"</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">script</span><span class="p">:</span><span class="w"> </span><span class="ss">:Latn</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">territory</span><span class="p">:</span><span class="w"> </span><span class="ss">:DK</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">transform</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="4322719398-9">%{</span><span class="p" data-group-id="4322719398-9">}</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">language_variants</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="4322719398-10">[</span><span class="p" data-group-id="4322719398-10">]</span><span class="w">
|
||||
</span><span class="p" data-group-id="4322719398-4">}</span><span class="p" data-group-id="4322719398-3">}</span><span class="p">,</span><span class="w">
|
||||
</span><span class="p" data-group-id="4322719398-11">{</span><span class="mf">0.3</span><span class="p">,</span><span class="w">
|
||||
</span><span class="p" data-group-id="4322719398-12">%</span><span class="nc" data-group-id="4322719398-12">Cldr.LanguageTag</span><span class="p" data-group-id="4322719398-12">{</span><span class="w">
|
||||
</span><span class="ss">transform</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="0014137621-9">%{</span><span class="p" data-group-id="0014137621-9">}</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">language_variants</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="0014137621-10">[</span><span class="p" data-group-id="0014137621-10">]</span><span class="w">
|
||||
</span><span class="p" data-group-id="0014137621-4">}</span><span class="p" data-group-id="0014137621-3">}</span><span class="p">,</span><span class="w">
|
||||
</span><span class="p" data-group-id="0014137621-11">{</span><span class="mf">0.3</span><span class="p">,</span><span class="w">
|
||||
</span><span class="p" data-group-id="0014137621-12">%</span><span class="nc" data-group-id="0014137621-12">Cldr.LanguageTag</span><span class="p" data-group-id="0014137621-12">{</span><span class="w">
|
||||
</span><span class="ss">backend</span><span class="p">:</span><span class="w"> </span><span class="nc">TestBackend.Cldr</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">canonical_locale_name</span><span class="p">:</span><span class="w"> </span><span class="s">"zh-TW"</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">cldr_locale_name</span><span class="p">:</span><span class="w"> </span><span class="ss">:"zh-Hant"</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">language_subtags</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="4322719398-13">[</span><span class="p" data-group-id="4322719398-13">]</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">extensions</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="4322719398-14">%{</span><span class="p" data-group-id="4322719398-14">}</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">language_subtags</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="0014137621-13">[</span><span class="p" data-group-id="0014137621-13">]</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">extensions</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="0014137621-14">%{</span><span class="p" data-group-id="0014137621-14">}</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">gettext_locale_name</span><span class="p">:</span><span class="w"> </span><span class="no">nil</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">language</span><span class="p">:</span><span class="w"> </span><span class="s">"zh"</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">locale</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="4322719398-15">%{</span><span class="p" data-group-id="4322719398-15">}</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">private_use</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="4322719398-16">[</span><span class="p" data-group-id="4322719398-16">]</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">locale</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="0014137621-15">%{</span><span class="p" data-group-id="0014137621-15">}</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">private_use</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="0014137621-16">[</span><span class="p" data-group-id="0014137621-16">]</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">rbnf_locale_name</span><span class="p">:</span><span class="w"> </span><span class="ss">:"zh-Hant"</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">requested_locale_name</span><span class="p">:</span><span class="w"> </span><span class="s">"zh-TW"</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">script</span><span class="p">:</span><span class="w"> </span><span class="ss">:Hant</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">territory</span><span class="p">:</span><span class="w"> </span><span class="ss">:TW</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">transform</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="4322719398-17">%{</span><span class="p" data-group-id="4322719398-17">}</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">language_variants</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="4322719398-18">[</span><span class="p" data-group-id="4322719398-18">]</span><span class="w">
|
||||
</span><span class="p" data-group-id="4322719398-12">}</span><span class="p" data-group-id="4322719398-11">}</span><span class="w">
|
||||
</span><span class="p" data-group-id="4322719398-2">]</span><span class="w">
|
||||
</span><span class="ss">transform</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="0014137621-17">%{</span><span class="p" data-group-id="0014137621-17">}</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">language_variants</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="0014137621-18">[</span><span class="p" data-group-id="0014137621-18">]</span><span class="w">
|
||||
</span><span class="p" data-group-id="0014137621-12">}</span><span class="p" data-group-id="0014137621-11">}</span><span class="w">
|
||||
</span><span class="p" data-group-id="0014137621-2">]</span><span class="w">
|
||||
|
||||
</span><span class="nc">Plausible.Cldr.AcceptLanguage</span><span class="o">.</span><span class="n">parse!</span><span class="w"> </span><span class="s">"invalid_tag"</span><span class="w">
|
||||
</span><span class="gt">** (Cldr.AcceptLanguageError) "Expected a BCP47 language tag. Could not parse the remaining "g" starting at position 11
|
||||
(ex_cldr) lib/cldr/accept_language.ex:304: Cldr.AcceptLanguage.parse!/1</span><span class="w">
|
||||
|
||||
</span><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr.AcceptLanguage</span><span class="o">.</span><span class="n">parse!</span><span class="p" data-group-id="4322719398-19">(</span><span class="s">"da,zh-TW;q=0.3,invalid_tag"</span><span class="p" data-group-id="4322719398-19">)</span><span class="w">
|
||||
</span><span class="p" data-group-id="4322719398-20">[</span><span class="w">
|
||||
</span><span class="p" data-group-id="4322719398-21">{</span><span class="mf">1.0</span><span class="p">,</span><span class="w">
|
||||
</span><span class="p" data-group-id="4322719398-22">%</span><span class="nc" data-group-id="4322719398-22">Cldr.LanguageTag</span><span class="p" data-group-id="4322719398-22">{</span><span class="w">
|
||||
</span><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr.AcceptLanguage</span><span class="o">.</span><span class="n">parse!</span><span class="p" data-group-id="0014137621-19">(</span><span class="s">"da,zh-TW;q=0.3,invalid_tag"</span><span class="p" data-group-id="0014137621-19">)</span><span class="w">
|
||||
</span><span class="p" data-group-id="0014137621-20">[</span><span class="w">
|
||||
</span><span class="p" data-group-id="0014137621-21">{</span><span class="mf">1.0</span><span class="p">,</span><span class="w">
|
||||
</span><span class="p" data-group-id="0014137621-22">%</span><span class="nc" data-group-id="0014137621-22">Cldr.LanguageTag</span><span class="p" data-group-id="0014137621-22">{</span><span class="w">
|
||||
</span><span class="ss">backend</span><span class="p">:</span><span class="w"> </span><span class="nc">TestBackend.Cldr</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">canonical_locale_name</span><span class="p">:</span><span class="w"> </span><span class="s">"da"</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">cldr_locale_name</span><span class="p">:</span><span class="w"> </span><span class="ss">:da</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">language_subtags</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="4322719398-23">[</span><span class="p" data-group-id="4322719398-23">]</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">extensions</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="4322719398-24">%{</span><span class="p" data-group-id="4322719398-24">}</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">language_subtags</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="0014137621-23">[</span><span class="p" data-group-id="0014137621-23">]</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">extensions</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="0014137621-24">%{</span><span class="p" data-group-id="0014137621-24">}</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">gettext_locale_name</span><span class="p">:</span><span class="w"> </span><span class="no">nil</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">language</span><span class="p">:</span><span class="w"> </span><span class="s">"da"</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">locale</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="4322719398-25">%{</span><span class="p" data-group-id="4322719398-25">}</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">private_use</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="4322719398-26">[</span><span class="p" data-group-id="4322719398-26">]</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">locale</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="0014137621-25">%{</span><span class="p" data-group-id="0014137621-25">}</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">private_use</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="0014137621-26">[</span><span class="p" data-group-id="0014137621-26">]</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">rbnf_locale_name</span><span class="p">:</span><span class="w"> </span><span class="ss">:da</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">requested_locale_name</span><span class="p">:</span><span class="w"> </span><span class="s">"da"</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">script</span><span class="p">:</span><span class="w"> </span><span class="ss">:Latn</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">territory</span><span class="p">:</span><span class="w"> </span><span class="ss">:DK</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">transform</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="4322719398-27">%{</span><span class="p" data-group-id="4322719398-27">}</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">language_variants</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="4322719398-28">[</span><span class="p" data-group-id="4322719398-28">]</span><span class="w">
|
||||
</span><span class="p" data-group-id="4322719398-22">}</span><span class="p" data-group-id="4322719398-21">}</span><span class="p">,</span><span class="w">
|
||||
</span><span class="p" data-group-id="4322719398-29">{</span><span class="mf">0.3</span><span class="p">,</span><span class="w">
|
||||
</span><span class="p" data-group-id="4322719398-30">%</span><span class="nc" data-group-id="4322719398-30">Cldr.LanguageTag</span><span class="p" data-group-id="4322719398-30">{</span><span class="w">
|
||||
</span><span class="ss">transform</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="0014137621-27">%{</span><span class="p" data-group-id="0014137621-27">}</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">language_variants</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="0014137621-28">[</span><span class="p" data-group-id="0014137621-28">]</span><span class="w">
|
||||
</span><span class="p" data-group-id="0014137621-22">}</span><span class="p" data-group-id="0014137621-21">}</span><span class="p">,</span><span class="w">
|
||||
</span><span class="p" data-group-id="0014137621-29">{</span><span class="mf">0.3</span><span class="p">,</span><span class="w">
|
||||
</span><span class="p" data-group-id="0014137621-30">%</span><span class="nc" data-group-id="0014137621-30">Cldr.LanguageTag</span><span class="p" data-group-id="0014137621-30">{</span><span class="w">
|
||||
</span><span class="ss">backend</span><span class="p">:</span><span class="w"> </span><span class="nc">TestBackend.Cldr</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">canonical_locale_name</span><span class="p">:</span><span class="w"> </span><span class="s">"zh-TW"</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">cldr_locale_name</span><span class="p">:</span><span class="w"> </span><span class="ss">:"zh-Hant"</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">language_subtags</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="4322719398-31">[</span><span class="p" data-group-id="4322719398-31">]</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">extensions</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="4322719398-32">%{</span><span class="p" data-group-id="4322719398-32">}</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">language_subtags</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="0014137621-31">[</span><span class="p" data-group-id="0014137621-31">]</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">extensions</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="0014137621-32">%{</span><span class="p" data-group-id="0014137621-32">}</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">gettext_locale_name</span><span class="p">:</span><span class="w"> </span><span class="no">nil</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">language</span><span class="p">:</span><span class="w"> </span><span class="s">"zh"</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">locale</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="4322719398-33">%{</span><span class="p" data-group-id="4322719398-33">}</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">private_use</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="4322719398-34">[</span><span class="p" data-group-id="4322719398-34">]</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">locale</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="0014137621-33">%{</span><span class="p" data-group-id="0014137621-33">}</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">private_use</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="0014137621-34">[</span><span class="p" data-group-id="0014137621-34">]</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">rbnf_locale_name</span><span class="p">:</span><span class="w"> </span><span class="ss">:"zh-Hant"</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">requested_locale_name</span><span class="p">:</span><span class="w"> </span><span class="s">"zh-TW"</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">script</span><span class="p">:</span><span class="w"> </span><span class="ss">:Hant</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">territory</span><span class="p">:</span><span class="w"> </span><span class="ss">:TW</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">transform</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="4322719398-35">%{</span><span class="p" data-group-id="4322719398-35">}</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">language_variants</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="4322719398-36">[</span><span class="p" data-group-id="4322719398-36">]</span><span class="w">
|
||||
</span><span class="p" data-group-id="4322719398-30">}</span><span class="p" data-group-id="4322719398-29">}</span><span class="p">,</span><span class="w">
|
||||
</span><span class="p" data-group-id="4322719398-37">{</span><span class="ss">:error</span><span class="p">,</span><span class="w">
|
||||
</span><span class="p" data-group-id="4322719398-38">{</span><span class="nc">Cldr.LanguageTag.ParseError</span><span class="p">,</span><span class="w">
|
||||
</span><span class="s">"Expected a BCP47 language tag. Could not parse the remaining </span><span class="se">\"</span><span class="s">g</span><span class="se">\"</span><span class="s"> starting at position 11"</span><span class="p" data-group-id="4322719398-38">}</span><span class="p" data-group-id="4322719398-37">}</span><span class="w">
|
||||
</span><span class="p" data-group-id="4322719398-20">]</span></code></pre>
|
||||
</span><span class="ss">transform</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="0014137621-35">%{</span><span class="p" data-group-id="0014137621-35">}</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">language_variants</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="0014137621-36">[</span><span class="p" data-group-id="0014137621-36">]</span><span class="w">
|
||||
</span><span class="p" data-group-id="0014137621-30">}</span><span class="p" data-group-id="0014137621-29">}</span><span class="p">,</span><span class="w">
|
||||
</span><span class="p" data-group-id="0014137621-37">{</span><span class="ss">:error</span><span class="p">,</span><span class="w">
|
||||
</span><span class="p" data-group-id="0014137621-38">{</span><span class="nc">Cldr.LanguageTag.ParseError</span><span class="p">,</span><span class="w">
|
||||
</span><span class="s">"Expected a BCP47 language tag. Could not parse the remaining </span><span class="se">\"</span><span class="s">g</span><span class="se">\"</span><span class="s"> starting at position 11"</span><span class="p" data-group-id="0014137621-38">}</span><span class="p" data-group-id="0014137621-37">}</span><span class="w">
|
||||
</span><span class="p" data-group-id="0014137621-20">]</span></code></pre>
|
||||
</section>
|
||||
</section>
|
||||
|
||||
|
@ -419,11 +419,11 @@ The default is <code class="inline">:all</code>. See <a href="https://hexdocs.pm
|
||||
</h2>
|
||||
<p> MyApp.Cldr.Currency.currencies_for_locale("en")
|
||||
=> {:ok,
|
||||
%{</p><pre><code class="makeup elixir" translate="no"><span class="w"> </span><span class="ss">FJD</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="5069782495-1">%</span><span class="nc" data-group-id="5069782495-1">Cldr.Currency</span><span class="p" data-group-id="5069782495-1">{</span><span class="w">
|
||||
%{</p><pre><code class="makeup elixir" translate="no"><span class="w"> </span><span class="ss">FJD</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="9087717689-1">%</span><span class="nc" data-group-id="9087717689-1">Cldr.Currency</span><span class="p" data-group-id="9087717689-1">{</span><span class="w">
|
||||
</span><span class="ss">cash_digits</span><span class="p">:</span><span class="w"> </span><span class="mi">2</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">cash_rounding</span><span class="p">:</span><span class="w"> </span><span class="mi">0</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">code</span><span class="p">:</span><span class="w"> </span><span class="s">"FJD"</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">count</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="5069782495-2">%{</span><span class="ss">one</span><span class="p">:</span><span class="w"> </span><span class="s">"Fijian dollar"</span><span class="p">,</span><span class="w"> </span><span class="ss">other</span><span class="p">:</span><span class="w"> </span><span class="s">"Fijian dollars"</span><span class="p" data-group-id="5069782495-2">}</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">count</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="9087717689-2">%{</span><span class="ss">one</span><span class="p">:</span><span class="w"> </span><span class="s">"Fijian dollar"</span><span class="p">,</span><span class="w"> </span><span class="ss">other</span><span class="p">:</span><span class="w"> </span><span class="s">"Fijian dollars"</span><span class="p" data-group-id="9087717689-2">}</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">digits</span><span class="p">:</span><span class="w"> </span><span class="mi">2</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">from</span><span class="p">:</span><span class="w"> </span><span class="no">nil</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">iso_digits</span><span class="p">:</span><span class="w"> </span><span class="mi">2</span><span class="p">,</span><span class="w">
|
||||
@ -433,12 +433,12 @@ The default is <code class="inline">:all</code>. See <a href="https://hexdocs.pm
|
||||
</span><span class="ss">symbol</span><span class="p">:</span><span class="w"> </span><span class="s">"FJD"</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">tender</span><span class="p">:</span><span class="w"> </span><span class="no">true</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">to</span><span class="p">:</span><span class="w"> </span><span class="no">nil</span><span class="w">
|
||||
</span><span class="p" data-group-id="5069782495-1">}</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">SUR</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="5069782495-3">%</span><span class="nc" data-group-id="5069782495-3">Cldr.Currency</span><span class="p" data-group-id="5069782495-3">{</span><span class="w">
|
||||
</span><span class="p" data-group-id="9087717689-1">}</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">SUR</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="9087717689-3">%</span><span class="nc" data-group-id="9087717689-3">Cldr.Currency</span><span class="p" data-group-id="9087717689-3">{</span><span class="w">
|
||||
</span><span class="ss">cash_digits</span><span class="p">:</span><span class="w"> </span><span class="mi">2</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">cash_rounding</span><span class="p">:</span><span class="w"> </span><span class="mi">0</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">code</span><span class="p">:</span><span class="w"> </span><span class="s">"SUR"</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">count</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="5069782495-4">%{</span><span class="ss">one</span><span class="p">:</span><span class="w"> </span><span class="s">"Soviet rouble"</span><span class="p">,</span><span class="w"> </span><span class="ss">other</span><span class="p">:</span><span class="w"> </span><span class="s">"Soviet roubles"</span><span class="p" data-group-id="5069782495-4">}</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">count</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="9087717689-4">%{</span><span class="ss">one</span><span class="p">:</span><span class="w"> </span><span class="s">"Soviet rouble"</span><span class="p">,</span><span class="w"> </span><span class="ss">other</span><span class="p">:</span><span class="w"> </span><span class="s">"Soviet roubles"</span><span class="p" data-group-id="9087717689-4">}</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">digits</span><span class="p">:</span><span class="w"> </span><span class="mi">2</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">from</span><span class="p">:</span><span class="w"> </span><span class="no">nil</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">iso_digits</span><span class="p">:</span><span class="w"> </span><span class="no">nil</span><span class="p">,</span><span class="w">
|
||||
@ -448,7 +448,7 @@ The default is <code class="inline">:all</code>. See <a href="https://hexdocs.pm
|
||||
</span><span class="ss">symbol</span><span class="p">:</span><span class="w"> </span><span class="s">"SUR"</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">tender</span><span class="p">:</span><span class="w"> </span><span class="no">true</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">to</span><span class="p">:</span><span class="w"> </span><span class="no">nil</span><span class="w">
|
||||
</span><span class="p" data-group-id="5069782495-3">}</span><span class="p">,</span><span class="w">
|
||||
</span><span class="p" data-group-id="9087717689-3">}</span><span class="p">,</span><span class="w">
|
||||
</span><span class="n">...</span><span class="w">
|
||||
</span><span class="err">}</span><span class="err">}</span></code></pre>
|
||||
</section>
|
||||
@ -499,11 +499,11 @@ The default is <code class="inline">:all</code>. See <a href="https://hexdocs.pm
|
||||
<span class="text">Example</span>
|
||||
</h2>
|
||||
<p> MyApp.Cldr.Currency.currencies_for_locale!("en")
|
||||
=> %{</p><pre><code class="makeup elixir" translate="no"><span class="ss">FJD</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="4206391371-1">%</span><span class="nc" data-group-id="4206391371-1">Cldr.Currency</span><span class="p" data-group-id="4206391371-1">{</span><span class="w">
|
||||
=> %{</p><pre><code class="makeup elixir" translate="no"><span class="ss">FJD</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="8632110454-1">%</span><span class="nc" data-group-id="8632110454-1">Cldr.Currency</span><span class="p" data-group-id="8632110454-1">{</span><span class="w">
|
||||
</span><span class="ss">cash_digits</span><span class="p">:</span><span class="w"> </span><span class="mi">2</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">cash_rounding</span><span class="p">:</span><span class="w"> </span><span class="mi">0</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">code</span><span class="p">:</span><span class="w"> </span><span class="s">"FJD"</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">count</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="4206391371-2">%{</span><span class="ss">one</span><span class="p">:</span><span class="w"> </span><span class="s">"Fijian dollar"</span><span class="p">,</span><span class="w"> </span><span class="ss">other</span><span class="p">:</span><span class="w"> </span><span class="s">"Fijian dollars"</span><span class="p" data-group-id="4206391371-2">}</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">count</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="8632110454-2">%{</span><span class="ss">one</span><span class="p">:</span><span class="w"> </span><span class="s">"Fijian dollar"</span><span class="p">,</span><span class="w"> </span><span class="ss">other</span><span class="p">:</span><span class="w"> </span><span class="s">"Fijian dollars"</span><span class="p" data-group-id="8632110454-2">}</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">digits</span><span class="p">:</span><span class="w"> </span><span class="mi">2</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">from</span><span class="p">:</span><span class="w"> </span><span class="no">nil</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">iso_digits</span><span class="p">:</span><span class="w"> </span><span class="mi">2</span><span class="p">,</span><span class="w">
|
||||
@ -513,12 +513,12 @@ The default is <code class="inline">:all</code>. See <a href="https://hexdocs.pm
|
||||
</span><span class="ss">symbol</span><span class="p">:</span><span class="w"> </span><span class="s">"FJD"</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">tender</span><span class="p">:</span><span class="w"> </span><span class="no">true</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">to</span><span class="p">:</span><span class="w"> </span><span class="no">nil</span><span class="w">
|
||||
</span><span class="p" data-group-id="4206391371-1">}</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">SUR</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="4206391371-3">%</span><span class="nc" data-group-id="4206391371-3">Cldr.Currency</span><span class="p" data-group-id="4206391371-3">{</span><span class="w">
|
||||
</span><span class="p" data-group-id="8632110454-1">}</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">SUR</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="8632110454-3">%</span><span class="nc" data-group-id="8632110454-3">Cldr.Currency</span><span class="p" data-group-id="8632110454-3">{</span><span class="w">
|
||||
</span><span class="ss">cash_digits</span><span class="p">:</span><span class="w"> </span><span class="mi">2</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">cash_rounding</span><span class="p">:</span><span class="w"> </span><span class="mi">0</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">code</span><span class="p">:</span><span class="w"> </span><span class="s">"SUR"</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">count</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="4206391371-4">%{</span><span class="ss">one</span><span class="p">:</span><span class="w"> </span><span class="s">"Soviet rouble"</span><span class="p">,</span><span class="w"> </span><span class="ss">other</span><span class="p">:</span><span class="w"> </span><span class="s">"Soviet roubles"</span><span class="p" data-group-id="4206391371-4">}</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">count</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="8632110454-4">%{</span><span class="ss">one</span><span class="p">:</span><span class="w"> </span><span class="s">"Soviet rouble"</span><span class="p">,</span><span class="w"> </span><span class="ss">other</span><span class="p">:</span><span class="w"> </span><span class="s">"Soviet roubles"</span><span class="p" data-group-id="8632110454-4">}</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">digits</span><span class="p">:</span><span class="w"> </span><span class="mi">2</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">from</span><span class="p">:</span><span class="w"> </span><span class="no">nil</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">iso_digits</span><span class="p">:</span><span class="w"> </span><span class="no">nil</span><span class="p">,</span><span class="w">
|
||||
@ -528,7 +528,7 @@ The default is <code class="inline">:all</code>. See <a href="https://hexdocs.pm
|
||||
</span><span class="ss">symbol</span><span class="p">:</span><span class="w"> </span><span class="s">"SUR"</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">tender</span><span class="p">:</span><span class="w"> </span><span class="no">true</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">to</span><span class="p">:</span><span class="w"> </span><span class="no">nil</span><span class="w">
|
||||
</span><span class="p" data-group-id="4206391371-3">}</span><span class="p">,</span><span class="w">
|
||||
</span><span class="p" data-group-id="8632110454-3">}</span><span class="p">,</span><span class="w">
|
||||
</span><span class="n">...</span></code></pre><p> }</p>
|
||||
</section>
|
||||
</section>
|
||||
@ -586,13 +586,13 @@ or a <a href="https://hexdocs.pm/ex_cldr/2.37.5/Cldr.LanguageTag.html"><code cla
|
||||
</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.Currency</span><span class="o">.</span><span class="n">currency_for_code</span><span class="p" data-group-id="7555848279-1">(</span><span class="s">"AUD"</span><span class="p" data-group-id="7555848279-1">)</span><span class="w">
|
||||
</span><span class="p" data-group-id="7555848279-2">{</span><span class="ss">:ok</span><span class="p">,</span><span class="w">
|
||||
</span><span class="p" data-group-id="7555848279-3">%</span><span class="nc" data-group-id="7555848279-3">Cldr.Currency</span><span class="p" data-group-id="7555848279-3">{</span><span class="w">
|
||||
<pre><code class="makeup elixir" translate="no"><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr.Currency</span><span class="o">.</span><span class="n">currency_for_code</span><span class="p" data-group-id="1645318839-1">(</span><span class="s">"AUD"</span><span class="p" data-group-id="1645318839-1">)</span><span class="w">
|
||||
</span><span class="p" data-group-id="1645318839-2">{</span><span class="ss">:ok</span><span class="p">,</span><span class="w">
|
||||
</span><span class="p" data-group-id="1645318839-3">%</span><span class="nc" data-group-id="1645318839-3">Cldr.Currency</span><span class="p" data-group-id="1645318839-3">{</span><span class="w">
|
||||
</span><span class="ss">cash_digits</span><span class="p">:</span><span class="w"> </span><span class="mi">2</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">cash_rounding</span><span class="p">:</span><span class="w"> </span><span class="mi">0</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">code</span><span class="p">:</span><span class="w"> </span><span class="s">"AUD"</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">count</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="7555848279-4">%{</span><span class="ss">one</span><span class="p">:</span><span class="w"> </span><span class="s">"Australian dollar"</span><span class="p">,</span><span class="w"> </span><span class="ss">other</span><span class="p">:</span><span class="w"> </span><span class="s">"Australian dollars"</span><span class="p" data-group-id="7555848279-4">}</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">count</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="1645318839-4">%{</span><span class="ss">one</span><span class="p">:</span><span class="w"> </span><span class="s">"Australian dollar"</span><span class="p">,</span><span class="w"> </span><span class="ss">other</span><span class="p">:</span><span class="w"> </span><span class="s">"Australian dollars"</span><span class="p" data-group-id="1645318839-4">}</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">digits</span><span class="p">:</span><span class="w"> </span><span class="mi">2</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">iso_digits</span><span class="p">:</span><span class="w"> </span><span class="mi">2</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">name</span><span class="p">:</span><span class="w"> </span><span class="s">"Australian Dollar"</span><span class="p">,</span><span class="w">
|
||||
@ -600,15 +600,15 @@ or a <a href="https://hexdocs.pm/ex_cldr/2.37.5/Cldr.LanguageTag.html"><code cla
|
||||
</span><span class="ss">rounding</span><span class="p">:</span><span class="w"> </span><span class="mi">0</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">symbol</span><span class="p">:</span><span class="w"> </span><span class="s">"A$"</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">tender</span><span class="p">:</span><span class="w"> </span><span class="no">true</span><span class="w">
|
||||
</span><span class="p" data-group-id="7555848279-3">}</span><span class="p" data-group-id="7555848279-2">}</span><span class="w">
|
||||
</span><span class="p" data-group-id="1645318839-3">}</span><span class="p" data-group-id="1645318839-2">}</span><span class="w">
|
||||
|
||||
</span><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr.Currency</span><span class="o">.</span><span class="n">currency_for_code</span><span class="p" data-group-id="7555848279-5">(</span><span class="s">"THB"</span><span class="p" data-group-id="7555848279-5">)</span><span class="w">
|
||||
</span><span class="p" data-group-id="7555848279-6">{</span><span class="ss">:ok</span><span class="p">,</span><span class="w">
|
||||
</span><span class="p" data-group-id="7555848279-7">%</span><span class="nc" data-group-id="7555848279-7">Cldr.Currency</span><span class="p" data-group-id="7555848279-7">{</span><span class="w">
|
||||
</span><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr.Currency</span><span class="o">.</span><span class="n">currency_for_code</span><span class="p" data-group-id="1645318839-5">(</span><span class="s">"THB"</span><span class="p" data-group-id="1645318839-5">)</span><span class="w">
|
||||
</span><span class="p" data-group-id="1645318839-6">{</span><span class="ss">:ok</span><span class="p">,</span><span class="w">
|
||||
</span><span class="p" data-group-id="1645318839-7">%</span><span class="nc" data-group-id="1645318839-7">Cldr.Currency</span><span class="p" data-group-id="1645318839-7">{</span><span class="w">
|
||||
</span><span class="ss">cash_digits</span><span class="p">:</span><span class="w"> </span><span class="mi">2</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">cash_rounding</span><span class="p">:</span><span class="w"> </span><span class="mi">0</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">code</span><span class="p">:</span><span class="w"> </span><span class="s">"THB"</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">count</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="7555848279-8">%{</span><span class="ss">one</span><span class="p">:</span><span class="w"> </span><span class="s">"Thai baht"</span><span class="p">,</span><span class="w"> </span><span class="ss">other</span><span class="p">:</span><span class="w"> </span><span class="s">"Thai baht"</span><span class="p" data-group-id="7555848279-8">}</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">count</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="1645318839-8">%{</span><span class="ss">one</span><span class="p">:</span><span class="w"> </span><span class="s">"Thai baht"</span><span class="p">,</span><span class="w"> </span><span class="ss">other</span><span class="p">:</span><span class="w"> </span><span class="s">"Thai baht"</span><span class="p" data-group-id="1645318839-8">}</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">digits</span><span class="p">:</span><span class="w"> </span><span class="mi">2</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">iso_digits</span><span class="p">:</span><span class="w"> </span><span class="mi">2</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">name</span><span class="p">:</span><span class="w"> </span><span class="s">"Thai Baht"</span><span class="p">,</span><span class="w">
|
||||
@ -616,7 +616,7 @@ or a <a href="https://hexdocs.pm/ex_cldr/2.37.5/Cldr.LanguageTag.html"><code cla
|
||||
</span><span class="ss">rounding</span><span class="p">:</span><span class="w"> </span><span class="mi">0</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">symbol</span><span class="p">:</span><span class="w"> </span><span class="s">"THB"</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">tender</span><span class="p">:</span><span class="w"> </span><span class="no">true</span><span class="w">
|
||||
</span><span class="p" data-group-id="7555848279-7">}</span><span class="p" data-group-id="7555848279-6">}</span></code></pre>
|
||||
</span><span class="p" data-group-id="1645318839-7">}</span><span class="p" data-group-id="1645318839-6">}</span></code></pre>
|
||||
</section>
|
||||
</section>
|
||||
<section class="detail" id="currency_for_code!/2">
|
||||
@ -675,12 +675,12 @@ or a <a href="https://hexdocs.pm/ex_cldr/2.37.5/Cldr.LanguageTag.html"><code cla
|
||||
</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.Currency</span><span class="o">.</span><span class="n">currency_for_code!</span><span class="p" data-group-id="9527227973-1">(</span><span class="s">"AUD"</span><span class="p" data-group-id="9527227973-1">)</span><span class="w">
|
||||
</span><span class="p" data-group-id="9527227973-2">%</span><span class="nc" data-group-id="9527227973-2">Cldr.Currency</span><span class="p" data-group-id="9527227973-2">{</span><span class="w">
|
||||
<pre><code class="makeup elixir" translate="no"><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr.Currency</span><span class="o">.</span><span class="n">currency_for_code!</span><span class="p" data-group-id="2079306556-1">(</span><span class="s">"AUD"</span><span class="p" data-group-id="2079306556-1">)</span><span class="w">
|
||||
</span><span class="p" data-group-id="2079306556-2">%</span><span class="nc" data-group-id="2079306556-2">Cldr.Currency</span><span class="p" data-group-id="2079306556-2">{</span><span class="w">
|
||||
</span><span class="ss">cash_digits</span><span class="p">:</span><span class="w"> </span><span class="mi">2</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">cash_rounding</span><span class="p">:</span><span class="w"> </span><span class="mi">0</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">code</span><span class="p">:</span><span class="w"> </span><span class="s">"AUD"</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">count</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="9527227973-3">%{</span><span class="ss">one</span><span class="p">:</span><span class="w"> </span><span class="s">"Australian dollar"</span><span class="p">,</span><span class="w"> </span><span class="ss">other</span><span class="p">:</span><span class="w"> </span><span class="s">"Australian dollars"</span><span class="p" data-group-id="9527227973-3">}</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">count</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="2079306556-3">%{</span><span class="ss">one</span><span class="p">:</span><span class="w"> </span><span class="s">"Australian dollar"</span><span class="p">,</span><span class="w"> </span><span class="ss">other</span><span class="p">:</span><span class="w"> </span><span class="s">"Australian dollars"</span><span class="p" data-group-id="2079306556-3">}</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">digits</span><span class="p">:</span><span class="w"> </span><span class="mi">2</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">iso_digits</span><span class="p">:</span><span class="w"> </span><span class="mi">2</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">name</span><span class="p">:</span><span class="w"> </span><span class="s">"Australian Dollar"</span><span class="p">,</span><span class="w">
|
||||
@ -688,14 +688,14 @@ or a <a href="https://hexdocs.pm/ex_cldr/2.37.5/Cldr.LanguageTag.html"><code cla
|
||||
</span><span class="ss">rounding</span><span class="p">:</span><span class="w"> </span><span class="mi">0</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">symbol</span><span class="p">:</span><span class="w"> </span><span class="s">"A$"</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">tender</span><span class="p">:</span><span class="w"> </span><span class="no">true</span><span class="w">
|
||||
</span><span class="p" data-group-id="9527227973-2">}</span><span class="w">
|
||||
</span><span class="p" data-group-id="2079306556-2">}</span><span class="w">
|
||||
|
||||
</span><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr.Currency</span><span class="o">.</span><span class="n">currency_for_code!</span><span class="p" data-group-id="9527227973-4">(</span><span class="s">"THB"</span><span class="p" data-group-id="9527227973-4">)</span><span class="w">
|
||||
</span><span class="p" data-group-id="9527227973-5">%</span><span class="nc" data-group-id="9527227973-5">Cldr.Currency</span><span class="p" data-group-id="9527227973-5">{</span><span class="w">
|
||||
</span><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr.Currency</span><span class="o">.</span><span class="n">currency_for_code!</span><span class="p" data-group-id="2079306556-4">(</span><span class="s">"THB"</span><span class="p" data-group-id="2079306556-4">)</span><span class="w">
|
||||
</span><span class="p" data-group-id="2079306556-5">%</span><span class="nc" data-group-id="2079306556-5">Cldr.Currency</span><span class="p" data-group-id="2079306556-5">{</span><span class="w">
|
||||
</span><span class="ss">cash_digits</span><span class="p">:</span><span class="w"> </span><span class="mi">2</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">cash_rounding</span><span class="p">:</span><span class="w"> </span><span class="mi">0</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">code</span><span class="p">:</span><span class="w"> </span><span class="s">"THB"</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">count</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="9527227973-6">%{</span><span class="ss">one</span><span class="p">:</span><span class="w"> </span><span class="s">"Thai baht"</span><span class="p">,</span><span class="w"> </span><span class="ss">other</span><span class="p">:</span><span class="w"> </span><span class="s">"Thai baht"</span><span class="p" data-group-id="9527227973-6">}</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">count</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="2079306556-6">%{</span><span class="ss">one</span><span class="p">:</span><span class="w"> </span><span class="s">"Thai baht"</span><span class="p">,</span><span class="w"> </span><span class="ss">other</span><span class="p">:</span><span class="w"> </span><span class="s">"Thai baht"</span><span class="p" data-group-id="2079306556-6">}</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">digits</span><span class="p">:</span><span class="w"> </span><span class="mi">2</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">iso_digits</span><span class="p">:</span><span class="w"> </span><span class="mi">2</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">name</span><span class="p">:</span><span class="w"> </span><span class="s">"Thai Baht"</span><span class="p">,</span><span class="w">
|
||||
@ -703,7 +703,7 @@ or a <a href="https://hexdocs.pm/ex_cldr/2.37.5/Cldr.LanguageTag.html"><code cla
|
||||
</span><span class="ss">rounding</span><span class="p">:</span><span class="w"> </span><span class="mi">0</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">symbol</span><span class="p">:</span><span class="w"> </span><span class="s">"THB"</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">tender</span><span class="p">:</span><span class="w"> </span><span class="no">true</span><span class="w">
|
||||
</span><span class="p" data-group-id="9527227973-5">}</span></code></pre>
|
||||
</span><span class="p" data-group-id="2079306556-5">}</span></code></pre>
|
||||
</section>
|
||||
</section>
|
||||
<section class="detail" id="currency_from_locale/1">
|
||||
@ -744,15 +744,15 @@ or a <a href="https://hexdocs.pm/ex_cldr/2.37.5/Cldr.LanguageTag.html"><code cla
|
||||
</a>
|
||||
<span class="text">Examples</span>
|
||||
</h2>
|
||||
<pre><code class="makeup elixir" translate="no"><span class="gp unselectable">iex> </span><span class="p" data-group-id="3835434283-1">{</span><span class="ss">:ok</span><span class="p">,</span><span class="w"> </span><span class="n">locale</span><span class="p" data-group-id="3835434283-1">}</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nc">Plausible.Cldr</span><span class="o">.</span><span class="n">validate_locale</span><span class="p" data-group-id="3835434283-2">(</span><span class="s">"en"</span><span class="p" data-group-id="3835434283-2">)</span><span class="w">
|
||||
<pre><code class="makeup elixir" translate="no"><span class="gp unselectable">iex> </span><span class="p" data-group-id="1305749742-1">{</span><span class="ss">:ok</span><span class="p">,</span><span class="w"> </span><span class="n">locale</span><span class="p" data-group-id="1305749742-1">}</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nc">Plausible.Cldr</span><span class="o">.</span><span class="n">validate_locale</span><span class="p" data-group-id="1305749742-2">(</span><span class="s">"en"</span><span class="p" data-group-id="1305749742-2">)</span><span class="w">
|
||||
</span><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr.Currency</span><span class="o">.</span><span class="n">currency_from_locale</span><span class="w"> </span><span class="n">locale</span><span class="w">
|
||||
</span><span class="ss">:USD</span><span class="w">
|
||||
|
||||
</span><span class="gp unselectable">iex> </span><span class="p" data-group-id="3835434283-3">{</span><span class="ss">:ok</span><span class="p">,</span><span class="w"> </span><span class="n">locale</span><span class="p" data-group-id="3835434283-3">}</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nc">Plausible.Cldr</span><span class="o">.</span><span class="n">validate_locale</span><span class="p" data-group-id="3835434283-4">(</span><span class="s">"en-AU"</span><span class="p" data-group-id="3835434283-4">)</span><span class="w">
|
||||
</span><span class="gp unselectable">iex> </span><span class="p" data-group-id="1305749742-3">{</span><span class="ss">:ok</span><span class="p">,</span><span class="w"> </span><span class="n">locale</span><span class="p" data-group-id="1305749742-3">}</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nc">Plausible.Cldr</span><span class="o">.</span><span class="n">validate_locale</span><span class="p" data-group-id="1305749742-4">(</span><span class="s">"en-AU"</span><span class="p" data-group-id="1305749742-4">)</span><span class="w">
|
||||
</span><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr.Currency</span><span class="o">.</span><span class="n">currency_from_locale</span><span class="w"> </span><span class="n">locale</span><span class="w">
|
||||
</span><span class="ss">:AUD</span><span class="w">
|
||||
|
||||
</span><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr.Currency</span><span class="o">.</span><span class="n">currency_from_locale</span><span class="p" data-group-id="3835434283-5">(</span><span class="s">"en-GB"</span><span class="p" data-group-id="3835434283-5">)</span><span class="w">
|
||||
</span><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr.Currency</span><span class="o">.</span><span class="n">currency_from_locale</span><span class="p" data-group-id="1305749742-5">(</span><span class="s">"en-GB"</span><span class="p" data-group-id="1305749742-5">)</span><span class="w">
|
||||
</span><span class="ss">:GBP</span></code></pre>
|
||||
</section>
|
||||
</section>
|
||||
@ -796,14 +796,14 @@ or a <a href="https://hexdocs.pm/ex_cldr/2.37.5/Cldr.LanguageTag.html"><code cla
|
||||
</a>
|
||||
<span class="text">Example</span>
|
||||
</h2>
|
||||
<pre><code class="makeup elixir" translate="no"><span class="gp unselectable">iex> </span><span class="nc">MyApp.Cldr.Currency</span><span class="o">.</span><span class="n">currency_history_for_locale</span><span class="p" data-group-id="7878791144-1">(</span><span class="s">"en"</span><span class="p" data-group-id="7878791144-1">)</span><span class="w">
|
||||
</span><span class="p" data-group-id="7878791144-2">{</span><span class="ss">:ok</span><span class="p">,</span><span class="w">
|
||||
</span><span class="p" data-group-id="7878791144-3">%{</span><span class="w">
|
||||
</span><span class="ss">USD</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="7878791144-4">%{</span><span class="ss">from</span><span class="p">:</span><span class="w"> </span><span class="ld">~D[1792-01-01]</span><span class="p">,</span><span class="w"> </span><span class="ss">to</span><span class="p">:</span><span class="w"> </span><span class="no">nil</span><span class="p" data-group-id="7878791144-4">}</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">USN</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="7878791144-5">%{</span><span class="ss">tender</span><span class="p">:</span><span class="w"> </span><span class="no">false</span><span class="p" data-group-id="7878791144-5">}</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">USS</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="7878791144-6">%{</span><span class="ss">from</span><span class="p">:</span><span class="w"> </span><span class="no">nil</span><span class="p">,</span><span class="w"> </span><span class="ss">tender</span><span class="p">:</span><span class="w"> </span><span class="no">false</span><span class="p">,</span><span class="w"> </span><span class="ss">to</span><span class="p">:</span><span class="w"> </span><span class="ld">~D[2014-03-01]</span><span class="p" data-group-id="7878791144-6">}</span><span class="w">
|
||||
</span><span class="p" data-group-id="7878791144-3">}</span><span class="w">
|
||||
</span><span class="p" data-group-id="7878791144-2">}</span></code></pre>
|
||||
<pre><code class="makeup elixir" translate="no"><span class="gp unselectable">iex> </span><span class="nc">MyApp.Cldr.Currency</span><span class="o">.</span><span class="n">currency_history_for_locale</span><span class="p" data-group-id="6188279033-1">(</span><span class="s">"en"</span><span class="p" data-group-id="6188279033-1">)</span><span class="w">
|
||||
</span><span class="p" data-group-id="6188279033-2">{</span><span class="ss">:ok</span><span class="p">,</span><span class="w">
|
||||
</span><span class="p" data-group-id="6188279033-3">%{</span><span class="w">
|
||||
</span><span class="ss">USD</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="6188279033-4">%{</span><span class="ss">from</span><span class="p">:</span><span class="w"> </span><span class="ld">~D[1792-01-01]</span><span class="p">,</span><span class="w"> </span><span class="ss">to</span><span class="p">:</span><span class="w"> </span><span class="no">nil</span><span class="p" data-group-id="6188279033-4">}</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">USN</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="6188279033-5">%{</span><span class="ss">tender</span><span class="p">:</span><span class="w"> </span><span class="no">false</span><span class="p" data-group-id="6188279033-5">}</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">USS</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="6188279033-6">%{</span><span class="ss">from</span><span class="p">:</span><span class="w"> </span><span class="no">nil</span><span class="p">,</span><span class="w"> </span><span class="ss">tender</span><span class="p">:</span><span class="w"> </span><span class="no">false</span><span class="p">,</span><span class="w"> </span><span class="ss">to</span><span class="p">:</span><span class="w"> </span><span class="ld">~D[2014-03-01]</span><span class="p" data-group-id="6188279033-6">}</span><span class="w">
|
||||
</span><span class="p" data-group-id="6188279033-3">}</span><span class="w">
|
||||
</span><span class="p" data-group-id="6188279033-2">}</span></code></pre>
|
||||
</section>
|
||||
</section>
|
||||
<section class="detail" id="currency_strings/3">
|
||||
@ -862,9 +862,9 @@ The default is <code class="inline">:all</code>. See <a href="https://hexdocs.pm
|
||||
</a>
|
||||
<span class="text">Example</span>
|
||||
</h2>
|
||||
<pre><code class="makeup elixir" translate="no"><span class="nc">MyApp.Cldr.Currency</span><span class="o">.</span><span class="n">currency_strings</span><span class="p" data-group-id="4495416172-1">(</span><span class="s">"en"</span><span class="p" data-group-id="4495416172-1">)</span><span class="w">
|
||||
</span><span class="p">=></span><span class="w"> </span><span class="p" data-group-id="4495416172-2">{</span><span class="ss">:ok</span><span class="p">,</span><span class="w">
|
||||
</span><span class="p" data-group-id="4495416172-3">%{</span><span class="w">
|
||||
<pre><code class="makeup elixir" translate="no"><span class="nc">MyApp.Cldr.Currency</span><span class="o">.</span><span class="n">currency_strings</span><span class="p" data-group-id="0781401560-1">(</span><span class="s">"en"</span><span class="p" data-group-id="0781401560-1">)</span><span class="w">
|
||||
</span><span class="p">=></span><span class="w"> </span><span class="p" data-group-id="0781401560-2">{</span><span class="ss">:ok</span><span class="p">,</span><span class="w">
|
||||
</span><span class="p" data-group-id="0781401560-3">%{</span><span class="w">
|
||||
</span><span class="s">"mexican silver pesos"</span><span class="w"> </span><span class="p">=></span><span class="w"> </span><span class="ss">:MXP</span><span class="p">,</span><span class="w">
|
||||
</span><span class="s">"sudanese dinar"</span><span class="w"> </span><span class="p">=></span><span class="w"> </span><span class="ss">:SDD</span><span class="p">,</span><span class="w">
|
||||
</span><span class="s">"bad"</span><span class="w"> </span><span class="p">=></span><span class="w"> </span><span class="ss">:BAD</span><span class="p">,</span><span class="w">
|
||||
@ -874,7 +874,7 @@ The default is <code class="inline">:all</code>. See <a href="https://hexdocs.pm
|
||||
</span><span class="s">"guyanaese dollars"</span><span class="w"> </span><span class="p">=></span><span class="w"> </span><span class="ss">:GYD</span><span class="p">,</span><span class="w">
|
||||
</span><span class="s">"equatorial guinean ekwele"</span><span class="w"> </span><span class="p">=></span><span class="w"> </span><span class="ss">:GQE</span><span class="p">,</span><span class="w">
|
||||
</span><span class="n">...</span><span class="w">
|
||||
</span><span class="p" data-group-id="4495416172-3">}</span><span class="p" data-group-id="4495416172-2">}</span></code></pre>
|
||||
</span><span class="p" data-group-id="0781401560-3">}</span><span class="p" data-group-id="0781401560-2">}</span></code></pre>
|
||||
</section>
|
||||
</section>
|
||||
<section class="detail" id="currency_strings!/3">
|
||||
@ -933,8 +933,8 @@ The default is <code class="inline">:all</code>. See <a href="https://hexdocs.pm
|
||||
</a>
|
||||
<span class="text">Example</span>
|
||||
</h2>
|
||||
<pre><code class="makeup elixir" translate="no"><span class="nc">MyApp.Cldr.Currency</span><span class="o">.</span><span class="n">currency_strings!</span><span class="p" data-group-id="9757523559-1">(</span><span class="s">"en"</span><span class="p" data-group-id="9757523559-1">)</span><span class="w">
|
||||
</span><span class="p">=></span><span class="w"> </span><span class="p" data-group-id="9757523559-2">%{</span><span class="w">
|
||||
<pre><code class="makeup elixir" translate="no"><span class="nc">MyApp.Cldr.Currency</span><span class="o">.</span><span class="n">currency_strings!</span><span class="p" data-group-id="0991195058-1">(</span><span class="s">"en"</span><span class="p" data-group-id="0991195058-1">)</span><span class="w">
|
||||
</span><span class="p">=></span><span class="w"> </span><span class="p" data-group-id="0991195058-2">%{</span><span class="w">
|
||||
</span><span class="s">"mexican silver pesos"</span><span class="w"> </span><span class="p">=></span><span class="w"> </span><span class="ss">:MXP</span><span class="p">,</span><span class="w">
|
||||
</span><span class="s">"sudanese dinar"</span><span class="w"> </span><span class="p">=></span><span class="w"> </span><span class="ss">:SDD</span><span class="p">,</span><span class="w">
|
||||
</span><span class="s">"bad"</span><span class="w"> </span><span class="p">=></span><span class="w"> </span><span class="ss">:BAD</span><span class="p">,</span><span class="w">
|
||||
@ -944,7 +944,7 @@ The default is <code class="inline">:all</code>. See <a href="https://hexdocs.pm
|
||||
</span><span class="s">"guyanaese dollars"</span><span class="w"> </span><span class="p">=></span><span class="w"> </span><span class="ss">:GYD</span><span class="p">,</span><span class="w">
|
||||
</span><span class="s">"equatorial guinean ekwele"</span><span class="w"> </span><span class="p">=></span><span class="w"> </span><span class="ss">:GQE</span><span class="p">,</span><span class="w">
|
||||
</span><span class="n">...</span><span class="w">
|
||||
</span><span class="p" data-group-id="9757523559-2">}</span></code></pre>
|
||||
</span><span class="p" data-group-id="0991195058-2">}</span></code></pre>
|
||||
</section>
|
||||
</section>
|
||||
<section class="detail" id="current_currency_from_locale/1">
|
||||
@ -982,10 +982,10 @@ or a <a href="https://hexdocs.pm/ex_cldr/2.37.5/Cldr.LanguageTag.html"><code cla
|
||||
</a>
|
||||
<span class="text">Example</span>
|
||||
</h2>
|
||||
<pre><code class="makeup elixir" translate="no"><span class="gp unselectable">iex> </span><span class="nc">MyApp.Cldr.Currency</span><span class="o">.</span><span class="n">current_currency_from_locale</span><span class="p" data-group-id="7841772466-1">(</span><span class="s">"en"</span><span class="p" data-group-id="7841772466-1">)</span><span class="w">
|
||||
<pre><code class="makeup elixir" translate="no"><span class="gp unselectable">iex> </span><span class="nc">MyApp.Cldr.Currency</span><span class="o">.</span><span class="n">current_currency_from_locale</span><span class="p" data-group-id="1453768017-1">(</span><span class="s">"en"</span><span class="p" data-group-id="1453768017-1">)</span><span class="w">
|
||||
</span><span class="ss">:USD</span><span class="w">
|
||||
|
||||
</span><span class="gp unselectable">iex> </span><span class="nc">MyApp.Cldr.Currency</span><span class="o">.</span><span class="n">current_currency_from_locale</span><span class="p" data-group-id="7841772466-2">(</span><span class="s">"en-AU"</span><span class="p" data-group-id="7841772466-2">)</span><span class="w">
|
||||
</span><span class="gp unselectable">iex> </span><span class="nc">MyApp.Cldr.Currency</span><span class="o">.</span><span class="n">current_currency_from_locale</span><span class="p" data-group-id="1453768017-2">(</span><span class="s">"en-AU"</span><span class="p" data-group-id="1453768017-2">)</span><span class="w">
|
||||
</span><span class="ss">:AUD</span></code></pre>
|
||||
</section>
|
||||
</section>
|
||||
@ -1033,7 +1033,7 @@ mapping is returned for that territory.</p><h2 id="current_territory_currencies/
|
||||
</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.Currency</span><span class="o">.</span><span class="n">current_territory_currencies</span><span class="p" data-group-id="2747702968-1">(</span><span class="p" data-group-id="2747702968-1">)</span></code></pre>
|
||||
<pre><code class="makeup elixir" translate="no"><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr.Currency</span><span class="o">.</span><span class="n">current_territory_currencies</span><span class="p" data-group-id="5069010564-1">(</span><span class="p" data-group-id="5069010564-1">)</span></code></pre>
|
||||
</section>
|
||||
</section>
|
||||
<section class="detail" id="known_currencies/0">
|
||||
@ -1125,11 +1125,11 @@ currency code</li></ul><h2 id="known_currency_code/1-returns" class="section-hea
|
||||
</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.Currency</span><span class="o">.</span><span class="n">known_currency_code</span><span class="p" data-group-id="8136782575-1">(</span><span class="s">"AUD"</span><span class="p" data-group-id="8136782575-1">)</span><span class="w">
|
||||
</span><span class="p" data-group-id="8136782575-2">{</span><span class="ss">:ok</span><span class="p">,</span><span class="w"> </span><span class="ss">:AUD</span><span class="p" data-group-id="8136782575-2">}</span><span class="w">
|
||||
<pre><code class="makeup elixir" translate="no"><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr.Currency</span><span class="o">.</span><span class="n">known_currency_code</span><span class="p" data-group-id="4798122064-1">(</span><span class="s">"AUD"</span><span class="p" data-group-id="4798122064-1">)</span><span class="w">
|
||||
</span><span class="p" data-group-id="4798122064-2">{</span><span class="ss">:ok</span><span class="p">,</span><span class="w"> </span><span class="ss">:AUD</span><span class="p" data-group-id="4798122064-2">}</span><span class="w">
|
||||
|
||||
</span><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr.Currency</span><span class="o">.</span><span class="n">known_currency_code</span><span class="p" data-group-id="8136782575-3">(</span><span class="s">"GGG"</span><span class="p" data-group-id="8136782575-3">)</span><span class="w">
|
||||
</span><span class="p" data-group-id="8136782575-4">{</span><span class="ss">:error</span><span class="p">,</span><span class="w"> </span><span class="p" data-group-id="8136782575-5">{</span><span class="nc">Cldr.UnknownCurrencyError</span><span class="p">,</span><span class="w"> </span><span class="s">"The currency </span><span class="se">\"</span><span class="s">GGG</span><span class="se">\"</span><span class="s"> is invalid"</span><span class="p" data-group-id="8136782575-5">}</span><span class="p" data-group-id="8136782575-4">}</span></code></pre>
|
||||
</span><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr.Currency</span><span class="o">.</span><span class="n">known_currency_code</span><span class="p" data-group-id="4798122064-3">(</span><span class="s">"GGG"</span><span class="p" data-group-id="4798122064-3">)</span><span class="w">
|
||||
</span><span class="p" data-group-id="4798122064-4">{</span><span class="ss">:error</span><span class="p">,</span><span class="w"> </span><span class="p" data-group-id="4798122064-5">{</span><span class="nc">Cldr.UnknownCurrencyError</span><span class="p">,</span><span class="w"> </span><span class="s">"The currency </span><span class="se">\"</span><span class="s">GGG</span><span class="se">\"</span><span class="s"> is invalid"</span><span class="p" data-group-id="4798122064-5">}</span><span class="p" data-group-id="4798122064-4">}</span></code></pre>
|
||||
</section>
|
||||
</section>
|
||||
<section class="detail" id="known_currency_code?/1">
|
||||
@ -1176,13 +1176,13 @@ currency code</li></ul><h2 id="known_currency_code?/1-returns" class="section-he
|
||||
</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.Currency</span><span class="o">.</span><span class="n">known_currency_code?</span><span class="p" data-group-id="9554311555-1">(</span><span class="s">"AUD"</span><span class="p" data-group-id="9554311555-1">)</span><span class="w">
|
||||
<pre><code class="makeup elixir" translate="no"><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr.Currency</span><span class="o">.</span><span class="n">known_currency_code?</span><span class="p" data-group-id="6835052617-1">(</span><span class="s">"AUD"</span><span class="p" data-group-id="6835052617-1">)</span><span class="w">
|
||||
</span><span class="no">true</span><span class="w">
|
||||
|
||||
</span><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr.Currency</span><span class="o">.</span><span class="n">known_currency_code?</span><span class="p" data-group-id="9554311555-2">(</span><span class="s">"GGG"</span><span class="p" data-group-id="9554311555-2">)</span><span class="w">
|
||||
</span><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr.Currency</span><span class="o">.</span><span class="n">known_currency_code?</span><span class="p" data-group-id="6835052617-2">(</span><span class="s">"GGG"</span><span class="p" data-group-id="6835052617-2">)</span><span class="w">
|
||||
</span><span class="no">false</span><span class="w">
|
||||
|
||||
</span><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr.Currency</span><span class="o">.</span><span class="n">known_currency_code?</span><span class="p" data-group-id="9554311555-3">(</span><span class="ss">:XCV</span><span class="p" data-group-id="9554311555-3">)</span><span class="w">
|
||||
</span><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr.Currency</span><span class="o">.</span><span class="n">known_currency_code?</span><span class="p" data-group-id="6835052617-3">(</span><span class="ss">:XCV</span><span class="p" data-group-id="6835052617-3">)</span><span class="w">
|
||||
</span><span class="no">false</span></code></pre>
|
||||
</section>
|
||||
</section>
|
||||
@ -1217,7 +1217,7 @@ currency code</li></ul><h2 id="known_currency_code?/1-returns" class="section-he
|
||||
</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.Currency</span><span class="o">.</span><span class="n">known_currency_codes</span><span class="p" data-group-id="0980747460-1">(</span><span class="p" data-group-id="0980747460-1">)</span></code></pre>
|
||||
<pre><code class="makeup elixir" translate="no"><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr.Currency</span><span class="o">.</span><span class="n">known_currency_codes</span><span class="p" data-group-id="6673540098-1">(</span><span class="p" data-group-id="6673540098-1">)</span></code></pre>
|
||||
</section>
|
||||
</section>
|
||||
<section class="detail" id="new/2">
|
||||
@ -1276,14 +1276,14 @@ such as <code class="inline">0.05</code>. Optional.</li></ul><h2 id="new/2-retur
|
||||
</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.Currency</span><span class="o">.</span><span class="n">new</span><span class="p" data-group-id="1304793566-1">(</span><span class="ss">:XAE</span><span class="p">,</span><span class="w"> </span><span class="ss">name</span><span class="p">:</span><span class="w"> </span><span class="s">"Custom Name"</span><span class="p">,</span><span class="w"> </span><span class="ss">digits</span><span class="p">:</span><span class="w"> </span><span class="mi">0</span><span class="p" data-group-id="1304793566-1">)</span><span class="w">
|
||||
</span><span class="p" data-group-id="1304793566-2">{</span><span class="ss">:ok</span><span class="p">,</span><span class="w">
|
||||
</span><span class="p" data-group-id="1304793566-3">%</span><span class="nc" data-group-id="1304793566-3">Cldr.Currency</span><span class="p" data-group-id="1304793566-3">{</span><span class="w">
|
||||
<pre><code class="makeup elixir" translate="no"><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr.Currency</span><span class="o">.</span><span class="n">new</span><span class="p" data-group-id="1996883285-1">(</span><span class="ss">:XAE</span><span class="p">,</span><span class="w"> </span><span class="ss">name</span><span class="p">:</span><span class="w"> </span><span class="s">"Custom Name"</span><span class="p">,</span><span class="w"> </span><span class="ss">digits</span><span class="p">:</span><span class="w"> </span><span class="mi">0</span><span class="p" data-group-id="1996883285-1">)</span><span class="w">
|
||||
</span><span class="p" data-group-id="1996883285-2">{</span><span class="ss">:ok</span><span class="p">,</span><span class="w">
|
||||
</span><span class="p" data-group-id="1996883285-3">%</span><span class="nc" data-group-id="1996883285-3">Cldr.Currency</span><span class="p" data-group-id="1996883285-3">{</span><span class="w">
|
||||
</span><span class="ss">alt_code</span><span class="p">:</span><span class="w"> </span><span class="ss">:XAE</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">cash_digits</span><span class="p">:</span><span class="w"> </span><span class="mi">0</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">cash_rounding</span><span class="p">:</span><span class="w"> </span><span class="no">nil</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">code</span><span class="p">:</span><span class="w"> </span><span class="ss">:XAE</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">count</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="1304793566-4">%{</span><span class="ss">other</span><span class="p">:</span><span class="w"> </span><span class="s">"Custom Name"</span><span class="p" data-group-id="1304793566-4">}</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">count</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="1996883285-4">%{</span><span class="ss">other</span><span class="p">:</span><span class="w"> </span><span class="s">"Custom Name"</span><span class="p" data-group-id="1996883285-4">}</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">digits</span><span class="p">:</span><span class="w"> </span><span class="mi">0</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">from</span><span class="p">:</span><span class="w"> </span><span class="no">nil</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">iso_digits</span><span class="p">:</span><span class="w"> </span><span class="mi">0</span><span class="p">,</span><span class="w">
|
||||
@ -1293,11 +1293,11 @@ such as <code class="inline">0.05</code>. Optional.</li></ul><h2 id="new/2-retur
|
||||
</span><span class="ss">symbol</span><span class="p">:</span><span class="w"> </span><span class="s">"XAE"</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">tender</span><span class="p">:</span><span class="w"> </span><span class="no">false</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">to</span><span class="p">:</span><span class="w"> </span><span class="no">nil</span><span class="w">
|
||||
</span><span class="p" data-group-id="1304793566-3">}</span><span class="p" data-group-id="1304793566-2">}</span><span class="w">
|
||||
</span><span class="gp unselectable">iex> </span><span class="nc">MyApp.Cldr.Currency</span><span class="o">.</span><span class="n">new</span><span class="p" data-group-id="1304793566-5">(</span><span class="ss">:XAH</span><span class="p">,</span><span class="w"> </span><span class="ss">name</span><span class="p">:</span><span class="w"> </span><span class="s">"Custom Name"</span><span class="p" data-group-id="1304793566-5">)</span><span class="w">
|
||||
</span><span class="p" data-group-id="1304793566-6">{</span><span class="ss">:error</span><span class="p">,</span><span class="w"> </span><span class="s">"Required options are missing. Required options are [:name, :digits]"</span><span class="p" data-group-id="1304793566-6">}</span><span class="w">
|
||||
</span><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr.Currency</span><span class="o">.</span><span class="n">new</span><span class="p" data-group-id="1304793566-7">(</span><span class="ss">:XAE</span><span class="p">,</span><span class="w"> </span><span class="ss">name</span><span class="p">:</span><span class="w"> </span><span class="s">"XAE"</span><span class="p">,</span><span class="w"> </span><span class="ss">digits</span><span class="p">:</span><span class="w"> </span><span class="mi">0</span><span class="p" data-group-id="1304793566-7">)</span><span class="w">
|
||||
</span><span class="p" data-group-id="1304793566-8">{</span><span class="ss">:error</span><span class="p">,</span><span class="w"> </span><span class="p" data-group-id="1304793566-9">{</span><span class="nc">Cldr.CurrencyAlreadyDefined</span><span class="p">,</span><span class="w"> </span><span class="s">"Currency :XAE is already defined."</span><span class="p" data-group-id="1304793566-9">}</span><span class="p" data-group-id="1304793566-8">}</span></code></pre>
|
||||
</span><span class="p" data-group-id="1996883285-3">}</span><span class="p" data-group-id="1996883285-2">}</span><span class="w">
|
||||
</span><span class="gp unselectable">iex> </span><span class="nc">MyApp.Cldr.Currency</span><span class="o">.</span><span class="n">new</span><span class="p" data-group-id="1996883285-5">(</span><span class="ss">:XAH</span><span class="p">,</span><span class="w"> </span><span class="ss">name</span><span class="p">:</span><span class="w"> </span><span class="s">"Custom Name"</span><span class="p" data-group-id="1996883285-5">)</span><span class="w">
|
||||
</span><span class="p" data-group-id="1996883285-6">{</span><span class="ss">:error</span><span class="p">,</span><span class="w"> </span><span class="s">"Required options are missing. Required options are [:name, :digits]"</span><span class="p" data-group-id="1996883285-6">}</span><span class="w">
|
||||
</span><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr.Currency</span><span class="o">.</span><span class="n">new</span><span class="p" data-group-id="1996883285-7">(</span><span class="ss">:XAE</span><span class="p">,</span><span class="w"> </span><span class="ss">name</span><span class="p">:</span><span class="w"> </span><span class="s">"XAE"</span><span class="p">,</span><span class="w"> </span><span class="ss">digits</span><span class="p">:</span><span class="w"> </span><span class="mi">0</span><span class="p" data-group-id="1996883285-7">)</span><span class="w">
|
||||
</span><span class="p" data-group-id="1996883285-8">{</span><span class="ss">:error</span><span class="p">,</span><span class="w"> </span><span class="p" data-group-id="1996883285-9">{</span><span class="nc">Cldr.CurrencyAlreadyDefined</span><span class="p">,</span><span class="w"> </span><span class="s">"Currency :XAE is already defined."</span><span class="p" data-group-id="1996883285-9">}</span><span class="p" data-group-id="1996883285-8">}</span></code></pre>
|
||||
</section>
|
||||
</section>
|
||||
<section class="detail" id="pluralize/3">
|
||||
@ -1355,20 +1355,20 @@ default is <a href="Plausible.Cldr.html#get_locale/0"><code class="inline">Plaus
|
||||
</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.Currency</span><span class="o">.</span><span class="n">pluralize</span><span class="p" data-group-id="8895131547-1">(</span><span class="mi">1</span><span class="p">,</span><span class="w"> </span><span class="ss">:USD</span><span class="p" data-group-id="8895131547-1">)</span><span class="w">
|
||||
</span><span class="p" data-group-id="8895131547-2">{</span><span class="ss">:ok</span><span class="p">,</span><span class="w"> </span><span class="s">"US dollar"</span><span class="p" data-group-id="8895131547-2">}</span><span class="w">
|
||||
<pre><code class="makeup elixir" translate="no"><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr.Currency</span><span class="o">.</span><span class="n">pluralize</span><span class="p" data-group-id="1133210805-1">(</span><span class="mi">1</span><span class="p">,</span><span class="w"> </span><span class="ss">:USD</span><span class="p" data-group-id="1133210805-1">)</span><span class="w">
|
||||
</span><span class="p" data-group-id="1133210805-2">{</span><span class="ss">:ok</span><span class="p">,</span><span class="w"> </span><span class="s">"US dollar"</span><span class="p" data-group-id="1133210805-2">}</span><span class="w">
|
||||
|
||||
</span><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr.Currency</span><span class="o">.</span><span class="n">pluralize</span><span class="p" data-group-id="8895131547-3">(</span><span class="mi">3</span><span class="p">,</span><span class="w"> </span><span class="ss">:USD</span><span class="p" data-group-id="8895131547-3">)</span><span class="w">
|
||||
</span><span class="p" data-group-id="8895131547-4">{</span><span class="ss">:ok</span><span class="p">,</span><span class="w"> </span><span class="s">"US dollars"</span><span class="p" data-group-id="8895131547-4">}</span><span class="w">
|
||||
</span><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr.Currency</span><span class="o">.</span><span class="n">pluralize</span><span class="p" data-group-id="1133210805-3">(</span><span class="mi">3</span><span class="p">,</span><span class="w"> </span><span class="ss">:USD</span><span class="p" data-group-id="1133210805-3">)</span><span class="w">
|
||||
</span><span class="p" data-group-id="1133210805-4">{</span><span class="ss">:ok</span><span class="p">,</span><span class="w"> </span><span class="s">"US dollars"</span><span class="p" data-group-id="1133210805-4">}</span><span class="w">
|
||||
|
||||
</span><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr.Currency</span><span class="o">.</span><span class="n">pluralize</span><span class="p" data-group-id="8895131547-5">(</span><span class="mi">12</span><span class="p">,</span><span class="w"> </span><span class="ss">:USD</span><span class="p">,</span><span class="w"> </span><span class="ss">locale</span><span class="p">:</span><span class="w"> </span><span class="s">"zh"</span><span class="p" data-group-id="8895131547-5">)</span><span class="w">
|
||||
</span><span class="p" data-group-id="8895131547-6">{</span><span class="ss">:ok</span><span class="p">,</span><span class="w"> </span><span class="s">"美元"</span><span class="p" data-group-id="8895131547-6">}</span><span class="w">
|
||||
</span><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr.Currency</span><span class="o">.</span><span class="n">pluralize</span><span class="p" data-group-id="1133210805-5">(</span><span class="mi">12</span><span class="p">,</span><span class="w"> </span><span class="ss">:USD</span><span class="p">,</span><span class="w"> </span><span class="ss">locale</span><span class="p">:</span><span class="w"> </span><span class="s">"zh"</span><span class="p" data-group-id="1133210805-5">)</span><span class="w">
|
||||
</span><span class="p" data-group-id="1133210805-6">{</span><span class="ss">:ok</span><span class="p">,</span><span class="w"> </span><span class="s">"美元"</span><span class="p" data-group-id="1133210805-6">}</span><span class="w">
|
||||
|
||||
</span><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr.Currency</span><span class="o">.</span><span class="n">pluralize</span><span class="p" data-group-id="8895131547-7">(</span><span class="mi">12</span><span class="p">,</span><span class="w"> </span><span class="ss">:USD</span><span class="p">,</span><span class="w"> </span><span class="ss">locale</span><span class="p">:</span><span class="w"> </span><span class="s">"fr"</span><span class="p" data-group-id="8895131547-7">)</span><span class="w">
|
||||
</span><span class="p" data-group-id="8895131547-8">{</span><span class="ss">:ok</span><span class="p">,</span><span class="w"> </span><span class="s">"dollars des États-Unis"</span><span class="p" data-group-id="8895131547-8">}</span><span class="w">
|
||||
</span><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr.Currency</span><span class="o">.</span><span class="n">pluralize</span><span class="p" data-group-id="1133210805-7">(</span><span class="mi">12</span><span class="p">,</span><span class="w"> </span><span class="ss">:USD</span><span class="p">,</span><span class="w"> </span><span class="ss">locale</span><span class="p">:</span><span class="w"> </span><span class="s">"fr"</span><span class="p" data-group-id="1133210805-7">)</span><span class="w">
|
||||
</span><span class="p" data-group-id="1133210805-8">{</span><span class="ss">:ok</span><span class="p">,</span><span class="w"> </span><span class="s">"dollars des États-Unis"</span><span class="p" data-group-id="1133210805-8">}</span><span class="w">
|
||||
|
||||
</span><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr.Currency</span><span class="o">.</span><span class="n">pluralize</span><span class="p" data-group-id="8895131547-9">(</span><span class="mi">1</span><span class="p">,</span><span class="w"> </span><span class="ss">:USD</span><span class="p">,</span><span class="w"> </span><span class="ss">locale</span><span class="p">:</span><span class="w"> </span><span class="s">"fr"</span><span class="p" data-group-id="8895131547-9">)</span><span class="w">
|
||||
</span><span class="p" data-group-id="8895131547-10">{</span><span class="ss">:ok</span><span class="p">,</span><span class="w"> </span><span class="s">"dollar des États-Unis"</span><span class="p" data-group-id="8895131547-10">}</span></code></pre>
|
||||
</span><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr.Currency</span><span class="o">.</span><span class="n">pluralize</span><span class="p" data-group-id="1133210805-9">(</span><span class="mi">1</span><span class="p">,</span><span class="w"> </span><span class="ss">:USD</span><span class="p">,</span><span class="w"> </span><span class="ss">locale</span><span class="p">:</span><span class="w"> </span><span class="s">"fr"</span><span class="p" data-group-id="1133210805-9">)</span><span class="w">
|
||||
</span><span class="p" data-group-id="1133210805-10">{</span><span class="ss">:ok</span><span class="p">,</span><span class="w"> </span><span class="s">"dollar des États-Unis"</span><span class="p" data-group-id="1133210805-10">}</span></code></pre>
|
||||
</section>
|
||||
</section>
|
||||
<section class="detail" id="strings_for_currency/2">
|
||||
@ -1410,8 +1410,8 @@ or a <a href="https://hexdocs.pm/ex_cldr/2.37.5/Cldr.LanguageTag.html"><code cla
|
||||
</a>
|
||||
<span class="text">Example</span>
|
||||
</h2>
|
||||
<pre><code class="makeup elixir" translate="no"><span class="gp unselectable">iex> </span><span class="nc">MyApp.Cldr.Currency</span><span class="o">.</span><span class="n">strings_for_currency</span><span class="p" data-group-id="2884439413-1">(</span><span class="ss">:AUD</span><span class="p">,</span><span class="w"> </span><span class="s">"en"</span><span class="p" data-group-id="2884439413-1">)</span><span class="w">
|
||||
</span><span class="p" data-group-id="2884439413-2">[</span><span class="s">"a$"</span><span class="p">,</span><span class="w"> </span><span class="s">"australian dollars"</span><span class="p">,</span><span class="w"> </span><span class="s">"aud"</span><span class="p">,</span><span class="w"> </span><span class="s">"australian dollar"</span><span class="p" data-group-id="2884439413-2">]</span></code></pre>
|
||||
<pre><code class="makeup elixir" translate="no"><span class="gp unselectable">iex> </span><span class="nc">MyApp.Cldr.Currency</span><span class="o">.</span><span class="n">strings_for_currency</span><span class="p" data-group-id="7244379411-1">(</span><span class="ss">:AUD</span><span class="p">,</span><span class="w"> </span><span class="s">"en"</span><span class="p" data-group-id="7244379411-1">)</span><span class="w">
|
||||
</span><span class="p" data-group-id="7244379411-2">[</span><span class="s">"a$"</span><span class="p">,</span><span class="w"> </span><span class="s">"australian dollars"</span><span class="p">,</span><span class="w"> </span><span class="s">"aud"</span><span class="p">,</span><span class="w"> </span><span class="s">"australian dollar"</span><span class="p" data-group-id="7244379411-2">]</span></code></pre>
|
||||
</section>
|
||||
</section>
|
||||
|
||||
|
@ -326,16 +326,16 @@ this specific locale..</p><h2 id="fallback_locale_names/1-arguments" class="sect
|
||||
</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.Locale</span><span class="o">.</span><span class="n">fallback_locale_names</span><span class="p" data-group-id="3669303090-1">(</span><span class="ss">:"fr-CA"</span><span class="p" data-group-id="3669303090-1">)</span><span class="w">
|
||||
</span><span class="p" data-group-id="3669303090-2">{</span><span class="ss">:ok</span><span class="p">,</span><span class="w"> </span><span class="p" data-group-id="3669303090-3">[</span><span class="ss">:"fr-CA"</span><span class="p">,</span><span class="w"> </span><span class="ss">:fr</span><span class="p">,</span><span class="w"> </span><span class="ss">:und</span><span class="p" data-group-id="3669303090-3">]</span><span class="p" data-group-id="3669303090-2">}</span><span class="w">
|
||||
<pre><code class="makeup elixir" translate="no"><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr.Locale</span><span class="o">.</span><span class="n">fallback_locale_names</span><span class="p" data-group-id="9303787542-1">(</span><span class="ss">:"fr-CA"</span><span class="p" data-group-id="9303787542-1">)</span><span class="w">
|
||||
</span><span class="p" data-group-id="9303787542-2">{</span><span class="ss">:ok</span><span class="p">,</span><span class="w"> </span><span class="p" data-group-id="9303787542-3">[</span><span class="ss">:"fr-CA"</span><span class="p">,</span><span class="w"> </span><span class="ss">:fr</span><span class="p">,</span><span class="w"> </span><span class="ss">:und</span><span class="p" data-group-id="9303787542-3">]</span><span class="p" data-group-id="9303787542-2">}</span><span class="w">
|
||||
|
||||
</span><span class="c1"># Fallbacks are typically formed by progressively</span><span class="w">
|
||||
</span><span class="c1"># stripping variant, territory and script from the</span><span class="w">
|
||||
</span><span class="c1"># given locale name. But not always - there are</span><span class="w">
|
||||
</span><span class="c1"># certain fallbacks that take a different path.</span><span class="w">
|
||||
|
||||
</span><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr.Locale</span><span class="o">.</span><span class="n">fallback_locale_names</span><span class="p" data-group-id="3669303090-4">(</span><span class="ss">:nb</span><span class="p" data-group-id="3669303090-4">)</span><span class="w">
|
||||
</span><span class="p" data-group-id="3669303090-5">{</span><span class="ss">:ok</span><span class="p">,</span><span class="w"> </span><span class="p" data-group-id="3669303090-6">[</span><span class="ss">:nb</span><span class="p">,</span><span class="w"> </span><span class="ss">:no</span><span class="p">,</span><span class="w"> </span><span class="ss">:und</span><span class="p" data-group-id="3669303090-6">]</span><span class="p" data-group-id="3669303090-5">}</span></code></pre>
|
||||
</span><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr.Locale</span><span class="o">.</span><span class="n">fallback_locale_names</span><span class="p" data-group-id="9303787542-4">(</span><span class="ss">:nb</span><span class="p" data-group-id="9303787542-4">)</span><span class="w">
|
||||
</span><span class="p" data-group-id="9303787542-5">{</span><span class="ss">:ok</span><span class="p">,</span><span class="w"> </span><span class="p" data-group-id="9303787542-6">[</span><span class="ss">:nb</span><span class="p">,</span><span class="w"> </span><span class="ss">:no</span><span class="p">,</span><span class="w"> </span><span class="ss">:und</span><span class="p" data-group-id="9303787542-6">]</span><span class="p" data-group-id="9303787542-5">}</span></code></pre>
|
||||
</section>
|
||||
</section>
|
||||
<section class="detail" id="fallback_locales/1">
|
||||
@ -389,20 +389,20 @@ this specific locale.</p><h2 id="fallback_locales/1-arguments" class="section-he
|
||||
</a>
|
||||
<span class="text">Examples</span>
|
||||
</h2>
|
||||
<pre><code class="makeup elixir" translate="no"><span class="nc">Plausible.Cldr.Locale</span><span class="o">.</span><span class="n">fallback_locales</span><span class="p" data-group-id="6670900698-1">(</span><span class="ss">:"fr-CA"</span><span class="p" data-group-id="6670900698-1">)</span><span class="w">
|
||||
</span><span class="p">=></span><span class="w"> </span><span class="p" data-group-id="6670900698-2">{</span><span class="ss">:ok</span><span class="p">,</span><span class="w">
|
||||
</span><span class="p" data-group-id="6670900698-3">[</span><span class="p" data-group-id="6670900698-4">#</span><span class="nc" data-group-id="6670900698-4">Cldr.LanguageTag</span><span class="p" data-group-id="6670900698-4"><</span><span class="n">fr</span><span class="o">-</span><span class="nc">CA</span><span class="w"> </span><span class="p" data-group-id="6670900698-5">[</span><span class="n">validated</span><span class="p" data-group-id="6670900698-5">]</span><span class="p" data-group-id="6670900698-4">></span><span class="p">,</span><span class="w"> </span><span class="p" data-group-id="6670900698-6">#</span><span class="nc" data-group-id="6670900698-6">Cldr.LanguageTag</span><span class="p" data-group-id="6670900698-6"><</span><span class="n">fr</span><span class="w"> </span><span class="p" data-group-id="6670900698-7">[</span><span class="n">validated</span><span class="p" data-group-id="6670900698-7">]</span><span class="p" data-group-id="6670900698-6">></span><span class="p">,</span><span class="w">
|
||||
</span><span class="p" data-group-id="6670900698-8">#</span><span class="nc" data-group-id="6670900698-8">Cldr.LanguageTag</span><span class="p" data-group-id="6670900698-8"><</span><span class="n">und</span><span class="w"> </span><span class="p" data-group-id="6670900698-9">[</span><span class="n">validated</span><span class="p" data-group-id="6670900698-9">]</span><span class="p" data-group-id="6670900698-8">></span><span class="p" data-group-id="6670900698-3">]</span><span class="p" data-group-id="6670900698-2">}</span><span class="w">
|
||||
<pre><code class="makeup elixir" translate="no"><span class="nc">Plausible.Cldr.Locale</span><span class="o">.</span><span class="n">fallback_locales</span><span class="p" data-group-id="0464531479-1">(</span><span class="ss">:"fr-CA"</span><span class="p" data-group-id="0464531479-1">)</span><span class="w">
|
||||
</span><span class="p">=></span><span class="w"> </span><span class="p" data-group-id="0464531479-2">{</span><span class="ss">:ok</span><span class="p">,</span><span class="w">
|
||||
</span><span class="p" data-group-id="0464531479-3">[</span><span class="p" data-group-id="0464531479-4">#</span><span class="nc" data-group-id="0464531479-4">Cldr.LanguageTag</span><span class="p" data-group-id="0464531479-4"><</span><span class="n">fr</span><span class="o">-</span><span class="nc">CA</span><span class="w"> </span><span class="p" data-group-id="0464531479-5">[</span><span class="n">validated</span><span class="p" data-group-id="0464531479-5">]</span><span class="p" data-group-id="0464531479-4">></span><span class="p">,</span><span class="w"> </span><span class="p" data-group-id="0464531479-6">#</span><span class="nc" data-group-id="0464531479-6">Cldr.LanguageTag</span><span class="p" data-group-id="0464531479-6"><</span><span class="n">fr</span><span class="w"> </span><span class="p" data-group-id="0464531479-7">[</span><span class="n">validated</span><span class="p" data-group-id="0464531479-7">]</span><span class="p" data-group-id="0464531479-6">></span><span class="p">,</span><span class="w">
|
||||
</span><span class="p" data-group-id="0464531479-8">#</span><span class="nc" data-group-id="0464531479-8">Cldr.LanguageTag</span><span class="p" data-group-id="0464531479-8"><</span><span class="n">und</span><span class="w"> </span><span class="p" data-group-id="0464531479-9">[</span><span class="n">validated</span><span class="p" data-group-id="0464531479-9">]</span><span class="p" data-group-id="0464531479-8">></span><span class="p" data-group-id="0464531479-3">]</span><span class="p" data-group-id="0464531479-2">}</span><span class="w">
|
||||
|
||||
</span><span class="c1"># Fallbacks are typically formed by progressively</span><span class="w">
|
||||
</span><span class="c1"># stripping variant, territory and script from the</span><span class="w">
|
||||
</span><span class="c1"># given locale name. But not always - there are</span><span class="w">
|
||||
</span><span class="c1"># certain fallbacks that take a different path.</span><span class="w">
|
||||
|
||||
</span><span class="nc">Plausible.Cldr.Locale</span><span class="o">.</span><span class="n">fallback_locales</span><span class="p" data-group-id="6670900698-10">(</span><span class="ss">:nb</span><span class="p" data-group-id="6670900698-10">)</span><span class="p">)</span><span class="w">
|
||||
</span><span class="p">=></span><span class="w"> </span><span class="p" data-group-id="6670900698-11">{</span><span class="ss">:ok</span><span class="p">,</span><span class="w">
|
||||
</span><span class="p" data-group-id="6670900698-12">[</span><span class="p" data-group-id="6670900698-13">#</span><span class="nc" data-group-id="6670900698-13">Cldr.LanguageTag</span><span class="p" data-group-id="6670900698-13"><</span><span class="n">nb</span><span class="w"> </span><span class="p" data-group-id="6670900698-14">[</span><span class="n">validated</span><span class="p" data-group-id="6670900698-14">]</span><span class="p" data-group-id="6670900698-13">></span><span class="p">,</span><span class="w"> </span><span class="p" data-group-id="6670900698-15">#</span><span class="nc" data-group-id="6670900698-15">Cldr.LanguageTag</span><span class="p" data-group-id="6670900698-15"><</span><span class="n">no</span><span class="w"> </span><span class="p" data-group-id="6670900698-16">[</span><span class="n">validated</span><span class="p" data-group-id="6670900698-16">]</span><span class="p" data-group-id="6670900698-15">></span><span class="p">,</span><span class="w">
|
||||
</span><span class="p" data-group-id="6670900698-17">#</span><span class="nc" data-group-id="6670900698-17">Cldr.LanguageTag</span><span class="p" data-group-id="6670900698-17"><</span><span class="n">und</span><span class="w"> </span><span class="p" data-group-id="6670900698-18">[</span><span class="n">validated</span><span class="p" data-group-id="6670900698-18">]</span><span class="p" data-group-id="6670900698-17">></span><span class="p" data-group-id="6670900698-12">]</span><span class="p" data-group-id="6670900698-11">}</span></code></pre>
|
||||
</span><span class="nc">Plausible.Cldr.Locale</span><span class="o">.</span><span class="n">fallback_locales</span><span class="p" data-group-id="0464531479-10">(</span><span class="ss">:nb</span><span class="p" data-group-id="0464531479-10">)</span><span class="p">)</span><span class="w">
|
||||
</span><span class="p">=></span><span class="w"> </span><span class="p" data-group-id="0464531479-11">{</span><span class="ss">:ok</span><span class="p">,</span><span class="w">
|
||||
</span><span class="p" data-group-id="0464531479-12">[</span><span class="p" data-group-id="0464531479-13">#</span><span class="nc" data-group-id="0464531479-13">Cldr.LanguageTag</span><span class="p" data-group-id="0464531479-13"><</span><span class="n">nb</span><span class="w"> </span><span class="p" data-group-id="0464531479-14">[</span><span class="n">validated</span><span class="p" data-group-id="0464531479-14">]</span><span class="p" data-group-id="0464531479-13">></span><span class="p">,</span><span class="w"> </span><span class="p" data-group-id="0464531479-15">#</span><span class="nc" data-group-id="0464531479-15">Cldr.LanguageTag</span><span class="p" data-group-id="0464531479-15"><</span><span class="n">no</span><span class="w"> </span><span class="p" data-group-id="0464531479-16">[</span><span class="n">validated</span><span class="p" data-group-id="0464531479-16">]</span><span class="p" data-group-id="0464531479-15">></span><span class="p">,</span><span class="w">
|
||||
</span><span class="p" data-group-id="0464531479-17">#</span><span class="nc" data-group-id="0464531479-17">Cldr.LanguageTag</span><span class="p" data-group-id="0464531479-17"><</span><span class="n">und</span><span class="w"> </span><span class="p" data-group-id="0464531479-18">[</span><span class="n">validated</span><span class="p" data-group-id="0464531479-18">]</span><span class="p" data-group-id="0464531479-17">></span><span class="p" data-group-id="0464531479-12">]</span><span class="p" data-group-id="0464531479-11">}</span></code></pre>
|
||||
</section>
|
||||
</section>
|
||||
<section class="detail" id="locale_for_territory/1">
|
||||
@ -533,15 +533,15 @@ generic top-level domain names.</p><h2 id="locale_from_host/2-examples" class="s
|
||||
<span class="text">Examples</span>
|
||||
</h2>
|
||||
<pre><code class="makeup elixir" translate="no"><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr.Locale</span><span class="o">.</span><span class="n">locale_from_host</span><span class="w"> </span><span class="s">"a.b.com.au"</span><span class="w">
|
||||
</span><span class="nc">Elixir.Plausible.Cldr</span><span class="o">.</span><span class="n">validate_locale</span><span class="p" data-group-id="9529528345-1">(</span><span class="ss">:"en-AU"</span><span class="p" data-group-id="9529528345-1">)</span><span class="w">
|
||||
</span><span class="nc">Elixir.Plausible.Cldr</span><span class="o">.</span><span class="n">validate_locale</span><span class="p" data-group-id="8321345114-1">(</span><span class="ss">:"en-AU"</span><span class="p" data-group-id="8321345114-1">)</span><span class="w">
|
||||
|
||||
</span><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr.Locale</span><span class="o">.</span><span class="n">locale_from_host</span><span class="p" data-group-id="9529528345-2">(</span><span class="s">"a.b.com.tv"</span><span class="p" data-group-id="9529528345-2">)</span><span class="w">
|
||||
</span><span class="p" data-group-id="9529528345-3">{</span><span class="ss">:error</span><span class="p">,</span><span class="w">
|
||||
</span><span class="p" data-group-id="9529528345-4">{</span><span class="nc">Cldr.UnknownLocaleError</span><span class="p">,</span><span class="w"> </span><span class="s">"No locale was identified for territory </span><span class="se">\"</span><span class="s">tv</span><span class="se">\"</span><span class="s">"</span><span class="p" data-group-id="9529528345-4">}</span><span class="p" data-group-id="9529528345-3">}</span><span class="w">
|
||||
</span><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr.Locale</span><span class="o">.</span><span class="n">locale_from_host</span><span class="p" data-group-id="8321345114-2">(</span><span class="s">"a.b.com.tv"</span><span class="p" data-group-id="8321345114-2">)</span><span class="w">
|
||||
</span><span class="p" data-group-id="8321345114-3">{</span><span class="ss">:error</span><span class="p">,</span><span class="w">
|
||||
</span><span class="p" data-group-id="8321345114-4">{</span><span class="nc">Cldr.UnknownLocaleError</span><span class="p">,</span><span class="w"> </span><span class="s">"No locale was identified for territory </span><span class="se">\"</span><span class="s">tv</span><span class="se">\"</span><span class="s">"</span><span class="p" data-group-id="8321345114-4">}</span><span class="p" data-group-id="8321345114-3">}</span><span class="w">
|
||||
|
||||
</span><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr.Locale</span><span class="o">.</span><span class="n">locale_from_host</span><span class="p" data-group-id="9529528345-5">(</span><span class="s">"a.b.com"</span><span class="p" data-group-id="9529528345-5">)</span><span class="w">
|
||||
</span><span class="p" data-group-id="9529528345-6">{</span><span class="ss">:error</span><span class="p">,</span><span class="w">
|
||||
</span><span class="p" data-group-id="9529528345-7">{</span><span class="nc">Cldr.UnknownLocaleError</span><span class="p">,</span><span class="w"> </span><span class="s">"No locale was identified for territory </span><span class="se">\"</span><span class="s">com</span><span class="se">\"</span><span class="s">"</span><span class="p" data-group-id="9529528345-7">}</span><span class="p" data-group-id="9529528345-6">}</span></code></pre>
|
||||
</span><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr.Locale</span><span class="o">.</span><span class="n">locale_from_host</span><span class="p" data-group-id="8321345114-5">(</span><span class="s">"a.b.com"</span><span class="p" data-group-id="8321345114-5">)</span><span class="w">
|
||||
</span><span class="p" data-group-id="8321345114-6">{</span><span class="ss">:error</span><span class="p">,</span><span class="w">
|
||||
</span><span class="p" data-group-id="8321345114-7">{</span><span class="nc">Cldr.UnknownLocaleError</span><span class="p">,</span><span class="w"> </span><span class="s">"No locale was identified for territory </span><span class="se">\"</span><span class="s">com</span><span class="se">\"</span><span class="s">"</span><span class="p" data-group-id="8321345114-7">}</span><span class="p" data-group-id="8321345114-6">}</span></code></pre>
|
||||
</section>
|
||||
</section>
|
||||
<section class="detail" id="new/1">
|
||||
@ -683,12 +683,12 @@ be a territory.</p><h2 id="territory_from_host/1-arguments" class="section-headi
|
||||
</a>
|
||||
<span class="text">Examples</span>
|
||||
</h2>
|
||||
<pre><code class="makeup elixir" translate="no"><span class="gp unselectable">iex> </span><span class="nc">Cldr.Locale</span><span class="o">.</span><span class="n">territory_from_host</span><span class="p" data-group-id="6107014223-1">(</span><span class="s">"a.b.com.au"</span><span class="p" data-group-id="6107014223-1">)</span><span class="w">
|
||||
</span><span class="p" data-group-id="6107014223-2">{</span><span class="ss">:ok</span><span class="p">,</span><span class="w"> </span><span class="ss">:AU</span><span class="p" data-group-id="6107014223-2">}</span><span class="w">
|
||||
<pre><code class="makeup elixir" translate="no"><span class="gp unselectable">iex> </span><span class="nc">Cldr.Locale</span><span class="o">.</span><span class="n">territory_from_host</span><span class="p" data-group-id="7160881383-1">(</span><span class="s">"a.b.com.au"</span><span class="p" data-group-id="7160881383-1">)</span><span class="w">
|
||||
</span><span class="p" data-group-id="7160881383-2">{</span><span class="ss">:ok</span><span class="p">,</span><span class="w"> </span><span class="ss">:AU</span><span class="p" data-group-id="7160881383-2">}</span><span class="w">
|
||||
|
||||
</span><span class="gp unselectable">iex> </span><span class="nc">Cldr.Locale</span><span class="o">.</span><span class="n">territory_from_host</span><span class="p" data-group-id="6107014223-3">(</span><span class="s">"a.b.com"</span><span class="p" data-group-id="6107014223-3">)</span><span class="w">
|
||||
</span><span class="p" data-group-id="6107014223-4">{</span><span class="ss">:error</span><span class="p">,</span><span class="w">
|
||||
</span><span class="p" data-group-id="6107014223-5">{</span><span class="nc">Cldr.UnknownLocaleError</span><span class="p">,</span><span class="w"> </span><span class="s">"No locale was identified for territory </span><span class="se">\"</span><span class="s">com</span><span class="se">\"</span><span class="s">"</span><span class="p" data-group-id="6107014223-5">}</span><span class="p" data-group-id="6107014223-4">}</span></code></pre>
|
||||
</span><span class="gp unselectable">iex> </span><span class="nc">Cldr.Locale</span><span class="o">.</span><span class="n">territory_from_host</span><span class="p" data-group-id="7160881383-3">(</span><span class="s">"a.b.com"</span><span class="p" data-group-id="7160881383-3">)</span><span class="w">
|
||||
</span><span class="p" data-group-id="7160881383-4">{</span><span class="ss">:error</span><span class="p">,</span><span class="w">
|
||||
</span><span class="p" data-group-id="7160881383-5">{</span><span class="nc">Cldr.UnknownLocaleError</span><span class="p">,</span><span class="w"> </span><span class="s">"No locale was identified for territory </span><span class="se">\"</span><span class="s">com</span><span class="se">\"</span><span class="s">"</span><span class="p" data-group-id="7160881383-5">}</span><span class="p" data-group-id="7160881383-4">}</span></code></pre>
|
||||
</section>
|
||||
</section>
|
||||
<section class="detail" id="territory_from_locale/1">
|
||||
|
@ -455,31 +455,31 @@ The valid substitution keys are <code class="inline">:zero</code>, <code class="
|
||||
</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.Cardinal</span><span class="o">.</span><span class="n">pluralize</span><span class="w"> </span><span class="mi">1</span><span class="p">,</span><span class="w"> </span><span class="s">"en"</span><span class="p">,</span><span class="w"> </span><span class="p" data-group-id="9832648377-1">%{</span><span class="ss">one</span><span class="p">:</span><span class="w"> </span><span class="s">"one"</span><span class="p" data-group-id="9832648377-1">}</span><span class="w">
|
||||
<pre><code class="makeup elixir" translate="no"><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr.Number.Cardinal</span><span class="o">.</span><span class="n">pluralize</span><span class="w"> </span><span class="mi">1</span><span class="p">,</span><span class="w"> </span><span class="s">"en"</span><span class="p">,</span><span class="w"> </span><span class="p" data-group-id="6977373515-1">%{</span><span class="ss">one</span><span class="p">:</span><span class="w"> </span><span class="s">"one"</span><span class="p" data-group-id="6977373515-1">}</span><span class="w">
|
||||
</span><span class="s">"one"</span><span class="w">
|
||||
|
||||
</span><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr.Number.Cardinal</span><span class="o">.</span><span class="n">pluralize</span><span class="w"> </span><span class="mi">2</span><span class="p">,</span><span class="w"> </span><span class="s">"en"</span><span class="p">,</span><span class="w"> </span><span class="p" data-group-id="9832648377-2">%{</span><span class="ss">one</span><span class="p">:</span><span class="w"> </span><span class="s">"one"</span><span class="p" data-group-id="9832648377-2">}</span><span class="w">
|
||||
</span><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr.Number.Cardinal</span><span class="o">.</span><span class="n">pluralize</span><span class="w"> </span><span class="mi">2</span><span class="p">,</span><span class="w"> </span><span class="s">"en"</span><span class="p">,</span><span class="w"> </span><span class="p" data-group-id="6977373515-2">%{</span><span class="ss">one</span><span class="p">:</span><span class="w"> </span><span class="s">"one"</span><span class="p" data-group-id="6977373515-2">}</span><span class="w">
|
||||
</span><span class="no">nil</span><span class="w">
|
||||
|
||||
</span><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr.Number.Cardinal</span><span class="o">.</span><span class="n">pluralize</span><span class="w"> </span><span class="mi">2</span><span class="p">,</span><span class="w"> </span><span class="s">"en"</span><span class="p">,</span><span class="w"> </span><span class="p" data-group-id="9832648377-3">%{</span><span class="ss">one</span><span class="p">:</span><span class="w"> </span><span class="s">"one"</span><span class="p">,</span><span class="w"> </span><span class="ss">two</span><span class="p">:</span><span class="w"> </span><span class="s">"two"</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">"other"</span><span class="p" data-group-id="9832648377-3">}</span><span class="w">
|
||||
</span><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr.Number.Cardinal</span><span class="o">.</span><span class="n">pluralize</span><span class="w"> </span><span class="mi">2</span><span class="p">,</span><span class="w"> </span><span class="s">"en"</span><span class="p">,</span><span class="w"> </span><span class="p" data-group-id="6977373515-3">%{</span><span class="ss">one</span><span class="p">:</span><span class="w"> </span><span class="s">"one"</span><span class="p">,</span><span class="w"> </span><span class="ss">two</span><span class="p">:</span><span class="w"> </span><span class="s">"two"</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">"other"</span><span class="p" data-group-id="6977373515-3">}</span><span class="w">
|
||||
</span><span class="s">"other"</span><span class="w">
|
||||
|
||||
</span><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr.Number.Cardinal</span><span class="o">.</span><span class="n">pluralize</span><span class="w"> </span><span class="mi">22</span><span class="p">,</span><span class="w"> </span><span class="s">"en"</span><span class="p">,</span><span class="w"> </span><span class="p" data-group-id="9832648377-4">%{</span><span class="ss">one</span><span class="p">:</span><span class="w"> </span><span class="s">"one"</span><span class="p">,</span><span class="w"> </span><span class="ss">two</span><span class="p">:</span><span class="w"> </span><span class="s">"two"</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">"other"</span><span class="p" data-group-id="9832648377-4">}</span><span class="w">
|
||||
</span><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr.Number.Cardinal</span><span class="o">.</span><span class="n">pluralize</span><span class="w"> </span><span class="mi">22</span><span class="p">,</span><span class="w"> </span><span class="s">"en"</span><span class="p">,</span><span class="w"> </span><span class="p" data-group-id="6977373515-4">%{</span><span class="ss">one</span><span class="p">:</span><span class="w"> </span><span class="s">"one"</span><span class="p">,</span><span class="w"> </span><span class="ss">two</span><span class="p">:</span><span class="w"> </span><span class="s">"two"</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">"other"</span><span class="p" data-group-id="6977373515-4">}</span><span class="w">
|
||||
</span><span class="s">"other"</span><span class="w">
|
||||
|
||||
</span><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr.Number.Cardinal</span><span class="o">.</span><span class="n">pluralize</span><span class="w"> </span><span class="nc">Decimal</span><span class="o">.</span><span class="n">new</span><span class="p" data-group-id="9832648377-5">(</span><span class="mi">1</span><span class="p" data-group-id="9832648377-5">)</span><span class="p">,</span><span class="w"> </span><span class="s">"en"</span><span class="p">,</span><span class="w"> </span><span class="p" data-group-id="9832648377-6">%{</span><span class="ss">one</span><span class="p">:</span><span class="w"> </span><span class="s">"one"</span><span class="p" data-group-id="9832648377-6">}</span><span class="w">
|
||||
</span><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr.Number.Cardinal</span><span class="o">.</span><span class="n">pluralize</span><span class="w"> </span><span class="nc">Decimal</span><span class="o">.</span><span class="n">new</span><span class="p" data-group-id="6977373515-5">(</span><span class="mi">1</span><span class="p" data-group-id="6977373515-5">)</span><span class="p">,</span><span class="w"> </span><span class="s">"en"</span><span class="p">,</span><span class="w"> </span><span class="p" data-group-id="6977373515-6">%{</span><span class="ss">one</span><span class="p">:</span><span class="w"> </span><span class="s">"one"</span><span class="p" data-group-id="6977373515-6">}</span><span class="w">
|
||||
</span><span class="s">"one"</span><span class="w">
|
||||
|
||||
</span><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr.Number.Cardinal</span><span class="o">.</span><span class="n">pluralize</span><span class="w"> </span><span class="nc">Decimal</span><span class="o">.</span><span class="n">new</span><span class="p" data-group-id="9832648377-7">(</span><span class="mi">2</span><span class="p" data-group-id="9832648377-7">)</span><span class="p">,</span><span class="w"> </span><span class="s">"en"</span><span class="p">,</span><span class="w"> </span><span class="p" data-group-id="9832648377-8">%{</span><span class="ss">one</span><span class="p">:</span><span class="w"> </span><span class="s">"one"</span><span class="p" data-group-id="9832648377-8">}</span><span class="w">
|
||||
</span><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr.Number.Cardinal</span><span class="o">.</span><span class="n">pluralize</span><span class="w"> </span><span class="nc">Decimal</span><span class="o">.</span><span class="n">new</span><span class="p" data-group-id="6977373515-7">(</span><span class="mi">2</span><span class="p" data-group-id="6977373515-7">)</span><span class="p">,</span><span class="w"> </span><span class="s">"en"</span><span class="p">,</span><span class="w"> </span><span class="p" data-group-id="6977373515-8">%{</span><span class="ss">one</span><span class="p">:</span><span class="w"> </span><span class="s">"one"</span><span class="p" data-group-id="6977373515-8">}</span><span class="w">
|
||||
</span><span class="no">nil</span><span class="w">
|
||||
|
||||
</span><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr.Number.Cardinal</span><span class="o">.</span><span class="n">pluralize</span><span class="w"> </span><span class="nc">Decimal</span><span class="o">.</span><span class="n">new</span><span class="p" data-group-id="9832648377-9">(</span><span class="mi">2</span><span class="p" data-group-id="9832648377-9">)</span><span class="p">,</span><span class="w"> </span><span class="s">"en"</span><span class="p">,</span><span class="w"> </span><span class="p" data-group-id="9832648377-10">%{</span><span class="ss">one</span><span class="p">:</span><span class="w"> </span><span class="s">"one"</span><span class="p">,</span><span class="w"> </span><span class="ss">two</span><span class="p">:</span><span class="w"> </span><span class="s">"two"</span><span class="p" data-group-id="9832648377-10">}</span><span class="w">
|
||||
</span><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr.Number.Cardinal</span><span class="o">.</span><span class="n">pluralize</span><span class="w"> </span><span class="nc">Decimal</span><span class="o">.</span><span class="n">new</span><span class="p" data-group-id="6977373515-9">(</span><span class="mi">2</span><span class="p" data-group-id="6977373515-9">)</span><span class="p">,</span><span class="w"> </span><span class="s">"en"</span><span class="p">,</span><span class="w"> </span><span class="p" data-group-id="6977373515-10">%{</span><span class="ss">one</span><span class="p">:</span><span class="w"> </span><span class="s">"one"</span><span class="p">,</span><span class="w"> </span><span class="ss">two</span><span class="p">:</span><span class="w"> </span><span class="s">"two"</span><span class="p" data-group-id="6977373515-10">}</span><span class="w">
|
||||
</span><span class="no">nil</span><span class="w">
|
||||
|
||||
</span><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr.Number.Cardinal</span><span class="o">.</span><span class="n">pluralize</span><span class="w"> </span><span class="mi">1</span><span class="o">..</span><span class="mi">10</span><span class="p">,</span><span class="w"> </span><span class="s">"ar"</span><span class="p">,</span><span class="w"> </span><span class="p" data-group-id="9832648377-11">%{</span><span class="ss">one</span><span class="p">:</span><span class="w"> </span><span class="s">"one"</span><span class="p">,</span><span class="w"> </span><span class="ss">few</span><span class="p">:</span><span class="w"> </span><span class="s">"few"</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">"other"</span><span class="p" data-group-id="9832648377-11">}</span><span class="w">
|
||||
</span><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr.Number.Cardinal</span><span class="o">.</span><span class="n">pluralize</span><span class="w"> </span><span class="mi">1</span><span class="o">..</span><span class="mi">10</span><span class="p">,</span><span class="w"> </span><span class="s">"ar"</span><span class="p">,</span><span class="w"> </span><span class="p" data-group-id="6977373515-11">%{</span><span class="ss">one</span><span class="p">:</span><span class="w"> </span><span class="s">"one"</span><span class="p">,</span><span class="w"> </span><span class="ss">few</span><span class="p">:</span><span class="w"> </span><span class="s">"few"</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">"other"</span><span class="p" data-group-id="6977373515-11">}</span><span class="w">
|
||||
</span><span class="s">"few"</span><span class="w">
|
||||
|
||||
</span><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr.Number.Cardinal</span><span class="o">.</span><span class="n">pluralize</span><span class="w"> </span><span class="mi">1</span><span class="o">..</span><span class="mi">10</span><span class="p">,</span><span class="w"> </span><span class="s">"en"</span><span class="p">,</span><span class="w"> </span><span class="p" data-group-id="9832648377-12">%{</span><span class="ss">one</span><span class="p">:</span><span class="w"> </span><span class="s">"one"</span><span class="p">,</span><span class="w"> </span><span class="ss">few</span><span class="p">:</span><span class="w"> </span><span class="s">"few"</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">"other"</span><span class="p" data-group-id="9832648377-12">}</span><span class="w">
|
||||
</span><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr.Number.Cardinal</span><span class="o">.</span><span class="n">pluralize</span><span class="w"> </span><span class="mi">1</span><span class="o">..</span><span class="mi">10</span><span class="p">,</span><span class="w"> </span><span class="s">"en"</span><span class="p">,</span><span class="w"> </span><span class="p" data-group-id="6977373515-12">%{</span><span class="ss">one</span><span class="p">:</span><span class="w"> </span><span class="s">"one"</span><span class="p">,</span><span class="w"> </span><span class="ss">few</span><span class="p">:</span><span class="w"> </span><span class="s">"few"</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">"other"</span><span class="p" data-group-id="6977373515-12">}</span><span class="w">
|
||||
</span><span class="s">"other"</span></code></pre>
|
||||
</section>
|
||||
</section>
|
||||
|
@ -468,7 +468,7 @@ to precompile all the known formats at compile time.</p><h2 id="decimal_format_l
|
||||
<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="9971594222-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="p" data-group-id="2851995485-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">
|
||||
@ -478,7 +478,7 @@ to precompile all the known formats at compile time.</p><h2 id="decimal_format_l
|
||||
</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="9971594222-1">]</span></code></pre>
|
||||
</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="2851995485-1">]</span></code></pre>
|
||||
</section>
|
||||
</section>
|
||||
<section class="detail" id="decimal_format_list_for/1">
|
||||
@ -526,8 +526,8 @@ the known formats at compile time. Its use is not otherwise recommended.</p><h2
|
||||
</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="1413611266-1">(</span><span class="ss">:en</span><span class="p" data-group-id="1413611266-1">)</span><span class="w">
|
||||
</span><span class="p" data-group-id="1413611266-2">{</span><span class="ss">:ok</span><span class="p">,</span><span class="w"> </span><span class="p" data-group-id="1413611266-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">
|
||||
<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="0759452612-1">(</span><span class="ss">:en</span><span class="p" data-group-id="0759452612-1">)</span><span class="w">
|
||||
</span><span class="p" data-group-id="0759452612-2">{</span><span class="ss">:ok</span><span class="p">,</span><span class="w"> </span><span class="p" data-group-id="0759452612-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">
|
||||
@ -535,7 +535,7 @@ the known formats at compile time. Its use is not otherwise recommended.</p><h2
|
||||
</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="1413611266-3">]</span><span class="p" data-group-id="1413611266-2">}</span></code></pre>
|
||||
</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="0759452612-3">]</span><span class="p" data-group-id="0759452612-2">}</span></code></pre>
|
||||
</section>
|
||||
</section>
|
||||
<section class="detail" id="default_grouping_for/1">
|
||||
@ -588,8 +588,8 @@ is <a href="Plausible.Cldr.html#get_locale/0"><code class="inline">Plausible.Cld
|
||||
</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="8444589686-1">(</span><span class="ss">:en</span><span class="p" data-group-id="8444589686-1">)</span><span class="w">
|
||||
</span><span class="p" data-group-id="8444589686-2">{</span><span class="ss">:ok</span><span class="p">,</span><span class="w"> </span><span class="p" data-group-id="8444589686-3">%{</span><span class="ss">fraction</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="8444589686-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="8444589686-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="8444589686-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="8444589686-5">}</span><span class="p" data-group-id="8444589686-3">}</span><span class="p" data-group-id="8444589686-2">}</span></code></pre>
|
||||
<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="9988492144-1">(</span><span class="ss">:en</span><span class="p" data-group-id="9988492144-1">)</span><span class="w">
|
||||
</span><span class="p" data-group-id="9988492144-2">{</span><span class="ss">:ok</span><span class="p">,</span><span class="w"> </span><span class="p" data-group-id="9988492144-3">%{</span><span class="ss">fraction</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="9988492144-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="9988492144-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="9988492144-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="9988492144-5">}</span><span class="p" data-group-id="9988492144-3">}</span><span class="p" data-group-id="9988492144-2">}</span></code></pre>
|
||||
</section>
|
||||
</section>
|
||||
<section class="detail" id="default_grouping_for!/1">
|
||||
@ -641,8 +641,8 @@ is <a href="Plausible.Cldr.html#get_locale/0"><code class="inline">Plausible.Cld
|
||||
</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="5430968445-1">(</span><span class="ss">:en</span><span class="p" data-group-id="5430968445-1">)</span><span class="w">
|
||||
</span><span class="p" data-group-id="5430968445-2">%{</span><span class="ss">fraction</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="5430968445-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="5430968445-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="5430968445-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="5430968445-4">}</span><span class="p" data-group-id="5430968445-2">}</span></code></pre>
|
||||
<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="0691143056-1">(</span><span class="ss">:en</span><span class="p" data-group-id="0691143056-1">)</span><span class="w">
|
||||
</span><span class="p" data-group-id="0691143056-2">%{</span><span class="ss">fraction</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="0691143056-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="0691143056-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="0691143056-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="0691143056-4">}</span><span class="p" data-group-id="0691143056-2">}</span></code></pre>
|
||||
</section>
|
||||
</section>
|
||||
<section class="detail" id="formats_for/2">
|
||||
@ -699,18 +699,18 @@ by <a href="Plausible.Cldr.Number.System.html#number_systems_for/1"><code class=
|
||||
</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="6649963929-1">[</span><span class="p" data-group-id="6649963929-2">{</span><span class="s">"1000"</span><span class="p">,</span><span class="w"> </span><span class="p" data-group-id="6649963929-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="6649963929-3">]</span><span class="p" data-group-id="6649963929-2">}</span><span class="p">,</span><span class="w">
|
||||
</span><span class="p" data-group-id="6649963929-4">{</span><span class="s">"10000"</span><span class="p">,</span><span class="w"> </span><span class="p" data-group-id="6649963929-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="6649963929-5">]</span><span class="p" data-group-id="6649963929-4">}</span><span class="p">,</span><span class="w">
|
||||
</span><span class="p" data-group-id="6649963929-6">{</span><span class="s">"100000"</span><span class="p">,</span><span class="w"> </span><span class="p" data-group-id="6649963929-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="6649963929-7">]</span><span class="p" data-group-id="6649963929-6">}</span><span class="p">,</span><span class="w">
|
||||
</span><span class="p" data-group-id="6649963929-8">{</span><span class="s">"1000000"</span><span class="p">,</span><span class="w"> </span><span class="p" data-group-id="6649963929-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="6649963929-9">]</span><span class="p" data-group-id="6649963929-8">}</span><span class="p">,</span><span class="w">
|
||||
</span><span class="p" data-group-id="6649963929-10">{</span><span class="s">"10000000"</span><span class="p">,</span><span class="w"> </span><span class="p" data-group-id="6649963929-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="6649963929-11">]</span><span class="p" data-group-id="6649963929-10">}</span><span class="p">,</span><span class="w">
|
||||
</span><span class="p" data-group-id="6649963929-12">{</span><span class="s">"100000000"</span><span class="p">,</span><span class="w"> </span><span class="p" data-group-id="6649963929-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="6649963929-13">]</span><span class="p" data-group-id="6649963929-12">}</span><span class="p">,</span><span class="w">
|
||||
</span><span class="p" data-group-id="6649963929-14">{</span><span class="s">"1000000000"</span><span class="p">,</span><span class="w"> </span><span class="p" data-group-id="6649963929-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="6649963929-15">]</span><span class="p" data-group-id="6649963929-14">}</span><span class="p">,</span><span class="w">
|
||||
</span><span class="p" data-group-id="6649963929-16">{</span><span class="s">"10000000000"</span><span class="p">,</span><span class="w"> </span><span class="p" data-group-id="6649963929-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="6649963929-17">]</span><span class="p" data-group-id="6649963929-16">}</span><span class="p">,</span><span class="w">
|
||||
</span><span class="p" data-group-id="6649963929-18">{</span><span class="s">"100000000000"</span><span class="p">,</span><span class="w"> </span><span class="p" data-group-id="6649963929-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="6649963929-19">]</span><span class="p" data-group-id="6649963929-18">}</span><span class="p">,</span><span class="w">
|
||||
</span><span class="p" data-group-id="6649963929-20">{</span><span class="s">"1000000000000"</span><span class="p">,</span><span class="w"> </span><span class="p" data-group-id="6649963929-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="6649963929-21">]</span><span class="p" data-group-id="6649963929-20">}</span><span class="p">,</span><span class="w">
|
||||
</span><span class="p" data-group-id="6649963929-22">{</span><span class="s">"10000000000000"</span><span class="p">,</span><span class="w"> </span><span class="p" data-group-id="6649963929-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="6649963929-23">]</span><span class="p" data-group-id="6649963929-22">}</span><span class="p">,</span><span class="w">
|
||||
</span><span class="p" data-group-id="6649963929-24">{</span><span class="s">"100000000000000"</span><span class="p">,</span><span class="w"> </span><span class="p" data-group-id="6649963929-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="6649963929-25">]</span><span class="p" data-group-id="6649963929-24">}</span><span class="p" data-group-id="6649963929-1">]</span><span class="p">,</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="0671852607-1">[</span><span class="p" data-group-id="0671852607-2">{</span><span class="s">"1000"</span><span class="p">,</span><span class="w"> </span><span class="p" data-group-id="0671852607-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="0671852607-3">]</span><span class="p" data-group-id="0671852607-2">}</span><span class="p">,</span><span class="w">
|
||||
</span><span class="p" data-group-id="0671852607-4">{</span><span class="s">"10000"</span><span class="p">,</span><span class="w"> </span><span class="p" data-group-id="0671852607-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="0671852607-5">]</span><span class="p" data-group-id="0671852607-4">}</span><span class="p">,</span><span class="w">
|
||||
</span><span class="p" data-group-id="0671852607-6">{</span><span class="s">"100000"</span><span class="p">,</span><span class="w"> </span><span class="p" data-group-id="0671852607-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="0671852607-7">]</span><span class="p" data-group-id="0671852607-6">}</span><span class="p">,</span><span class="w">
|
||||
</span><span class="p" data-group-id="0671852607-8">{</span><span class="s">"1000000"</span><span class="p">,</span><span class="w"> </span><span class="p" data-group-id="0671852607-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="0671852607-9">]</span><span class="p" data-group-id="0671852607-8">}</span><span class="p">,</span><span class="w">
|
||||
</span><span class="p" data-group-id="0671852607-10">{</span><span class="s">"10000000"</span><span class="p">,</span><span class="w"> </span><span class="p" data-group-id="0671852607-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="0671852607-11">]</span><span class="p" data-group-id="0671852607-10">}</span><span class="p">,</span><span class="w">
|
||||
</span><span class="p" data-group-id="0671852607-12">{</span><span class="s">"100000000"</span><span class="p">,</span><span class="w"> </span><span class="p" data-group-id="0671852607-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="0671852607-13">]</span><span class="p" data-group-id="0671852607-12">}</span><span class="p">,</span><span class="w">
|
||||
</span><span class="p" data-group-id="0671852607-14">{</span><span class="s">"1000000000"</span><span class="p">,</span><span class="w"> </span><span class="p" data-group-id="0671852607-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="0671852607-15">]</span><span class="p" data-group-id="0671852607-14">}</span><span class="p">,</span><span class="w">
|
||||
</span><span class="p" data-group-id="0671852607-16">{</span><span class="s">"10000000000"</span><span class="p">,</span><span class="w"> </span><span class="p" data-group-id="0671852607-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="0671852607-17">]</span><span class="p" data-group-id="0671852607-16">}</span><span class="p">,</span><span class="w">
|
||||
</span><span class="p" data-group-id="0671852607-18">{</span><span class="s">"100000000000"</span><span class="p">,</span><span class="w"> </span><span class="p" data-group-id="0671852607-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="0671852607-19">]</span><span class="p" data-group-id="0671852607-18">}</span><span class="p">,</span><span class="w">
|
||||
</span><span class="p" data-group-id="0671852607-20">{</span><span class="s">"1000000000000"</span><span class="p">,</span><span class="w"> </span><span class="p" data-group-id="0671852607-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="0671852607-21">]</span><span class="p" data-group-id="0671852607-20">}</span><span class="p">,</span><span class="w">
|
||||
</span><span class="p" data-group-id="0671852607-22">{</span><span class="s">"10000000000000"</span><span class="p">,</span><span class="w"> </span><span class="p" data-group-id="0671852607-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="0671852607-23">]</span><span class="p" data-group-id="0671852607-22">}</span><span class="p">,</span><span class="w">
|
||||
</span><span class="p" data-group-id="0671852607-24">{</span><span class="s">"100000000000000"</span><span class="p">,</span><span class="w"> </span><span class="p" data-group-id="0671852607-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="0671852607-25">]</span><span class="p" data-group-id="0671852607-24">}</span><span class="p" data-group-id="0671852607-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>
|
||||
@ -801,8 +801,8 @@ is <a href="Plausible.Cldr.html#get_locale/0"><code class="inline">Plausible.Cld
|
||||
</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="8593925552-1">(</span><span class="s">"en"</span><span class="p" data-group-id="8593925552-1">)</span><span class="w">
|
||||
</span><span class="p" data-group-id="8593925552-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="8593925552-2">}</span></code></pre>
|
||||
<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="2340048099-1">(</span><span class="s">"en"</span><span class="p" data-group-id="2340048099-1">)</span><span class="w">
|
||||
</span><span class="p" data-group-id="2340048099-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="2340048099-2">}</span></code></pre>
|
||||
</section>
|
||||
</section>
|
||||
<section class="detail" id="minimum_grouping_digits_for!/1">
|
||||
@ -854,7 +854,7 @@ is <a href="Plausible.Cldr.html#get_locale/0"><code class="inline">Plausible.Cld
|
||||
</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="1988329318-1">(</span><span class="s">"en"</span><span class="p" data-group-id="1988329318-1">)</span><span class="w">
|
||||
<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="8923366797-1">(</span><span class="s">"en"</span><span class="p" data-group-id="8923366797-1">)</span><span class="w">
|
||||
</span><span class="mi">1</span></code></pre>
|
||||
</section>
|
||||
</section>
|
||||
|
@ -458,31 +458,31 @@ The valid substitution keys are <code class="inline">:zero</code>, <code class="
|
||||
</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.Ordinal</span><span class="o">.</span><span class="n">pluralize</span><span class="w"> </span><span class="mi">1</span><span class="p">,</span><span class="w"> </span><span class="ss">:en</span><span class="p">,</span><span class="w"> </span><span class="p" data-group-id="9384714843-1">%{</span><span class="ss">one</span><span class="p">:</span><span class="w"> </span><span class="s">"one"</span><span class="p" data-group-id="9384714843-1">}</span><span class="w">
|
||||
<pre><code class="makeup elixir" translate="no"><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr.Number.Ordinal</span><span class="o">.</span><span class="n">pluralize</span><span class="w"> </span><span class="mi">1</span><span class="p">,</span><span class="w"> </span><span class="ss">:en</span><span class="p">,</span><span class="w"> </span><span class="p" data-group-id="7176247129-1">%{</span><span class="ss">one</span><span class="p">:</span><span class="w"> </span><span class="s">"one"</span><span class="p" data-group-id="7176247129-1">}</span><span class="w">
|
||||
</span><span class="s">"one"</span><span class="w">
|
||||
|
||||
</span><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr.Number.Ordinal</span><span class="o">.</span><span class="n">pluralize</span><span class="w"> </span><span class="mi">2</span><span class="p">,</span><span class="w"> </span><span class="ss">:en</span><span class="p">,</span><span class="w"> </span><span class="p" data-group-id="9384714843-2">%{</span><span class="ss">one</span><span class="p">:</span><span class="w"> </span><span class="s">"one"</span><span class="p" data-group-id="9384714843-2">}</span><span class="w">
|
||||
</span><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr.Number.Ordinal</span><span class="o">.</span><span class="n">pluralize</span><span class="w"> </span><span class="mi">2</span><span class="p">,</span><span class="w"> </span><span class="ss">:en</span><span class="p">,</span><span class="w"> </span><span class="p" data-group-id="7176247129-2">%{</span><span class="ss">one</span><span class="p">:</span><span class="w"> </span><span class="s">"one"</span><span class="p" data-group-id="7176247129-2">}</span><span class="w">
|
||||
</span><span class="no">nil</span><span class="w">
|
||||
|
||||
</span><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr.Number.Ordinal</span><span class="o">.</span><span class="n">pluralize</span><span class="w"> </span><span class="mi">2</span><span class="p">,</span><span class="w"> </span><span class="ss">:en</span><span class="p">,</span><span class="w"> </span><span class="p" data-group-id="9384714843-3">%{</span><span class="ss">one</span><span class="p">:</span><span class="w"> </span><span class="s">"one"</span><span class="p">,</span><span class="w"> </span><span class="ss">two</span><span class="p">:</span><span class="w"> </span><span class="s">"two"</span><span class="p" data-group-id="9384714843-3">}</span><span class="w">
|
||||
</span><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr.Number.Ordinal</span><span class="o">.</span><span class="n">pluralize</span><span class="w"> </span><span class="mi">2</span><span class="p">,</span><span class="w"> </span><span class="ss">:en</span><span class="p">,</span><span class="w"> </span><span class="p" data-group-id="7176247129-3">%{</span><span class="ss">one</span><span class="p">:</span><span class="w"> </span><span class="s">"one"</span><span class="p">,</span><span class="w"> </span><span class="ss">two</span><span class="p">:</span><span class="w"> </span><span class="s">"two"</span><span class="p" data-group-id="7176247129-3">}</span><span class="w">
|
||||
</span><span class="s">"two"</span><span class="w">
|
||||
|
||||
</span><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr.Number.Ordinal</span><span class="o">.</span><span class="n">pluralize</span><span class="w"> </span><span class="mi">22</span><span class="p">,</span><span class="w"> </span><span class="ss">:en</span><span class="p">,</span><span class="w"> </span><span class="p" data-group-id="9384714843-4">%{</span><span class="ss">one</span><span class="p">:</span><span class="w"> </span><span class="s">"one"</span><span class="p">,</span><span class="w"> </span><span class="ss">two</span><span class="p">:</span><span class="w"> </span><span class="s">"two"</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">"other"</span><span class="p" data-group-id="9384714843-4">}</span><span class="w">
|
||||
</span><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr.Number.Ordinal</span><span class="o">.</span><span class="n">pluralize</span><span class="w"> </span><span class="mi">22</span><span class="p">,</span><span class="w"> </span><span class="ss">:en</span><span class="p">,</span><span class="w"> </span><span class="p" data-group-id="7176247129-4">%{</span><span class="ss">one</span><span class="p">:</span><span class="w"> </span><span class="s">"one"</span><span class="p">,</span><span class="w"> </span><span class="ss">two</span><span class="p">:</span><span class="w"> </span><span class="s">"two"</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">"other"</span><span class="p" data-group-id="7176247129-4">}</span><span class="w">
|
||||
</span><span class="s">"two"</span><span class="w">
|
||||
|
||||
</span><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr.Number.Ordinal</span><span class="o">.</span><span class="n">pluralize</span><span class="w"> </span><span class="nc">Decimal</span><span class="o">.</span><span class="n">new</span><span class="p" data-group-id="9384714843-5">(</span><span class="mi">1</span><span class="p" data-group-id="9384714843-5">)</span><span class="p">,</span><span class="w"> </span><span class="ss">:en</span><span class="p">,</span><span class="w"> </span><span class="p" data-group-id="9384714843-6">%{</span><span class="ss">one</span><span class="p">:</span><span class="w"> </span><span class="s">"one"</span><span class="p" data-group-id="9384714843-6">}</span><span class="w">
|
||||
</span><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr.Number.Ordinal</span><span class="o">.</span><span class="n">pluralize</span><span class="w"> </span><span class="nc">Decimal</span><span class="o">.</span><span class="n">new</span><span class="p" data-group-id="7176247129-5">(</span><span class="mi">1</span><span class="p" data-group-id="7176247129-5">)</span><span class="p">,</span><span class="w"> </span><span class="ss">:en</span><span class="p">,</span><span class="w"> </span><span class="p" data-group-id="7176247129-6">%{</span><span class="ss">one</span><span class="p">:</span><span class="w"> </span><span class="s">"one"</span><span class="p" data-group-id="7176247129-6">}</span><span class="w">
|
||||
</span><span class="s">"one"</span><span class="w">
|
||||
|
||||
</span><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr.Number.Ordinal</span><span class="o">.</span><span class="n">pluralize</span><span class="w"> </span><span class="nc">Decimal</span><span class="o">.</span><span class="n">new</span><span class="p" data-group-id="9384714843-7">(</span><span class="mi">2</span><span class="p" data-group-id="9384714843-7">)</span><span class="p">,</span><span class="w"> </span><span class="ss">:en</span><span class="p">,</span><span class="w"> </span><span class="p" data-group-id="9384714843-8">%{</span><span class="ss">one</span><span class="p">:</span><span class="w"> </span><span class="s">"one"</span><span class="p" data-group-id="9384714843-8">}</span><span class="w">
|
||||
</span><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr.Number.Ordinal</span><span class="o">.</span><span class="n">pluralize</span><span class="w"> </span><span class="nc">Decimal</span><span class="o">.</span><span class="n">new</span><span class="p" data-group-id="7176247129-7">(</span><span class="mi">2</span><span class="p" data-group-id="7176247129-7">)</span><span class="p">,</span><span class="w"> </span><span class="ss">:en</span><span class="p">,</span><span class="w"> </span><span class="p" data-group-id="7176247129-8">%{</span><span class="ss">one</span><span class="p">:</span><span class="w"> </span><span class="s">"one"</span><span class="p" data-group-id="7176247129-8">}</span><span class="w">
|
||||
</span><span class="no">nil</span><span class="w">
|
||||
|
||||
</span><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr.Number.Ordinal</span><span class="o">.</span><span class="n">pluralize</span><span class="w"> </span><span class="nc">Decimal</span><span class="o">.</span><span class="n">new</span><span class="p" data-group-id="9384714843-9">(</span><span class="mi">2</span><span class="p" data-group-id="9384714843-9">)</span><span class="p">,</span><span class="w"> </span><span class="ss">:en</span><span class="p">,</span><span class="w"> </span><span class="p" data-group-id="9384714843-10">%{</span><span class="ss">one</span><span class="p">:</span><span class="w"> </span><span class="s">"one"</span><span class="p">,</span><span class="w"> </span><span class="ss">two</span><span class="p">:</span><span class="w"> </span><span class="s">"two"</span><span class="p" data-group-id="9384714843-10">}</span><span class="w">
|
||||
</span><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr.Number.Ordinal</span><span class="o">.</span><span class="n">pluralize</span><span class="w"> </span><span class="nc">Decimal</span><span class="o">.</span><span class="n">new</span><span class="p" data-group-id="7176247129-9">(</span><span class="mi">2</span><span class="p" data-group-id="7176247129-9">)</span><span class="p">,</span><span class="w"> </span><span class="ss">:en</span><span class="p">,</span><span class="w"> </span><span class="p" data-group-id="7176247129-10">%{</span><span class="ss">one</span><span class="p">:</span><span class="w"> </span><span class="s">"one"</span><span class="p">,</span><span class="w"> </span><span class="ss">two</span><span class="p">:</span><span class="w"> </span><span class="s">"two"</span><span class="p" data-group-id="7176247129-10">}</span><span class="w">
|
||||
</span><span class="s">"two"</span><span class="w">
|
||||
|
||||
</span><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr.Number.Ordinal</span><span class="o">.</span><span class="n">pluralize</span><span class="w"> </span><span class="mi">1</span><span class="o">..</span><span class="mi">10</span><span class="p">,</span><span class="w"> </span><span class="s">"ar"</span><span class="p">,</span><span class="w"> </span><span class="p" data-group-id="9384714843-11">%{</span><span class="ss">one</span><span class="p">:</span><span class="w"> </span><span class="s">"one"</span><span class="p">,</span><span class="w"> </span><span class="ss">few</span><span class="p">:</span><span class="w"> </span><span class="s">"few"</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">"other"</span><span class="p" data-group-id="9384714843-11">}</span><span class="w">
|
||||
</span><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr.Number.Ordinal</span><span class="o">.</span><span class="n">pluralize</span><span class="w"> </span><span class="mi">1</span><span class="o">..</span><span class="mi">10</span><span class="p">,</span><span class="w"> </span><span class="s">"ar"</span><span class="p">,</span><span class="w"> </span><span class="p" data-group-id="7176247129-11">%{</span><span class="ss">one</span><span class="p">:</span><span class="w"> </span><span class="s">"one"</span><span class="p">,</span><span class="w"> </span><span class="ss">few</span><span class="p">:</span><span class="w"> </span><span class="s">"few"</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">"other"</span><span class="p" data-group-id="7176247129-11">}</span><span class="w">
|
||||
</span><span class="s">"other"</span><span class="w">
|
||||
|
||||
</span><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr.Number.Ordinal</span><span class="o">.</span><span class="n">pluralize</span><span class="w"> </span><span class="mi">1</span><span class="o">..</span><span class="mi">10</span><span class="p">,</span><span class="w"> </span><span class="s">"en"</span><span class="p">,</span><span class="w"> </span><span class="p" data-group-id="9384714843-12">%{</span><span class="ss">one</span><span class="p">:</span><span class="w"> </span><span class="s">"one"</span><span class="p">,</span><span class="w"> </span><span class="ss">few</span><span class="p">:</span><span class="w"> </span><span class="s">"few"</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">"other"</span><span class="p" data-group-id="9384714843-12">}</span><span class="w">
|
||||
</span><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr.Number.Ordinal</span><span class="o">.</span><span class="n">pluralize</span><span class="w"> </span><span class="mi">1</span><span class="o">..</span><span class="mi">10</span><span class="p">,</span><span class="w"> </span><span class="s">"en"</span><span class="p">,</span><span class="w"> </span><span class="p" data-group-id="7176247129-12">%{</span><span class="ss">one</span><span class="p">:</span><span class="w"> </span><span class="s">"one"</span><span class="p">,</span><span class="w"> </span><span class="ss">few</span><span class="p">:</span><span class="w"> </span><span class="s">"few"</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">"other"</span><span class="p" data-group-id="7176247129-12">}</span><span class="w">
|
||||
</span><span class="s">"other"</span></code></pre>
|
||||
</section>
|
||||
</section>
|
||||
|
@ -378,9 +378,9 @@ is <a href="Plausible.Cldr.html#get_locale/0"><code class="inline">Plausible.Cld
|
||||
</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.Symbol</span><span class="o">.</span><span class="n">number_symbols_for</span><span class="p" data-group-id="8240393194-1">(</span><span class="ss">:th</span><span class="p" data-group-id="8240393194-1">)</span><span class="w">
|
||||
</span><span class="p" data-group-id="8240393194-2">{</span><span class="ss">:ok</span><span class="p">,</span><span class="w"> </span><span class="p" data-group-id="8240393194-3">%{</span><span class="w">
|
||||
</span><span class="ss">latn</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="8240393194-4">%</span><span class="nc" data-group-id="8240393194-4">Cldr.Number.Symbol</span><span class="p" data-group-id="8240393194-4">{</span><span class="w">
|
||||
<pre><code class="makeup elixir" translate="no"><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr.Number.Symbol</span><span class="o">.</span><span class="n">number_symbols_for</span><span class="p" data-group-id="9389691542-1">(</span><span class="ss">:th</span><span class="p" data-group-id="9389691542-1">)</span><span class="w">
|
||||
</span><span class="p" data-group-id="9389691542-2">{</span><span class="ss">:ok</span><span class="p">,</span><span class="w"> </span><span class="p" data-group-id="9389691542-3">%{</span><span class="w">
|
||||
</span><span class="ss">latn</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="9389691542-4">%</span><span class="nc" data-group-id="9389691542-4">Cldr.Number.Symbol</span><span class="p" data-group-id="9389691542-4">{</span><span class="w">
|
||||
</span><span class="ss">decimal</span><span class="p">:</span><span class="w"> </span><span class="s">"."</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">exponential</span><span class="p">:</span><span class="w"> </span><span class="s">"E"</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">group</span><span class="p">:</span><span class="w"> </span><span class="s">","</span><span class="p">,</span><span class="w">
|
||||
@ -393,8 +393,8 @@ is <a href="Plausible.Cldr.html#get_locale/0"><code class="inline">Plausible.Cld
|
||||
</span><span class="ss">plus_sign</span><span class="p">:</span><span class="w"> </span><span class="s">"+"</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">superscripting_exponent</span><span class="p">:</span><span class="w"> </span><span class="s">"×"</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">time_separator</span><span class="p">:</span><span class="w"> </span><span class="s">":"</span><span class="w">
|
||||
</span><span class="p" data-group-id="8240393194-4">}</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">thai</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="8240393194-5">%</span><span class="nc" data-group-id="8240393194-5">Cldr.Number.Symbol</span><span class="p" data-group-id="8240393194-5">{</span><span class="w">
|
||||
</span><span class="p" data-group-id="9389691542-4">}</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">thai</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="9389691542-5">%</span><span class="nc" data-group-id="9389691542-5">Cldr.Number.Symbol</span><span class="p" data-group-id="9389691542-5">{</span><span class="w">
|
||||
</span><span class="ss">decimal</span><span class="p">:</span><span class="w"> </span><span class="s">"."</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">exponential</span><span class="p">:</span><span class="w"> </span><span class="s">"E"</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">group</span><span class="p">:</span><span class="w"> </span><span class="s">","</span><span class="p">,</span><span class="w">
|
||||
@ -407,8 +407,8 @@ is <a href="Plausible.Cldr.html#get_locale/0"><code class="inline">Plausible.Cld
|
||||
</span><span class="ss">plus_sign</span><span class="p">:</span><span class="w"> </span><span class="s">"+"</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">superscripting_exponent</span><span class="p">:</span><span class="w"> </span><span class="s">"×"</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">time_separator</span><span class="p">:</span><span class="w"> </span><span class="s">":"</span><span class="w">
|
||||
</span><span class="p" data-group-id="8240393194-5">}</span><span class="w">
|
||||
</span><span class="p" data-group-id="8240393194-3">}</span><span class="p" data-group-id="8240393194-2">}</span></code></pre>
|
||||
</span><span class="p" data-group-id="9389691542-5">}</span><span class="w">
|
||||
</span><span class="p" data-group-id="9389691542-3">}</span><span class="p" data-group-id="9389691542-2">}</span></code></pre>
|
||||
</section>
|
||||
</section>
|
||||
<section class="detail" id="number_symbols_for/2">
|
||||
|
@ -317,23 +317,23 @@ it is returned as is.</p><h2 id="number_system_for/2-examples" class="section-he
|
||||
<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.System</span><span class="o">.</span><span class="n">number_system_for</span><span class="w"> </span><span class="s">"th"</span><span class="p">,</span><span class="w"> </span><span class="ss">:latn</span><span class="w">
|
||||
</span><span class="p" data-group-id="5829850709-1">{</span><span class="ss">:ok</span><span class="p">,</span><span class="w"> </span><span class="p" data-group-id="5829850709-2">%{</span><span class="ss">digits</span><span class="p">:</span><span class="w"> </span><span class="s">"0123456789"</span><span class="p">,</span><span class="w"> </span><span class="ss">type</span><span class="p">:</span><span class="w"> </span><span class="ss">:numeric</span><span class="p" data-group-id="5829850709-2">}</span><span class="p" data-group-id="5829850709-1">}</span><span class="w">
|
||||
</span><span class="p" data-group-id="4453861569-1">{</span><span class="ss">:ok</span><span class="p">,</span><span class="w"> </span><span class="p" data-group-id="4453861569-2">%{</span><span class="ss">digits</span><span class="p">:</span><span class="w"> </span><span class="s">"0123456789"</span><span class="p">,</span><span class="w"> </span><span class="ss">type</span><span class="p">:</span><span class="w"> </span><span class="ss">:numeric</span><span class="p" data-group-id="4453861569-2">}</span><span class="p" data-group-id="4453861569-1">}</span><span class="w">
|
||||
|
||||
</span><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr.Number.System</span><span class="o">.</span><span class="n">number_system_for</span><span class="w"> </span><span class="s">"en"</span><span class="p">,</span><span class="w"> </span><span class="ss">:default</span><span class="w">
|
||||
</span><span class="p" data-group-id="5829850709-3">{</span><span class="ss">:ok</span><span class="p">,</span><span class="w"> </span><span class="p" data-group-id="5829850709-4">%{</span><span class="ss">digits</span><span class="p">:</span><span class="w"> </span><span class="s">"0123456789"</span><span class="p">,</span><span class="w"> </span><span class="ss">type</span><span class="p">:</span><span class="w"> </span><span class="ss">:numeric</span><span class="p" data-group-id="5829850709-4">}</span><span class="p" data-group-id="5829850709-3">}</span><span class="w">
|
||||
</span><span class="p" data-group-id="4453861569-3">{</span><span class="ss">:ok</span><span class="p">,</span><span class="w"> </span><span class="p" data-group-id="4453861569-4">%{</span><span class="ss">digits</span><span class="p">:</span><span class="w"> </span><span class="s">"0123456789"</span><span class="p">,</span><span class="w"> </span><span class="ss">type</span><span class="p">:</span><span class="w"> </span><span class="ss">:numeric</span><span class="p" data-group-id="4453861569-4">}</span><span class="p" data-group-id="4453861569-3">}</span><span class="w">
|
||||
|
||||
</span><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr.Number.System</span><span class="o">.</span><span class="n">number_system_for</span><span class="w"> </span><span class="s">"he"</span><span class="p">,</span><span class="w"> </span><span class="ss">:traditional</span><span class="w">
|
||||
</span><span class="p" data-group-id="5829850709-5">{</span><span class="ss">:ok</span><span class="p">,</span><span class="w"> </span><span class="p" data-group-id="5829850709-6">%{</span><span class="ss">rules</span><span class="p">:</span><span class="w"> </span><span class="s">"hebrew"</span><span class="p">,</span><span class="w"> </span><span class="ss">type</span><span class="p">:</span><span class="w"> </span><span class="ss">:algorithmic</span><span class="p" data-group-id="5829850709-6">}</span><span class="p" data-group-id="5829850709-5">}</span><span class="w">
|
||||
</span><span class="p" data-group-id="4453861569-5">{</span><span class="ss">:ok</span><span class="p">,</span><span class="w"> </span><span class="p" data-group-id="4453861569-6">%{</span><span class="ss">rules</span><span class="p">:</span><span class="w"> </span><span class="s">"hebrew"</span><span class="p">,</span><span class="w"> </span><span class="ss">type</span><span class="p">:</span><span class="w"> </span><span class="ss">:algorithmic</span><span class="p" data-group-id="4453861569-6">}</span><span class="p" data-group-id="4453861569-5">}</span><span class="w">
|
||||
|
||||
</span><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr.Number.System</span><span class="o">.</span><span class="n">number_system_for</span><span class="w"> </span><span class="s">"en"</span><span class="p">,</span><span class="w"> </span><span class="ss">:native</span><span class="w">
|
||||
</span><span class="p" data-group-id="5829850709-7">{</span><span class="ss">:ok</span><span class="p">,</span><span class="w"> </span><span class="p" data-group-id="5829850709-8">%{</span><span class="ss">digits</span><span class="p">:</span><span class="w"> </span><span class="s">"0123456789"</span><span class="p">,</span><span class="w"> </span><span class="ss">type</span><span class="p">:</span><span class="w"> </span><span class="ss">:numeric</span><span class="p" data-group-id="5829850709-8">}</span><span class="p" data-group-id="5829850709-7">}</span><span class="w">
|
||||
</span><span class="p" data-group-id="4453861569-7">{</span><span class="ss">:ok</span><span class="p">,</span><span class="w"> </span><span class="p" data-group-id="4453861569-8">%{</span><span class="ss">digits</span><span class="p">:</span><span class="w"> </span><span class="s">"0123456789"</span><span class="p">,</span><span class="w"> </span><span class="ss">type</span><span class="p">:</span><span class="w"> </span><span class="ss">:numeric</span><span class="p" data-group-id="4453861569-8">}</span><span class="p" data-group-id="4453861569-7">}</span><span class="w">
|
||||
|
||||
</span><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr.Number.System</span><span class="o">.</span><span class="n">number_system_for</span><span class="w"> </span><span class="s">"en"</span><span class="p">,</span><span class="w"> </span><span class="ss">:finance</span><span class="w">
|
||||
</span><span class="p" data-group-id="5829850709-9">{</span><span class="w">
|
||||
</span><span class="p" data-group-id="4453861569-9">{</span><span class="w">
|
||||
</span><span class="ss">:error</span><span class="p">,</span><span class="w">
|
||||
</span><span class="p" data-group-id="5829850709-10">{</span><span class="nc">Cldr.UnknownNumberSystemError</span><span class="p">,</span><span class="w">
|
||||
</span><span class="s">"The number system :finance is unknown for the locale named :en. Valid number systems are %{default: :latn, native: :latn}"</span><span class="p" data-group-id="5829850709-10">}</span><span class="w">
|
||||
</span><span class="p" data-group-id="5829850709-9">}</span></code></pre>
|
||||
</span><span class="p" data-group-id="4453861569-10">{</span><span class="nc">Cldr.UnknownNumberSystemError</span><span class="p">,</span><span class="w">
|
||||
</span><span class="s">"The number system :finance is unknown for the locale named :en. Valid number systems are %{default: :latn, native: :latn}"</span><span class="p" data-group-id="4453861569-10">}</span><span class="w">
|
||||
</span><span class="p" data-group-id="4453861569-9">}</span></code></pre>
|
||||
</section>
|
||||
</section>
|
||||
<section class="detail" id="number_system_from_locale/1">
|
||||
@ -424,10 +424,10 @@ or a <a href="https://hexdocs.pm/ex_cldr/2.37.5/Cldr.LanguageTag.html"><code cla
|
||||
<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.System</span><span class="o">.</span><span class="n">number_system_names_for</span><span class="w"> </span><span class="s">"en"</span><span class="w">
|
||||
</span><span class="p" data-group-id="1723336926-1">{</span><span class="ss">:ok</span><span class="p">,</span><span class="w"> </span><span class="p" data-group-id="1723336926-2">[</span><span class="ss">:latn</span><span class="p" data-group-id="1723336926-2">]</span><span class="p" data-group-id="1723336926-1">}</span><span class="w">
|
||||
</span><span class="p" data-group-id="4665697394-1">{</span><span class="ss">:ok</span><span class="p">,</span><span class="w"> </span><span class="p" data-group-id="4665697394-2">[</span><span class="ss">:latn</span><span class="p" data-group-id="4665697394-2">]</span><span class="p" data-group-id="4665697394-1">}</span><span class="w">
|
||||
|
||||
</span><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr.Number.System</span><span class="o">.</span><span class="n">number_system_names_for</span><span class="w"> </span><span class="s">"zz"</span><span class="w">
|
||||
</span><span class="p" data-group-id="1723336926-3">{</span><span class="ss">:error</span><span class="p">,</span><span class="w"> </span><span class="p" data-group-id="1723336926-4">{</span><span class="nc">Cldr.InvalidLanguageError</span><span class="p">,</span><span class="w"> </span><span class="s">"The language </span><span class="se">\"</span><span class="s">zz</span><span class="se">\"</span><span class="s"> is invalid"</span><span class="p" data-group-id="1723336926-4">}</span><span class="p" data-group-id="1723336926-3">}</span></code></pre>
|
||||
</span><span class="p" data-group-id="4665697394-3">{</span><span class="ss">:error</span><span class="p">,</span><span class="w"> </span><span class="p" data-group-id="4665697394-4">{</span><span class="nc">Cldr.InvalidLanguageError</span><span class="p">,</span><span class="w"> </span><span class="s">"The language </span><span class="se">\"</span><span class="s">zz</span><span class="se">\"</span><span class="s"> is invalid"</span><span class="p" data-group-id="4665697394-4">}</span><span class="p" data-group-id="4665697394-3">}</span></code></pre>
|
||||
</section>
|
||||
</section>
|
||||
<section class="detail" id="number_system_names_for!/1">
|
||||
@ -509,13 +509,13 @@ or a <a href="https://hexdocs.pm/ex_cldr/2.37.5/Cldr.LanguageTag.html"><code cla
|
||||
<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.System</span><span class="o">.</span><span class="n">number_systems_for</span><span class="w"> </span><span class="s">"en"</span><span class="w">
|
||||
</span><span class="p" data-group-id="8565664800-1">{</span><span class="ss">:ok</span><span class="p">,</span><span class="w"> </span><span class="p" data-group-id="8565664800-2">%{</span><span class="ss">default</span><span class="p">:</span><span class="w"> </span><span class="ss">:latn</span><span class="p">,</span><span class="w"> </span><span class="ss">native</span><span class="p">:</span><span class="w"> </span><span class="ss">:latn</span><span class="p" data-group-id="8565664800-2">}</span><span class="p" data-group-id="8565664800-1">}</span><span class="w">
|
||||
</span><span class="p" data-group-id="0336099374-1">{</span><span class="ss">:ok</span><span class="p">,</span><span class="w"> </span><span class="p" data-group-id="0336099374-2">%{</span><span class="ss">default</span><span class="p">:</span><span class="w"> </span><span class="ss">:latn</span><span class="p">,</span><span class="w"> </span><span class="ss">native</span><span class="p">:</span><span class="w"> </span><span class="ss">:latn</span><span class="p" data-group-id="0336099374-2">}</span><span class="p" data-group-id="0336099374-1">}</span><span class="w">
|
||||
|
||||
</span><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr.Number.System</span><span class="o">.</span><span class="n">number_systems_for</span><span class="w"> </span><span class="s">"th"</span><span class="w">
|
||||
</span><span class="p" data-group-id="8565664800-3">{</span><span class="ss">:ok</span><span class="p">,</span><span class="w"> </span><span class="p" data-group-id="8565664800-4">%{</span><span class="ss">default</span><span class="p">:</span><span class="w"> </span><span class="ss">:latn</span><span class="p">,</span><span class="w"> </span><span class="ss">native</span><span class="p">:</span><span class="w"> </span><span class="ss">:thai</span><span class="p" data-group-id="8565664800-4">}</span><span class="p" data-group-id="8565664800-3">}</span><span class="w">
|
||||
</span><span class="p" data-group-id="0336099374-3">{</span><span class="ss">:ok</span><span class="p">,</span><span class="w"> </span><span class="p" data-group-id="0336099374-4">%{</span><span class="ss">default</span><span class="p">:</span><span class="w"> </span><span class="ss">:latn</span><span class="p">,</span><span class="w"> </span><span class="ss">native</span><span class="p">:</span><span class="w"> </span><span class="ss">:thai</span><span class="p" data-group-id="0336099374-4">}</span><span class="p" data-group-id="0336099374-3">}</span><span class="w">
|
||||
|
||||
</span><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr.Number.System</span><span class="o">.</span><span class="n">number_systems_for</span><span class="w"> </span><span class="s">"zz"</span><span class="w">
|
||||
</span><span class="p" data-group-id="8565664800-5">{</span><span class="ss">:error</span><span class="p">,</span><span class="w"> </span><span class="p" data-group-id="8565664800-6">{</span><span class="nc">Cldr.InvalidLanguageError</span><span class="p">,</span><span class="w"> </span><span class="s">"The language </span><span class="se">\"</span><span class="s">zz</span><span class="se">\"</span><span class="s"> is invalid"</span><span class="p" data-group-id="8565664800-6">}</span><span class="p" data-group-id="8565664800-5">}</span></code></pre>
|
||||
</span><span class="p" data-group-id="0336099374-5">{</span><span class="ss">:error</span><span class="p">,</span><span class="w"> </span><span class="p" data-group-id="0336099374-6">{</span><span class="nc">Cldr.InvalidLanguageError</span><span class="p">,</span><span class="w"> </span><span class="s">"The language </span><span class="se">\"</span><span class="s">zz</span><span class="se">\"</span><span class="s"> is invalid"</span><span class="p" data-group-id="0336099374-6">}</span><span class="p" data-group-id="0336099374-5">}</span></code></pre>
|
||||
</section>
|
||||
</section>
|
||||
<section class="detail" id="number_systems_for!/1">
|
||||
@ -613,20 +613,20 @@ actual system name.</p><h2 id="system_name_from/2-examples" class="section-headi
|
||||
</a>
|
||||
<span class="text">Examples</span>
|
||||
</h2>
|
||||
<pre><code class="makeup elixir" translate="no"><span class="n">ex</span><span class="o">></span><span class="w"> </span><span class="nc">Plausible.Cldr.Number.System</span><span class="o">.</span><span class="n">system_name_from</span><span class="p" data-group-id="0753469361-1">(</span><span class="ss">:default</span><span class="p">,</span><span class="w"> </span><span class="s">"en"</span><span class="p" data-group-id="0753469361-1">)</span><span class="w">
|
||||
</span><span class="p" data-group-id="0753469361-2">{</span><span class="ss">:ok</span><span class="p">,</span><span class="w"> </span><span class="ss">:latn</span><span class="p" data-group-id="0753469361-2">}</span><span class="w">
|
||||
<pre><code class="makeup elixir" translate="no"><span class="n">ex</span><span class="o">></span><span class="w"> </span><span class="nc">Plausible.Cldr.Number.System</span><span class="o">.</span><span class="n">system_name_from</span><span class="p" data-group-id="8232978085-1">(</span><span class="ss">:default</span><span class="p">,</span><span class="w"> </span><span class="s">"en"</span><span class="p" data-group-id="8232978085-1">)</span><span class="w">
|
||||
</span><span class="p" data-group-id="8232978085-2">{</span><span class="ss">:ok</span><span class="p">,</span><span class="w"> </span><span class="ss">:latn</span><span class="p" data-group-id="8232978085-2">}</span><span class="w">
|
||||
|
||||
</span><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr.Number.System</span><span class="o">.</span><span class="n">system_name_from</span><span class="p" data-group-id="0753469361-3">(</span><span class="s">"latn"</span><span class="p">,</span><span class="w"> </span><span class="s">"en"</span><span class="p" data-group-id="0753469361-3">)</span><span class="w">
|
||||
</span><span class="p" data-group-id="0753469361-4">{</span><span class="ss">:ok</span><span class="p">,</span><span class="w"> </span><span class="ss">:latn</span><span class="p" data-group-id="0753469361-4">}</span><span class="w">
|
||||
</span><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr.Number.System</span><span class="o">.</span><span class="n">system_name_from</span><span class="p" data-group-id="8232978085-3">(</span><span class="s">"latn"</span><span class="p">,</span><span class="w"> </span><span class="s">"en"</span><span class="p" data-group-id="8232978085-3">)</span><span class="w">
|
||||
</span><span class="p" data-group-id="8232978085-4">{</span><span class="ss">:ok</span><span class="p">,</span><span class="w"> </span><span class="ss">:latn</span><span class="p" data-group-id="8232978085-4">}</span><span class="w">
|
||||
|
||||
</span><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr.Number.System</span><span class="o">.</span><span class="n">system_name_from</span><span class="p" data-group-id="0753469361-5">(</span><span class="ss">:native</span><span class="p">,</span><span class="w"> </span><span class="s">"en"</span><span class="p" data-group-id="0753469361-5">)</span><span class="w">
|
||||
</span><span class="p" data-group-id="0753469361-6">{</span><span class="ss">:ok</span><span class="p">,</span><span class="w"> </span><span class="ss">:latn</span><span class="p" data-group-id="0753469361-6">}</span><span class="w">
|
||||
</span><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr.Number.System</span><span class="o">.</span><span class="n">system_name_from</span><span class="p" data-group-id="8232978085-5">(</span><span class="ss">:native</span><span class="p">,</span><span class="w"> </span><span class="s">"en"</span><span class="p" data-group-id="8232978085-5">)</span><span class="w">
|
||||
</span><span class="p" data-group-id="8232978085-6">{</span><span class="ss">:ok</span><span class="p">,</span><span class="w"> </span><span class="ss">:latn</span><span class="p" data-group-id="8232978085-6">}</span><span class="w">
|
||||
|
||||
</span><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr.Number.System</span><span class="o">.</span><span class="n">system_name_from</span><span class="p" data-group-id="0753469361-7">(</span><span class="ss">:nope</span><span class="p">,</span><span class="w"> </span><span class="s">"en"</span><span class="p" data-group-id="0753469361-7">)</span><span class="w">
|
||||
</span><span class="p" data-group-id="0753469361-8">{</span><span class="w">
|
||||
</span><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr.Number.System</span><span class="o">.</span><span class="n">system_name_from</span><span class="p" data-group-id="8232978085-7">(</span><span class="ss">:nope</span><span class="p">,</span><span class="w"> </span><span class="s">"en"</span><span class="p" data-group-id="8232978085-7">)</span><span class="w">
|
||||
</span><span class="p" data-group-id="8232978085-8">{</span><span class="w">
|
||||
</span><span class="ss">:error</span><span class="p">,</span><span class="w">
|
||||
</span><span class="p" data-group-id="0753469361-9">{</span><span class="nc">Cldr.UnknownNumberSystemError</span><span class="p">,</span><span class="w"> </span><span class="s">"The number system :nope is unknown"</span><span class="p" data-group-id="0753469361-9">}</span><span class="w">
|
||||
</span><span class="p" data-group-id="0753469361-8">}</span></code></pre><p>Note that return value is not guaranteed to be a valid
|
||||
</span><span class="p" data-group-id="8232978085-9">{</span><span class="nc">Cldr.UnknownNumberSystemError</span><span class="p">,</span><span class="w"> </span><span class="s">"The number system :nope is unknown"</span><span class="p" data-group-id="8232978085-9">}</span><span class="w">
|
||||
</span><span class="p" data-group-id="8232978085-8">}</span></code></pre><p>Note that return value is not guaranteed to be a valid
|
||||
number system for the given locale as demonstrated in the third example.</p>
|
||||
</section>
|
||||
</section>
|
||||
@ -673,16 +673,16 @@ is recommended.</p></li></ul><h2 id="to_system/2-examples" class="section-headin
|
||||
<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.System</span><span class="o">.</span><span class="n">to_system</span><span class="w"> </span><span class="mi">123456</span><span class="p">,</span><span class="w"> </span><span class="ss">:hebr</span><span class="w">
|
||||
</span><span class="p" data-group-id="7242782830-1">{</span><span class="ss">:ok</span><span class="p">,</span><span class="w"> </span><span class="s">"קכ״ג׳תנ״ו"</span><span class="p" data-group-id="7242782830-1">}</span><span class="w">
|
||||
</span><span class="p" data-group-id="1642954422-1">{</span><span class="ss">:ok</span><span class="p">,</span><span class="w"> </span><span class="s">"קכ״ג׳תנ״ו"</span><span class="p" data-group-id="1642954422-1">}</span><span class="w">
|
||||
|
||||
</span><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr.Number.System</span><span class="o">.</span><span class="n">to_system</span><span class="w"> </span><span class="mi">123</span><span class="p">,</span><span class="w"> </span><span class="ss">:hans</span><span class="w">
|
||||
</span><span class="p" data-group-id="7242782830-2">{</span><span class="ss">:ok</span><span class="p">,</span><span class="w"> </span><span class="s">"一百二十三"</span><span class="p" data-group-id="7242782830-2">}</span><span class="w">
|
||||
</span><span class="p" data-group-id="1642954422-2">{</span><span class="ss">:ok</span><span class="p">,</span><span class="w"> </span><span class="s">"一百二十三"</span><span class="p" data-group-id="1642954422-2">}</span><span class="w">
|
||||
|
||||
</span><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr.Number.System</span><span class="o">.</span><span class="n">to_system</span><span class="w"> </span><span class="mi">123</span><span class="p">,</span><span class="w"> </span><span class="ss">:hant</span><span class="w">
|
||||
</span><span class="p" data-group-id="7242782830-3">{</span><span class="ss">:ok</span><span class="p">,</span><span class="w"> </span><span class="s">"一百二十三"</span><span class="p" data-group-id="7242782830-3">}</span><span class="w">
|
||||
</span><span class="p" data-group-id="1642954422-3">{</span><span class="ss">:ok</span><span class="p">,</span><span class="w"> </span><span class="s">"一百二十三"</span><span class="p" data-group-id="1642954422-3">}</span><span class="w">
|
||||
|
||||
</span><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr.Number.System</span><span class="o">.</span><span class="n">to_system</span><span class="w"> </span><span class="mi">123</span><span class="p">,</span><span class="w"> </span><span class="ss">:hansfin</span><span class="w">
|
||||
</span><span class="p" data-group-id="7242782830-4">{</span><span class="ss">:ok</span><span class="p">,</span><span class="w"> </span><span class="s">"壹佰贰拾叁"</span><span class="p" data-group-id="7242782830-4">}</span></code></pre>
|
||||
</span><span class="p" data-group-id="1642954422-4">{</span><span class="ss">:ok</span><span class="p">,</span><span class="w"> </span><span class="s">"壹佰贰拾叁"</span><span class="p" data-group-id="1642954422-4">}</span></code></pre>
|
||||
</section>
|
||||
</section>
|
||||
<section class="detail" id="to_system!/2">
|
||||
|
@ -162,12 +162,12 @@ digits between number systems. For example from :arabic to :latn. Since genera
|
||||
transliteration map is slow, pairs of transliterations can be configured so that the
|
||||
transliteration map is created at compile time and therefore speeding up transliteration at
|
||||
run time.</p><p>To configure these transliteration pairs, add the to the <code class="inline">use Cldr</code> configuration
|
||||
in a backend module:</p><pre><code class="makeup elixir" translate="no"><span class="kd">defmodule</span><span class="w"> </span><span class="nc">MyApp.Cldr</span><span class="w"> </span><span class="k" data-group-id="5856563432-1">do</span><span class="w">
|
||||
in a backend module:</p><pre><code class="makeup elixir" translate="no"><span class="kd">defmodule</span><span class="w"> </span><span class="nc">MyApp.Cldr</span><span class="w"> </span><span class="k" data-group-id="2353818405-1">do</span><span class="w">
|
||||
</span><span class="kn">use</span><span class="w"> </span><span class="nc">Cldr</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">locale</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="5856563432-2">[</span><span class="s">"en"</span><span class="p">,</span><span class="w"> </span><span class="s">"fr"</span><span class="p">,</span><span class="w"> </span><span class="s">"th"</span><span class="p" data-group-id="5856563432-2">]</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">locale</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="2353818405-2">[</span><span class="s">"en"</span><span class="p">,</span><span class="w"> </span><span class="s">"fr"</span><span class="p">,</span><span class="w"> </span><span class="s">"th"</span><span class="p" data-group-id="2353818405-2">]</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">default_locale</span><span class="p">:</span><span class="w"> </span><span class="s">"en"</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">precompile_transliterations</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="5856563432-3">[</span><span class="p" data-group-id="5856563432-4">{</span><span class="ss">:latn</span><span class="p">,</span><span class="w"> </span><span class="ss">:thai</span><span class="p" data-group-id="5856563432-4">}</span><span class="p">,</span><span class="w"> </span><span class="p" data-group-id="5856563432-5">{</span><span class="ss">:arab</span><span class="p">,</span><span class="w"> </span><span class="ss">:thai</span><span class="p" data-group-id="5856563432-5">}</span><span class="p" data-group-id="5856563432-3">]</span><span class="w">
|
||||
</span><span class="k" data-group-id="5856563432-1">end</span></code></pre><p>Where each tuple in the list configures one transliteration map. In this example, two maps are
|
||||
</span><span class="ss">precompile_transliterations</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="2353818405-3">[</span><span class="p" data-group-id="2353818405-4">{</span><span class="ss">:latn</span><span class="p">,</span><span class="w"> </span><span class="ss">:thai</span><span class="p" data-group-id="2353818405-4">}</span><span class="p">,</span><span class="w"> </span><span class="p" data-group-id="2353818405-5">{</span><span class="ss">:arab</span><span class="p">,</span><span class="w"> </span><span class="ss">:thai</span><span class="p" data-group-id="2353818405-5">}</span><span class="p" data-group-id="2353818405-3">]</span><span class="w">
|
||||
</span><span class="k" data-group-id="2353818405-1">end</span></code></pre><p>Where each tuple in the list configures one transliteration map. In this example, two maps are
|
||||
configured: from <code class="inline">:latn</code> to <code class="inline">:thai</code> and from <code class="inline">:arab</code> to <code class="inline">:thai</code>.</p><p>A list of configurable number systems is returned by <a href="https://hexdocs.pm/ex_cldr_numbers/2.32.3/Cldr.Number.System.html#numeric_systems/0"><code class="inline">Cldr.Number.System.numeric_systems/0</code></a>.</p><p>If a transliteration is requested between two number pairs that have not been configured for
|
||||
precompilation, a warning is logged.</p>
|
||||
</section>
|
||||
@ -281,22 +281,22 @@ and <a href="Plausible.Cldr.Number.System.html#number_systems_for/1"><code class
|
||||
</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.Transliterate</span><span class="o">.</span><span class="n">transliterate</span><span class="p" data-group-id="8390859341-1">(</span><span class="s">"123556"</span><span class="p" data-group-id="8390859341-1">)</span><span class="w">
|
||||
<pre><code class="makeup elixir" translate="no"><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr.Number.Transliterate</span><span class="o">.</span><span class="n">transliterate</span><span class="p" data-group-id="9754194647-1">(</span><span class="s">"123556"</span><span class="p" data-group-id="9754194647-1">)</span><span class="w">
|
||||
</span><span class="s">"123556"</span><span class="w">
|
||||
|
||||
</span><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr.Number.Transliterate</span><span class="o">.</span><span class="n">transliterate</span><span class="p" data-group-id="8390859341-2">(</span><span class="s">"123,556.000"</span><span class="p">,</span><span class="w"> </span><span class="s">"fr"</span><span class="p">,</span><span class="w"> </span><span class="ss">:default</span><span class="p" data-group-id="8390859341-2">)</span><span class="w">
|
||||
</span><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr.Number.Transliterate</span><span class="o">.</span><span class="n">transliterate</span><span class="p" data-group-id="9754194647-2">(</span><span class="s">"123,556.000"</span><span class="p">,</span><span class="w"> </span><span class="s">"fr"</span><span class="p">,</span><span class="w"> </span><span class="ss">:default</span><span class="p" data-group-id="9754194647-2">)</span><span class="w">
|
||||
</span><span class="s">"123 556,000"</span><span class="w">
|
||||
|
||||
</span><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr.Number.Transliterate</span><span class="o">.</span><span class="n">transliterate</span><span class="p" data-group-id="8390859341-3">(</span><span class="s">"123556"</span><span class="p">,</span><span class="w"> </span><span class="s">"th"</span><span class="p">,</span><span class="w"> </span><span class="ss">:default</span><span class="p" data-group-id="8390859341-3">)</span><span class="w">
|
||||
</span><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr.Number.Transliterate</span><span class="o">.</span><span class="n">transliterate</span><span class="p" data-group-id="9754194647-3">(</span><span class="s">"123556"</span><span class="p">,</span><span class="w"> </span><span class="s">"th"</span><span class="p">,</span><span class="w"> </span><span class="ss">:default</span><span class="p" data-group-id="9754194647-3">)</span><span class="w">
|
||||
</span><span class="s">"123556"</span><span class="w">
|
||||
|
||||
</span><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr.Number.Transliterate</span><span class="o">.</span><span class="n">transliterate</span><span class="p" data-group-id="8390859341-4">(</span><span class="s">"123556"</span><span class="p">,</span><span class="w"> </span><span class="s">"th"</span><span class="p">,</span><span class="w"> </span><span class="s">"thai"</span><span class="p" data-group-id="8390859341-4">)</span><span class="w">
|
||||
</span><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr.Number.Transliterate</span><span class="o">.</span><span class="n">transliterate</span><span class="p" data-group-id="9754194647-4">(</span><span class="s">"123556"</span><span class="p">,</span><span class="w"> </span><span class="s">"th"</span><span class="p">,</span><span class="w"> </span><span class="s">"thai"</span><span class="p" data-group-id="9754194647-4">)</span><span class="w">
|
||||
</span><span class="s">"๑๒๓๕๕๖"</span><span class="w">
|
||||
|
||||
</span><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr.Number.Transliterate</span><span class="o">.</span><span class="n">transliterate</span><span class="p" data-group-id="8390859341-5">(</span><span class="s">"123556"</span><span class="p">,</span><span class="w"> </span><span class="s">"th"</span><span class="p">,</span><span class="w"> </span><span class="ss">:native</span><span class="p" data-group-id="8390859341-5">)</span><span class="w">
|
||||
</span><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr.Number.Transliterate</span><span class="o">.</span><span class="n">transliterate</span><span class="p" data-group-id="9754194647-5">(</span><span class="s">"123556"</span><span class="p">,</span><span class="w"> </span><span class="s">"th"</span><span class="p">,</span><span class="w"> </span><span class="ss">:native</span><span class="p" data-group-id="9754194647-5">)</span><span class="w">
|
||||
</span><span class="s">"๑๒๓๕๕๖"</span><span class="w">
|
||||
|
||||
</span><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr.Number.Transliterate</span><span class="o">.</span><span class="n">transliterate</span><span class="p" data-group-id="8390859341-6">(</span><span class="s">"Some number is: 123556"</span><span class="p">,</span><span class="w"> </span><span class="s">"th"</span><span class="p">,</span><span class="w"> </span><span class="s">"thai"</span><span class="p" data-group-id="8390859341-6">)</span><span class="w">
|
||||
</span><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr.Number.Transliterate</span><span class="o">.</span><span class="n">transliterate</span><span class="p" data-group-id="9754194647-6">(</span><span class="s">"Some number is: 123556"</span><span class="p">,</span><span class="w"> </span><span class="s">"th"</span><span class="p">,</span><span class="w"> </span><span class="s">"thai"</span><span class="p" data-group-id="9754194647-6">)</span><span class="w">
|
||||
</span><span class="s">"Some number is: ๑๒๓๕๕๖"</span></code></pre>
|
||||
</section>
|
||||
</section>
|
||||
|
@ -441,19 +441,19 @@ using the Elixir standard library functions.</p><h2 id="parse/2-examples" class=
|
||||
</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</span><span class="o">.</span><span class="n">parse</span><span class="p" data-group-id="5397480936-1">(</span><span class="s">"+1.000,34"</span><span class="p">,</span><span class="w"> </span><span class="ss">locale</span><span class="p">:</span><span class="w"> </span><span class="s">"de"</span><span class="p" data-group-id="5397480936-1">)</span><span class="w">
|
||||
</span><span class="p" data-group-id="5397480936-2">{</span><span class="ss">:ok</span><span class="p">,</span><span class="w"> </span><span class="mf">1000.34</span><span class="p" data-group-id="5397480936-2">}</span><span class="w">
|
||||
<pre><code class="makeup elixir" translate="no"><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr.Number</span><span class="o">.</span><span class="n">parse</span><span class="p" data-group-id="4838441453-1">(</span><span class="s">"+1.000,34"</span><span class="p">,</span><span class="w"> </span><span class="ss">locale</span><span class="p">:</span><span class="w"> </span><span class="s">"de"</span><span class="p" data-group-id="4838441453-1">)</span><span class="w">
|
||||
</span><span class="p" data-group-id="4838441453-2">{</span><span class="ss">:ok</span><span class="p">,</span><span class="w"> </span><span class="mf">1000.34</span><span class="p" data-group-id="4838441453-2">}</span><span class="w">
|
||||
|
||||
</span><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr.Number</span><span class="o">.</span><span class="n">parse</span><span class="p" data-group-id="5397480936-3">(</span><span class="s">"-1_000_000.34"</span><span class="p" data-group-id="5397480936-3">)</span><span class="w">
|
||||
</span><span class="p" data-group-id="5397480936-4">{</span><span class="ss">:ok</span><span class="p">,</span><span class="w"> </span><span class="o">-</span><span class="mf">1000000.34</span><span class="p" data-group-id="5397480936-4">}</span><span class="w">
|
||||
</span><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr.Number</span><span class="o">.</span><span class="n">parse</span><span class="p" data-group-id="4838441453-3">(</span><span class="s">"-1_000_000.34"</span><span class="p" data-group-id="4838441453-3">)</span><span class="w">
|
||||
</span><span class="p" data-group-id="4838441453-4">{</span><span class="ss">:ok</span><span class="p">,</span><span class="w"> </span><span class="o">-</span><span class="mf">1000000.34</span><span class="p" data-group-id="4838441453-4">}</span><span class="w">
|
||||
|
||||
</span><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr.Number</span><span class="o">.</span><span class="n">parse</span><span class="p" data-group-id="5397480936-5">(</span><span class="s">"1.000"</span><span class="p">,</span><span class="w"> </span><span class="ss">locale</span><span class="p">:</span><span class="w"> </span><span class="s">"de"</span><span class="p">,</span><span class="w"> </span><span class="ss">number</span><span class="p">:</span><span class="w"> </span><span class="ss">:integer</span><span class="p" data-group-id="5397480936-5">)</span><span class="w">
|
||||
</span><span class="p" data-group-id="5397480936-6">{</span><span class="ss">:ok</span><span class="p">,</span><span class="w"> </span><span class="mi">1000</span><span class="p" data-group-id="5397480936-6">}</span><span class="w">
|
||||
</span><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr.Number</span><span class="o">.</span><span class="n">parse</span><span class="p" data-group-id="4838441453-5">(</span><span class="s">"1.000"</span><span class="p">,</span><span class="w"> </span><span class="ss">locale</span><span class="p">:</span><span class="w"> </span><span class="s">"de"</span><span class="p">,</span><span class="w"> </span><span class="ss">number</span><span class="p">:</span><span class="w"> </span><span class="ss">:integer</span><span class="p" data-group-id="4838441453-5">)</span><span class="w">
|
||||
</span><span class="p" data-group-id="4838441453-6">{</span><span class="ss">:ok</span><span class="p">,</span><span class="w"> </span><span class="mi">1000</span><span class="p" data-group-id="4838441453-6">}</span><span class="w">
|
||||
|
||||
</span><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr.Number</span><span class="o">.</span><span class="n">parse</span><span class="p" data-group-id="5397480936-7">(</span><span class="s">"+1.000,34"</span><span class="p">,</span><span class="w"> </span><span class="ss">locale</span><span class="p">:</span><span class="w"> </span><span class="s">"de"</span><span class="p">,</span><span class="w"> </span><span class="ss">number</span><span class="p">:</span><span class="w"> </span><span class="ss">:integer</span><span class="p" data-group-id="5397480936-7">)</span><span class="w">
|
||||
</span><span class="p" data-group-id="5397480936-8">{</span><span class="ss">:error</span><span class="p">,</span><span class="w">
|
||||
</span><span class="p" data-group-id="5397480936-9">{</span><span class="nc">Cldr.Number.ParseError</span><span class="p">,</span><span class="w">
|
||||
</span><span class="s">"The string </span><span class="se">\"</span><span class="s">+1.000,34</span><span class="se">\"</span><span class="s"> could not be parsed as a number"</span><span class="p" data-group-id="5397480936-9">}</span><span class="p" data-group-id="5397480936-8">}</span></code></pre>
|
||||
</span><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr.Number</span><span class="o">.</span><span class="n">parse</span><span class="p" data-group-id="4838441453-7">(</span><span class="s">"+1.000,34"</span><span class="p">,</span><span class="w"> </span><span class="ss">locale</span><span class="p">:</span><span class="w"> </span><span class="s">"de"</span><span class="p">,</span><span class="w"> </span><span class="ss">number</span><span class="p">:</span><span class="w"> </span><span class="ss">:integer</span><span class="p" data-group-id="4838441453-7">)</span><span class="w">
|
||||
</span><span class="p" data-group-id="4838441453-8">{</span><span class="ss">:error</span><span class="p">,</span><span class="w">
|
||||
</span><span class="p" data-group-id="4838441453-9">{</span><span class="nc">Cldr.Number.ParseError</span><span class="p">,</span><span class="w">
|
||||
</span><span class="s">"The string </span><span class="se">\"</span><span class="s">+1.000,34</span><span class="se">\"</span><span class="s"> could not be parsed as a number"</span><span class="p" data-group-id="4838441453-9">}</span><span class="p" data-group-id="4838441453-8">}</span></code></pre>
|
||||
</section>
|
||||
</section>
|
||||
<section class="detail" id="resolve_currencies/2">
|
||||
@ -525,17 +525,17 @@ financial instruments.</p></li></ul><h2 id="resolve_currencies/2-examples" class
|
||||
</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</span><span class="o">.</span><span class="n">scan</span><span class="p" data-group-id="6967305105-1">(</span><span class="s">"100 US dollars"</span><span class="p" data-group-id="6967305105-1">)</span><span class="w">
|
||||
<pre><code class="makeup elixir" translate="no"><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr.Number</span><span class="o">.</span><span class="n">scan</span><span class="p" data-group-id="2301044604-1">(</span><span class="s">"100 US dollars"</span><span class="p" data-group-id="2301044604-1">)</span><span class="w">
|
||||
</span><span class="gp unselectable">...> </span><span class="o">|></span><span class="w"> </span><span class="nc">Plausible.Cldr.Number</span><span class="o">.</span><span class="n">resolve_currencies</span><span class="w">
|
||||
</span><span class="p" data-group-id="6967305105-2">[</span><span class="mi">100</span><span class="p">,</span><span class="w"> </span><span class="ss">:USD</span><span class="p" data-group-id="6967305105-2">]</span><span class="w">
|
||||
</span><span class="p" data-group-id="2301044604-2">[</span><span class="mi">100</span><span class="p">,</span><span class="w"> </span><span class="ss">:USD</span><span class="p" data-group-id="2301044604-2">]</span><span class="w">
|
||||
|
||||
</span><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr.Number</span><span class="o">.</span><span class="n">scan</span><span class="p" data-group-id="6967305105-3">(</span><span class="s">"100 eurosports"</span><span class="p" data-group-id="6967305105-3">)</span><span class="w">
|
||||
</span><span class="gp unselectable">...> </span><span class="o">|></span><span class="w"> </span><span class="nc">Plausible.Cldr.Number</span><span class="o">.</span><span class="n">resolve_currencies</span><span class="p" data-group-id="6967305105-4">(</span><span class="ss">fuzzy</span><span class="p">:</span><span class="w"> </span><span class="mf">0.75</span><span class="p" data-group-id="6967305105-4">)</span><span class="w">
|
||||
</span><span class="p" data-group-id="6967305105-5">[</span><span class="mi">100</span><span class="p">,</span><span class="w"> </span><span class="ss">:EUR</span><span class="p" data-group-id="6967305105-5">]</span><span class="w">
|
||||
</span><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr.Number</span><span class="o">.</span><span class="n">scan</span><span class="p" data-group-id="2301044604-3">(</span><span class="s">"100 eurosports"</span><span class="p" data-group-id="2301044604-3">)</span><span class="w">
|
||||
</span><span class="gp unselectable">...> </span><span class="o">|></span><span class="w"> </span><span class="nc">Plausible.Cldr.Number</span><span class="o">.</span><span class="n">resolve_currencies</span><span class="p" data-group-id="2301044604-4">(</span><span class="ss">fuzzy</span><span class="p">:</span><span class="w"> </span><span class="mf">0.75</span><span class="p" data-group-id="2301044604-4">)</span><span class="w">
|
||||
</span><span class="p" data-group-id="2301044604-5">[</span><span class="mi">100</span><span class="p">,</span><span class="w"> </span><span class="ss">:EUR</span><span class="p" data-group-id="2301044604-5">]</span><span class="w">
|
||||
|
||||
</span><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr.Number</span><span class="o">.</span><span class="n">scan</span><span class="p" data-group-id="6967305105-6">(</span><span class="s">"100 dollars des États-Unis"</span><span class="p" data-group-id="6967305105-6">)</span><span class="w">
|
||||
</span><span class="gp unselectable">...> </span><span class="o">|></span><span class="w"> </span><span class="nc">Plausible.Cldr.Number</span><span class="o">.</span><span class="n">resolve_currencies</span><span class="p" data-group-id="6967305105-7">(</span><span class="ss">locale</span><span class="p">:</span><span class="w"> </span><span class="s">"fr"</span><span class="p" data-group-id="6967305105-7">)</span><span class="w">
|
||||
</span><span class="p" data-group-id="6967305105-8">[</span><span class="mi">100</span><span class="p">,</span><span class="w"> </span><span class="ss">:USD</span><span class="p" data-group-id="6967305105-8">]</span></code></pre>
|
||||
</span><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr.Number</span><span class="o">.</span><span class="n">scan</span><span class="p" data-group-id="2301044604-6">(</span><span class="s">"100 dollars des États-Unis"</span><span class="p" data-group-id="2301044604-6">)</span><span class="w">
|
||||
</span><span class="gp unselectable">...> </span><span class="o">|></span><span class="w"> </span><span class="nc">Plausible.Cldr.Number</span><span class="o">.</span><span class="n">resolve_currencies</span><span class="p" data-group-id="2301044604-7">(</span><span class="ss">locale</span><span class="p">:</span><span class="w"> </span><span class="s">"fr"</span><span class="p" data-group-id="2301044604-7">)</span><span class="w">
|
||||
</span><span class="p" data-group-id="2301044604-8">[</span><span class="mi">100</span><span class="p">,</span><span class="w"> </span><span class="ss">:USD</span><span class="p" data-group-id="2301044604-8">]</span></code></pre>
|
||||
</section>
|
||||
</section>
|
||||
<section class="detail" id="resolve_currency/2">
|
||||
@ -612,19 +612,19 @@ financial instruments.</p></li></ul><h2 id="resolve_currency/2-examples" class="
|
||||
</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</span><span class="o">.</span><span class="n">resolve_currency</span><span class="p" data-group-id="8986817269-1">(</span><span class="s">"US dollars"</span><span class="p" data-group-id="8986817269-1">)</span><span class="w">
|
||||
</span><span class="p" data-group-id="8986817269-2">[</span><span class="ss">:USD</span><span class="p" data-group-id="8986817269-2">]</span><span class="w">
|
||||
<pre><code class="makeup elixir" translate="no"><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr.Number</span><span class="o">.</span><span class="n">resolve_currency</span><span class="p" data-group-id="4116353690-1">(</span><span class="s">"US dollars"</span><span class="p" data-group-id="4116353690-1">)</span><span class="w">
|
||||
</span><span class="p" data-group-id="4116353690-2">[</span><span class="ss">:USD</span><span class="p" data-group-id="4116353690-2">]</span><span class="w">
|
||||
|
||||
</span><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr.Number</span><span class="o">.</span><span class="n">resolve_currency</span><span class="p" data-group-id="8986817269-3">(</span><span class="s">"100 eurosports"</span><span class="p">,</span><span class="w"> </span><span class="ss">fuzzy</span><span class="p">:</span><span class="w"> </span><span class="mf">0.75</span><span class="p" data-group-id="8986817269-3">)</span><span class="w">
|
||||
</span><span class="p" data-group-id="8986817269-4">[</span><span class="ss">:EUR</span><span class="p" data-group-id="8986817269-4">]</span><span class="w">
|
||||
</span><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr.Number</span><span class="o">.</span><span class="n">resolve_currency</span><span class="p" data-group-id="4116353690-3">(</span><span class="s">"100 eurosports"</span><span class="p">,</span><span class="w"> </span><span class="ss">fuzzy</span><span class="p">:</span><span class="w"> </span><span class="mf">0.75</span><span class="p" data-group-id="4116353690-3">)</span><span class="w">
|
||||
</span><span class="p" data-group-id="4116353690-4">[</span><span class="ss">:EUR</span><span class="p" data-group-id="4116353690-4">]</span><span class="w">
|
||||
|
||||
</span><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr.Number</span><span class="o">.</span><span class="n">resolve_currency</span><span class="p" data-group-id="8986817269-5">(</span><span class="s">"dollars des États-Unis"</span><span class="p">,</span><span class="w"> </span><span class="ss">locale</span><span class="p">:</span><span class="w"> </span><span class="s">"fr"</span><span class="p" data-group-id="8986817269-5">)</span><span class="w">
|
||||
</span><span class="p" data-group-id="8986817269-6">[</span><span class="ss">:USD</span><span class="p" data-group-id="8986817269-6">]</span><span class="w">
|
||||
</span><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr.Number</span><span class="o">.</span><span class="n">resolve_currency</span><span class="p" data-group-id="4116353690-5">(</span><span class="s">"dollars des États-Unis"</span><span class="p">,</span><span class="w"> </span><span class="ss">locale</span><span class="p">:</span><span class="w"> </span><span class="s">"fr"</span><span class="p" data-group-id="4116353690-5">)</span><span class="w">
|
||||
</span><span class="p" data-group-id="4116353690-6">[</span><span class="ss">:USD</span><span class="p" data-group-id="4116353690-6">]</span><span class="w">
|
||||
|
||||
</span><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr.Number</span><span class="o">.</span><span class="n">resolve_currency</span><span class="p" data-group-id="8986817269-7">(</span><span class="s">"not a known currency"</span><span class="p">,</span><span class="w"> </span><span class="ss">locale</span><span class="p">:</span><span class="w"> </span><span class="s">"fr"</span><span class="p" data-group-id="8986817269-7">)</span><span class="w">
|
||||
</span><span class="p" data-group-id="8986817269-8">{</span><span class="ss">:error</span><span class="p">,</span><span class="w">
|
||||
</span><span class="p" data-group-id="8986817269-9">{</span><span class="nc">Cldr.UnknownCurrencyError</span><span class="p">,</span><span class="w">
|
||||
</span><span class="s">"The currency </span><span class="se">\"</span><span class="s">not a known currency</span><span class="se">\"</span><span class="s"> is unknown or not supported"</span><span class="p" data-group-id="8986817269-9">}</span><span class="p" data-group-id="8986817269-8">}</span></code></pre>
|
||||
</span><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr.Number</span><span class="o">.</span><span class="n">resolve_currency</span><span class="p" data-group-id="4116353690-7">(</span><span class="s">"not a known currency"</span><span class="p">,</span><span class="w"> </span><span class="ss">locale</span><span class="p">:</span><span class="w"> </span><span class="s">"fr"</span><span class="p" data-group-id="4116353690-7">)</span><span class="w">
|
||||
</span><span class="p" data-group-id="4116353690-8">{</span><span class="ss">:error</span><span class="p">,</span><span class="w">
|
||||
</span><span class="p" data-group-id="4116353690-9">{</span><span class="nc">Cldr.UnknownCurrencyError</span><span class="p">,</span><span class="w">
|
||||
</span><span class="s">"The currency </span><span class="se">\"</span><span class="s">not a known currency</span><span class="se">\"</span><span class="s"> is unknown or not supported"</span><span class="p" data-group-id="4116353690-9">}</span><span class="p" data-group-id="4116353690-8">}</span></code></pre>
|
||||
</section>
|
||||
</section>
|
||||
<section class="detail" id="resolve_per/2">
|
||||
@ -688,13 +688,13 @@ The default is <code class="inline">options[:backend].get_locale()</code></li></
|
||||
<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</span><span class="o">.</span><span class="n">resolve_per</span><span class="w"> </span><span class="s">"11%"</span><span class="w">
|
||||
</span><span class="p" data-group-id="9765256748-1">[</span><span class="s">"11"</span><span class="p">,</span><span class="w"> </span><span class="ss">:percent</span><span class="p" data-group-id="9765256748-1">]</span><span class="w">
|
||||
</span><span class="p" data-group-id="6871104244-1">[</span><span class="s">"11"</span><span class="p">,</span><span class="w"> </span><span class="ss">:percent</span><span class="p" data-group-id="6871104244-1">]</span><span class="w">
|
||||
|
||||
</span><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr.Number</span><span class="o">.</span><span class="n">resolve_per</span><span class="w"> </span><span class="s">"% of linguists"</span><span class="w">
|
||||
</span><span class="p" data-group-id="9765256748-2">[</span><span class="ss">:percent</span><span class="p">,</span><span class="w"> </span><span class="s">" of linguists"</span><span class="p" data-group-id="9765256748-2">]</span><span class="w">
|
||||
</span><span class="p" data-group-id="6871104244-2">[</span><span class="ss">:percent</span><span class="p">,</span><span class="w"> </span><span class="s">" of linguists"</span><span class="p" data-group-id="6871104244-2">]</span><span class="w">
|
||||
|
||||
</span><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr.Number</span><span class="o">.</span><span class="n">resolve_per</span><span class="w"> </span><span class="s">"% of linguists %"</span><span class="w">
|
||||
</span><span class="p" data-group-id="9765256748-3">[</span><span class="ss">:percent</span><span class="p">,</span><span class="w"> </span><span class="s">" of linguists "</span><span class="p">,</span><span class="w"> </span><span class="ss">:percent</span><span class="p" data-group-id="9765256748-3">]</span></code></pre>
|
||||
</span><span class="p" data-group-id="6871104244-3">[</span><span class="ss">:percent</span><span class="p">,</span><span class="w"> </span><span class="s">" of linguists "</span><span class="p">,</span><span class="w"> </span><span class="ss">:percent</span><span class="p" data-group-id="6871104244-3">]</span></code></pre>
|
||||
</section>
|
||||
</section>
|
||||
<section class="detail" id="resolve_pers/2">
|
||||
@ -751,9 +751,9 @@ The default is <code class="inline">options[:backend].get_locale()</code></li></
|
||||
</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</span><span class="o">.</span><span class="n">scan</span><span class="p" data-group-id="5522867182-1">(</span><span class="s">"100%"</span><span class="p" data-group-id="5522867182-1">)</span><span class="w">
|
||||
</span><span class="gp unselectable">...> </span><span class="o">|></span><span class="w"> </span><span class="nc">Plausible.Cldr.Number</span><span class="o">.</span><span class="n">resolve_pers</span><span class="p" data-group-id="5522867182-2">(</span><span class="p" data-group-id="5522867182-2">)</span><span class="w">
|
||||
</span><span class="p" data-group-id="5522867182-3">[</span><span class="mi">100</span><span class="p">,</span><span class="w"> </span><span class="ss">:percent</span><span class="p" data-group-id="5522867182-3">]</span></code></pre>
|
||||
<pre><code class="makeup elixir" translate="no"><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr.Number</span><span class="o">.</span><span class="n">scan</span><span class="p" data-group-id="1352108446-1">(</span><span class="s">"100%"</span><span class="p" data-group-id="1352108446-1">)</span><span class="w">
|
||||
</span><span class="gp unselectable">...> </span><span class="o">|></span><span class="w"> </span><span class="nc">Plausible.Cldr.Number</span><span class="o">.</span><span class="n">resolve_pers</span><span class="p" data-group-id="1352108446-2">(</span><span class="p" data-group-id="1352108446-2">)</span><span class="w">
|
||||
</span><span class="p" data-group-id="1352108446-3">[</span><span class="mi">100</span><span class="p">,</span><span class="w"> </span><span class="ss">:percent</span><span class="p" data-group-id="1352108446-3">]</span></code></pre>
|
||||
</section>
|
||||
</section>
|
||||
<section class="detail" id="scan/2">
|
||||
@ -813,20 +813,20 @@ and any options provided are passed to that function.</p><h2 id="scan/2-examples
|
||||
</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</span><span class="o">.</span><span class="n">scan</span><span class="p" data-group-id="7254135054-1">(</span><span class="s">"£1_000_000.34"</span><span class="p" data-group-id="7254135054-1">)</span><span class="w">
|
||||
</span><span class="p" data-group-id="7254135054-2">[</span><span class="s">"£"</span><span class="p">,</span><span class="w"> </span><span class="mf">1000000.34</span><span class="p" data-group-id="7254135054-2">]</span><span class="w">
|
||||
<pre><code class="makeup elixir" translate="no"><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr.Number</span><span class="o">.</span><span class="n">scan</span><span class="p" data-group-id="7683434573-1">(</span><span class="s">"£1_000_000.34"</span><span class="p" data-group-id="7683434573-1">)</span><span class="w">
|
||||
</span><span class="p" data-group-id="7683434573-2">[</span><span class="s">"£"</span><span class="p">,</span><span class="w"> </span><span class="mf">1000000.34</span><span class="p" data-group-id="7683434573-2">]</span><span class="w">
|
||||
|
||||
</span><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr.Number</span><span class="o">.</span><span class="n">scan</span><span class="p" data-group-id="7254135054-3">(</span><span class="s">"I want £1_000_000 dollars"</span><span class="p" data-group-id="7254135054-3">)</span><span class="w">
|
||||
</span><span class="p" data-group-id="7254135054-4">[</span><span class="s">"I want £"</span><span class="p">,</span><span class="w"> </span><span class="mi">1000000</span><span class="p">,</span><span class="w"> </span><span class="s">" dollars"</span><span class="p" data-group-id="7254135054-4">]</span><span class="w">
|
||||
</span><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr.Number</span><span class="o">.</span><span class="n">scan</span><span class="p" data-group-id="7683434573-3">(</span><span class="s">"I want £1_000_000 dollars"</span><span class="p" data-group-id="7683434573-3">)</span><span class="w">
|
||||
</span><span class="p" data-group-id="7683434573-4">[</span><span class="s">"I want £"</span><span class="p">,</span><span class="w"> </span><span class="mi">1000000</span><span class="p">,</span><span class="w"> </span><span class="s">" dollars"</span><span class="p" data-group-id="7683434573-4">]</span><span class="w">
|
||||
|
||||
</span><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr.Number</span><span class="o">.</span><span class="n">scan</span><span class="p" data-group-id="7254135054-5">(</span><span class="s">"The prize is 23"</span><span class="p" data-group-id="7254135054-5">)</span><span class="w">
|
||||
</span><span class="p" data-group-id="7254135054-6">[</span><span class="s">"The prize is "</span><span class="p">,</span><span class="w"> </span><span class="mi">23</span><span class="p" data-group-id="7254135054-6">]</span><span class="w">
|
||||
</span><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr.Number</span><span class="o">.</span><span class="n">scan</span><span class="p" data-group-id="7683434573-5">(</span><span class="s">"The prize is 23"</span><span class="p" data-group-id="7683434573-5">)</span><span class="w">
|
||||
</span><span class="p" data-group-id="7683434573-6">[</span><span class="s">"The prize is "</span><span class="p">,</span><span class="w"> </span><span class="mi">23</span><span class="p" data-group-id="7683434573-6">]</span><span class="w">
|
||||
|
||||
</span><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr.Number</span><span class="o">.</span><span class="n">scan</span><span class="p" data-group-id="7254135054-7">(</span><span class="s">"The lottery number is 23 for the next draw"</span><span class="p" data-group-id="7254135054-7">)</span><span class="w">
|
||||
</span><span class="p" data-group-id="7254135054-8">[</span><span class="s">"The lottery number is "</span><span class="p">,</span><span class="w"> </span><span class="mi">23</span><span class="p">,</span><span class="w"> </span><span class="s">" for the next draw"</span><span class="p" data-group-id="7254135054-8">]</span><span class="w">
|
||||
</span><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr.Number</span><span class="o">.</span><span class="n">scan</span><span class="p" data-group-id="7683434573-7">(</span><span class="s">"The lottery number is 23 for the next draw"</span><span class="p" data-group-id="7683434573-7">)</span><span class="w">
|
||||
</span><span class="p" data-group-id="7683434573-8">[</span><span class="s">"The lottery number is "</span><span class="p">,</span><span class="w"> </span><span class="mi">23</span><span class="p">,</span><span class="w"> </span><span class="s">" for the next draw"</span><span class="p" data-group-id="7683434573-8">]</span><span class="w">
|
||||
|
||||
</span><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr.Number</span><span class="o">.</span><span class="n">scan</span><span class="p" data-group-id="7254135054-9">(</span><span class="s">"The loss is -1.000 euros"</span><span class="p">,</span><span class="w"> </span><span class="ss">locale</span><span class="p">:</span><span class="w"> </span><span class="s">"de"</span><span class="p">,</span><span class="w"> </span><span class="ss">number</span><span class="p">:</span><span class="w"> </span><span class="ss">:integer</span><span class="p" data-group-id="7254135054-9">)</span><span class="w">
|
||||
</span><span class="p" data-group-id="7254135054-10">[</span><span class="s">"The loss is "</span><span class="p">,</span><span class="w"> </span><span class="o">-</span><span class="mi">1000</span><span class="p">,</span><span class="w"> </span><span class="s">" euros"</span><span class="p" data-group-id="7254135054-10">]</span></code></pre>
|
||||
</span><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr.Number</span><span class="o">.</span><span class="n">scan</span><span class="p" data-group-id="7683434573-9">(</span><span class="s">"The loss is -1.000 euros"</span><span class="p">,</span><span class="w"> </span><span class="ss">locale</span><span class="p">:</span><span class="w"> </span><span class="s">"de"</span><span class="p">,</span><span class="w"> </span><span class="ss">number</span><span class="p">:</span><span class="w"> </span><span class="ss">:integer</span><span class="p" data-group-id="7683434573-9">)</span><span class="w">
|
||||
</span><span class="p" data-group-id="7683434573-10">[</span><span class="s">"The loss is "</span><span class="p">,</span><span class="w"> </span><span class="o">-</span><span class="mi">1000</span><span class="p">,</span><span class="w"> </span><span class="s">" euros"</span><span class="p" data-group-id="7683434573-10">]</span></code></pre>
|
||||
</section>
|
||||
</section>
|
||||
<section class="detail" id="to_approx_string/2">
|
||||
@ -873,7 +873,7 @@ options.</p></li></ul><h2 id="to_approx_string/2-example" class="section-heading
|
||||
<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</span><span class="o">.</span><span class="n">to_approx_string</span><span class="w"> </span><span class="mi">1234</span><span class="w">
|
||||
</span><span class="p" data-group-id="2877861858-1">{</span><span class="ss">:ok</span><span class="p">,</span><span class="w"> </span><span class="s">"~1,234"</span><span class="p" data-group-id="2877861858-1">}</span></code></pre>
|
||||
</span><span class="p" data-group-id="8625392570-1">{</span><span class="ss">:ok</span><span class="p">,</span><span class="w"> </span><span class="s">"~1,234"</span><span class="p" data-group-id="8625392570-1">}</span></code></pre>
|
||||
</section>
|
||||
</section>
|
||||
<section class="detail" id="to_at_least_string/2">
|
||||
@ -920,7 +920,7 @@ options.</p></li></ul><h2 id="to_at_least_string/2-example" class="section-headi
|
||||
<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</span><span class="o">.</span><span class="n">to_at_least_string</span><span class="w"> </span><span class="mi">1234</span><span class="w">
|
||||
</span><span class="p" data-group-id="8386960231-1">{</span><span class="ss">:ok</span><span class="p">,</span><span class="w"> </span><span class="s">"1,234+"</span><span class="p" data-group-id="8386960231-1">}</span></code></pre>
|
||||
</span><span class="p" data-group-id="7423880460-1">{</span><span class="ss">:ok</span><span class="p">,</span><span class="w"> </span><span class="s">"1,234+"</span><span class="p" data-group-id="7423880460-1">}</span></code></pre>
|
||||
</section>
|
||||
</section>
|
||||
<section class="detail" id="to_at_most_string/2">
|
||||
@ -967,7 +967,7 @@ options.</p></li></ul><h2 id="to_at_most_string/2-example" class="section-headin
|
||||
<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</span><span class="o">.</span><span class="n">to_at_most_string</span><span class="w"> </span><span class="mi">1234</span><span class="w">
|
||||
</span><span class="p" data-group-id="1446716679-1">{</span><span class="ss">:ok</span><span class="p">,</span><span class="w"> </span><span class="s">"≤1,234"</span><span class="p" data-group-id="1446716679-1">}</span></code></pre>
|
||||
</span><span class="p" data-group-id="8824955693-1">{</span><span class="ss">:ok</span><span class="p">,</span><span class="w"> </span><span class="s">"≤1,234"</span><span class="p" data-group-id="8824955693-1">}</span></code></pre>
|
||||
</section>
|
||||
</section>
|
||||
<section class="detail" id="to_range_string/2">
|
||||
@ -1014,7 +1014,7 @@ options.</p></li></ul><h2 id="to_range_string/2-example" class="section-heading"
|
||||
<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</span><span class="o">.</span><span class="n">to_range_string</span><span class="w"> </span><span class="mi">1234</span><span class="o">..</span><span class="mi">5678</span><span class="w">
|
||||
</span><span class="p" data-group-id="6406711785-1">{</span><span class="ss">:ok</span><span class="p">,</span><span class="w"> </span><span class="s">"1,234–5,678"</span><span class="p" data-group-id="6406711785-1">}</span></code></pre>
|
||||
</span><span class="p" data-group-id="0650570175-1">{</span><span class="ss">:ok</span><span class="p">,</span><span class="w"> </span><span class="s">"1,234–5,678"</span><span class="p" data-group-id="0650570175-1">}</span></code></pre>
|
||||
</section>
|
||||
</section>
|
||||
<section class="detail" id="to_string/2">
|
||||
@ -1133,21 +1133,21 @@ extensions.</p><h2 id="to_string/2-wrapping-format-elements" class="section-head
|
||||
</h2>
|
||||
<p>Wrapping elements is particularly useful when formatting a number with a
|
||||
currency symbol and the requirement is to have different HTML formatting
|
||||
applied to the symbol than the number. For example:</p><pre><code class="makeup elixir" translate="no"><span class="gp unselectable">iex> </span><span class="nc">Cldr.Number</span><span class="o">.</span><span class="n">to_string</span><span class="p" data-group-id="4486999695-1">(</span><span class="mi">100</span><span class="p">,</span><span class="w"> </span><span class="ss">format</span><span class="p">:</span><span class="w"> </span><span class="ss">:currency</span><span class="p">,</span><span class="w"> </span><span class="ss">currency</span><span class="p">:</span><span class="w"> </span><span class="ss">:USD</span><span class="p">,</span><span class="w"> </span><span class="ss">wrapper</span><span class="p">:</span><span class="w"> </span><span class="k" data-group-id="4486999695-2">fn</span><span class="w">
|
||||
applied to the symbol than the number. For example:</p><pre><code class="makeup elixir" translate="no"><span class="gp unselectable">iex> </span><span class="nc">Cldr.Number</span><span class="o">.</span><span class="n">to_string</span><span class="p" data-group-id="1685477682-1">(</span><span class="mi">100</span><span class="p">,</span><span class="w"> </span><span class="ss">format</span><span class="p">:</span><span class="w"> </span><span class="ss">:currency</span><span class="p">,</span><span class="w"> </span><span class="ss">currency</span><span class="p">:</span><span class="w"> </span><span class="ss">:USD</span><span class="p">,</span><span class="w"> </span><span class="ss">wrapper</span><span class="p">:</span><span class="w"> </span><span class="k" data-group-id="1685477682-2">fn</span><span class="w">
|
||||
</span><span class="gp unselectable">...> </span><span class="w"> </span><span class="n">string</span><span class="p">,</span><span class="w"> </span><span class="ss">:currency_symbol</span><span class="w"> </span><span class="o">-></span><span class="w"> </span><span class="s">"<span class=</span><span class="se">\"</span><span class="s">symbol</span><span class="se">\"</span><span class="s">>"</span><span class="w"> </span><span class="o"><></span><span class="w"> </span><span class="n">string</span><span class="w"> </span><span class="o"><></span><span class="w"> </span><span class="s">"</span>"</span><span class="w">
|
||||
</span><span class="gp unselectable">...> </span><span class="w"> </span><span class="n">string</span><span class="p">,</span><span class="w"> </span><span class="ss">:number</span><span class="w"> </span><span class="o">-></span><span class="w"> </span><span class="s">"<span class=</span><span class="se">\"</span><span class="s">number</span><span class="se">\"</span><span class="s">>"</span><span class="w"> </span><span class="o"><></span><span class="w"> </span><span class="n">string</span><span class="w"> </span><span class="o"><></span><span class="w"> </span><span class="s">"</span>"</span><span class="w">
|
||||
</span><span class="gp unselectable">...> </span><span class="w"> </span><span class="n">string</span><span class="p">,</span><span class="w"> </span><span class="ss">:currency_space</span><span class="w"> </span><span class="o">-></span><span class="w"> </span><span class="s">"<span>"</span><span class="w"> </span><span class="o"><></span><span class="w"> </span><span class="n">string</span><span class="w"> </span><span class="o"><></span><span class="w"> </span><span class="s">"</span>"</span><span class="w">
|
||||
</span><span class="gp unselectable">...> </span><span class="w"> </span><span class="n">string</span><span class="p">,</span><span class="w"> </span><span class="c">_other</span><span class="w"> </span><span class="o">-></span><span class="w"> </span><span class="n">string</span><span class="w">
|
||||
</span><span class="gp unselectable">...> </span><span class="k" data-group-id="4486999695-2">end</span><span class="p" data-group-id="4486999695-1">)</span><span class="w">
|
||||
</span><span class="p" data-group-id="4486999695-3">{</span><span class="ss">:ok</span><span class="p">,</span><span class="w"> </span><span class="s">"<span class=</span><span class="se">\"</span><span class="s">symbol</span><span class="se">\"</span><span class="s">>$</span><span class=</span><span class="se">\"</span><span class="s">number</span><span class="se">\"</span><span class="s">>100.00</span>"</span><span class="p" data-group-id="4486999695-3">}</span></code></pre><p>It is also possible and recommended to use the <a href="https://hexdocs.pm/phoenix_html/3.3.3/Phoenix.HTML.Tag.html#content_tag/3"><code class="inline">Phoenix.HTML.Tag.content_tag/3</code></a>
|
||||
</span><span class="gp unselectable">...> </span><span class="k" data-group-id="1685477682-2">end</span><span class="p" data-group-id="1685477682-1">)</span><span class="w">
|
||||
</span><span class="p" data-group-id="1685477682-3">{</span><span class="ss">:ok</span><span class="p">,</span><span class="w"> </span><span class="s">"<span class=</span><span class="se">\"</span><span class="s">symbol</span><span class="se">\"</span><span class="s">>$</span><span class=</span><span class="se">\"</span><span class="s">number</span><span class="se">\"</span><span class="s">>100.00</span>"</span><span class="p" data-group-id="1685477682-3">}</span></code></pre><p>It is also possible and recommended to use the <a href="https://hexdocs.pm/phoenix_html/3.3.3/Phoenix.HTML.Tag.html#content_tag/3"><code class="inline">Phoenix.HTML.Tag.content_tag/3</code></a>
|
||||
function if wrapping HTML tags since these will ensure HTML entities are
|
||||
correctly encoded. For example:</p><pre><code class="makeup elixir" translate="no"><span class="gp unselectable">iex> </span><span class="nc">Cldr.Number</span><span class="o">.</span><span class="n">to_string</span><span class="p" data-group-id="3665263265-1">(</span><span class="mi">100</span><span class="p">,</span><span class="w"> </span><span class="ss">format</span><span class="p">:</span><span class="w"> </span><span class="ss">:currency</span><span class="p">,</span><span class="w"> </span><span class="ss">currency</span><span class="p">:</span><span class="w"> </span><span class="ss">:USD</span><span class="p">,</span><span class="w"> </span><span class="ss">wrapper</span><span class="p">:</span><span class="w"> </span><span class="k" data-group-id="3665263265-2">fn</span><span class="w">
|
||||
</span><span class="gp unselectable">...> </span><span class="w"> </span><span class="n">string</span><span class="p">,</span><span class="w"> </span><span class="ss">:currency_symbol</span><span class="w"> </span><span class="o">-></span><span class="w"> </span><span class="nc">Phoenix.HTML.Tag</span><span class="o">.</span><span class="n">content_tag</span><span class="p" data-group-id="3665263265-3">(</span><span class="ss">:span</span><span class="p">,</span><span class="w"> </span><span class="n">string</span><span class="p">,</span><span class="w"> </span><span class="ss">class</span><span class="p">:</span><span class="w"> </span><span class="s">"symbol"</span><span class="p" data-group-id="3665263265-3">)</span><span class="w">
|
||||
</span><span class="gp unselectable">...> </span><span class="w"> </span><span class="n">string</span><span class="p">,</span><span class="w"> </span><span class="ss">:number</span><span class="w"> </span><span class="o">-></span><span class="w"> </span><span class="nc">Phoenix.HTML.Tag</span><span class="o">.</span><span class="n">content_tag</span><span class="p" data-group-id="3665263265-4">(</span><span class="ss">:span</span><span class="p">,</span><span class="w"> </span><span class="n">string</span><span class="p">,</span><span class="w"> </span><span class="ss">class</span><span class="p">:</span><span class="w"> </span><span class="s">"number"</span><span class="p" data-group-id="3665263265-4">)</span><span class="w">
|
||||
</span><span class="gp unselectable">...> </span><span class="w"> </span><span class="n">string</span><span class="p">,</span><span class="w"> </span><span class="ss">:currency_space</span><span class="w"> </span><span class="o">-></span><span class="w"> </span><span class="nc">Phoenix.HTML.Tag</span><span class="o">.</span><span class="n">content_tag</span><span class="p" data-group-id="3665263265-5">(</span><span class="ss">:span</span><span class="p">,</span><span class="w"> </span><span class="n">string</span><span class="p" data-group-id="3665263265-5">)</span><span class="w">
|
||||
correctly encoded. For example:</p><pre><code class="makeup elixir" translate="no"><span class="gp unselectable">iex> </span><span class="nc">Cldr.Number</span><span class="o">.</span><span class="n">to_string</span><span class="p" data-group-id="0203398270-1">(</span><span class="mi">100</span><span class="p">,</span><span class="w"> </span><span class="ss">format</span><span class="p">:</span><span class="w"> </span><span class="ss">:currency</span><span class="p">,</span><span class="w"> </span><span class="ss">currency</span><span class="p">:</span><span class="w"> </span><span class="ss">:USD</span><span class="p">,</span><span class="w"> </span><span class="ss">wrapper</span><span class="p">:</span><span class="w"> </span><span class="k" data-group-id="0203398270-2">fn</span><span class="w">
|
||||
</span><span class="gp unselectable">...> </span><span class="w"> </span><span class="n">string</span><span class="p">,</span><span class="w"> </span><span class="ss">:currency_symbol</span><span class="w"> </span><span class="o">-></span><span class="w"> </span><span class="nc">Phoenix.HTML.Tag</span><span class="o">.</span><span class="n">content_tag</span><span class="p" data-group-id="0203398270-3">(</span><span class="ss">:span</span><span class="p">,</span><span class="w"> </span><span class="n">string</span><span class="p">,</span><span class="w"> </span><span class="ss">class</span><span class="p">:</span><span class="w"> </span><span class="s">"symbol"</span><span class="p" data-group-id="0203398270-3">)</span><span class="w">
|
||||
</span><span class="gp unselectable">...> </span><span class="w"> </span><span class="n">string</span><span class="p">,</span><span class="w"> </span><span class="ss">:number</span><span class="w"> </span><span class="o">-></span><span class="w"> </span><span class="nc">Phoenix.HTML.Tag</span><span class="o">.</span><span class="n">content_tag</span><span class="p" data-group-id="0203398270-4">(</span><span class="ss">:span</span><span class="p">,</span><span class="w"> </span><span class="n">string</span><span class="p">,</span><span class="w"> </span><span class="ss">class</span><span class="p">:</span><span class="w"> </span><span class="s">"number"</span><span class="p" data-group-id="0203398270-4">)</span><span class="w">
|
||||
</span><span class="gp unselectable">...> </span><span class="w"> </span><span class="n">string</span><span class="p">,</span><span class="w"> </span><span class="ss">:currency_space</span><span class="w"> </span><span class="o">-></span><span class="w"> </span><span class="nc">Phoenix.HTML.Tag</span><span class="o">.</span><span class="n">content_tag</span><span class="p" data-group-id="0203398270-5">(</span><span class="ss">:span</span><span class="p">,</span><span class="w"> </span><span class="n">string</span><span class="p" data-group-id="0203398270-5">)</span><span class="w">
|
||||
</span><span class="gp unselectable">...> </span><span class="w"> </span><span class="n">string</span><span class="p">,</span><span class="w"> </span><span class="c">_other</span><span class="w"> </span><span class="o">-></span><span class="w"> </span><span class="n">string</span><span class="w">
|
||||
</span><span class="gp unselectable">...> </span><span class="k" data-group-id="3665263265-2">end</span><span class="p" data-group-id="3665263265-1">)</span><span class="w">
|
||||
</span><span class="p" data-group-id="3665263265-6">{</span><span class="ss">:ok</span><span class="p">,</span><span class="w"> </span><span class="s">"<span class=</span><span class="se">\"</span><span class="s">symbol</span><span class="se">\"</span><span class="s">>$</span><span class=</span><span class="se">\"</span><span class="s">number</span><span class="se">\"</span><span class="s">>100.00</span>"</span><span class="p" data-group-id="3665263265-6">}</span></code></pre><p>When formatting a number the format is parsed into format elements that might include
|
||||
</span><span class="gp unselectable">...> </span><span class="k" data-group-id="0203398270-2">end</span><span class="p" data-group-id="0203398270-1">)</span><span class="w">
|
||||
</span><span class="p" data-group-id="0203398270-6">{</span><span class="ss">:ok</span><span class="p">,</span><span class="w"> </span><span class="s">"<span class=</span><span class="se">\"</span><span class="s">symbol</span><span class="se">\"</span><span class="s">>$</span><span class=</span><span class="se">\"</span><span class="s">number</span><span class="se">\"</span><span class="s">>100.00</span>"</span><span class="p" data-group-id="0203398270-6">}</span></code></pre><p>When formatting a number the format is parsed into format elements that might include
|
||||
a currency symbol, a literal string, inserted text between a currency symbol and the
|
||||
currency amount, a percent sign, the number itself and several other elements. In
|
||||
some cases it is helpful to be apply specific formatting to each element.
|
||||
@ -1168,80 +1168,80 @@ inserted in the final formatted number.</p><h2 id="to_string/2-returns" class="s
|
||||
<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</span><span class="o">.</span><span class="n">to_string</span><span class="w"> </span><span class="mi">12345</span><span class="w">
|
||||
</span><span class="p" data-group-id="5896057229-1">{</span><span class="ss">:ok</span><span class="p">,</span><span class="w"> </span><span class="s">"12,345"</span><span class="p" data-group-id="5896057229-1">}</span><span class="w">
|
||||
</span><span class="p" data-group-id="5158986125-1">{</span><span class="ss">:ok</span><span class="p">,</span><span class="w"> </span><span class="s">"12,345"</span><span class="p" data-group-id="5158986125-1">}</span><span class="w">
|
||||
|
||||
</span><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr.Number</span><span class="o">.</span><span class="n">to_string</span><span class="w"> </span><span class="mi">12345</span><span class="p">,</span><span class="w"> </span><span class="ss">locale</span><span class="p">:</span><span class="w"> </span><span class="s">"fr"</span><span class="w">
|
||||
</span><span class="p" data-group-id="5896057229-2">{</span><span class="ss">:ok</span><span class="p">,</span><span class="w"> </span><span class="s">"12 345"</span><span class="p" data-group-id="5896057229-2">}</span><span class="w">
|
||||
</span><span class="p" data-group-id="5158986125-2">{</span><span class="ss">:ok</span><span class="p">,</span><span class="w"> </span><span class="s">"12 345"</span><span class="p" data-group-id="5158986125-2">}</span><span class="w">
|
||||
|
||||
</span><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr.Number</span><span class="o">.</span><span class="n">to_string</span><span class="w"> </span><span class="mf">1345.32</span><span class="p">,</span><span class="w"> </span><span class="ss">currency</span><span class="p">:</span><span class="w"> </span><span class="ss">:EUR</span><span class="p">,</span><span class="w"> </span><span class="ss">locale</span><span class="p">:</span><span class="w"> </span><span class="s">"es"</span><span class="p">,</span><span class="w"> </span><span class="ss">minimum_grouping_digits</span><span class="p">:</span><span class="w"> </span><span class="mi">1</span><span class="w">
|
||||
</span><span class="p" data-group-id="5896057229-3">{</span><span class="ss">:ok</span><span class="p">,</span><span class="w"> </span><span class="s">"1.345,32 €"</span><span class="p" data-group-id="5896057229-3">}</span><span class="w">
|
||||
</span><span class="p" data-group-id="5158986125-3">{</span><span class="ss">:ok</span><span class="p">,</span><span class="w"> </span><span class="s">"1.345,32 €"</span><span class="p" data-group-id="5158986125-3">}</span><span class="w">
|
||||
|
||||
</span><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr.Number</span><span class="o">.</span><span class="n">to_string</span><span class="w"> </span><span class="mf">1345.32</span><span class="p">,</span><span class="w"> </span><span class="ss">currency</span><span class="p">:</span><span class="w"> </span><span class="ss">:EUR</span><span class="p">,</span><span class="w"> </span><span class="ss">locale</span><span class="p">:</span><span class="w"> </span><span class="s">"es"</span><span class="w">
|
||||
</span><span class="p" data-group-id="5896057229-4">{</span><span class="ss">:ok</span><span class="p">,</span><span class="w"> </span><span class="s">"1345,32 €"</span><span class="p" data-group-id="5896057229-4">}</span><span class="w">
|
||||
</span><span class="p" data-group-id="5158986125-4">{</span><span class="ss">:ok</span><span class="p">,</span><span class="w"> </span><span class="s">"1345,32 €"</span><span class="p" data-group-id="5158986125-4">}</span><span class="w">
|
||||
|
||||
</span><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr.Number</span><span class="o">.</span><span class="n">to_string</span><span class="w"> </span><span class="mi">12345</span><span class="p">,</span><span class="w"> </span><span class="ss">locale</span><span class="p">:</span><span class="w"> </span><span class="s">"fr"</span><span class="p">,</span><span class="w"> </span><span class="ss">currency</span><span class="p">:</span><span class="w"> </span><span class="s">"USD"</span><span class="w">
|
||||
</span><span class="p" data-group-id="5896057229-5">{</span><span class="ss">:ok</span><span class="p">,</span><span class="w"> </span><span class="s">"12 345,00 $US"</span><span class="p" data-group-id="5896057229-5">}</span><span class="w">
|
||||
</span><span class="p" data-group-id="5158986125-5">{</span><span class="ss">:ok</span><span class="p">,</span><span class="w"> </span><span class="s">"12 345,00 $US"</span><span class="p" data-group-id="5158986125-5">}</span><span class="w">
|
||||
|
||||
</span><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr.Number</span><span class="o">.</span><span class="n">to_string</span><span class="w"> </span><span class="mi">12345</span><span class="p">,</span><span class="w"> </span><span class="ss">format</span><span class="p">:</span><span class="w"> </span><span class="s">"#E0"</span><span class="w">
|
||||
</span><span class="p" data-group-id="5896057229-6">{</span><span class="ss">:ok</span><span class="p">,</span><span class="w"> </span><span class="s">"1.2345E4"</span><span class="p" data-group-id="5896057229-6">}</span><span class="w">
|
||||
</span><span class="p" data-group-id="5158986125-6">{</span><span class="ss">:ok</span><span class="p">,</span><span class="w"> </span><span class="s">"1.2345E4"</span><span class="p" data-group-id="5158986125-6">}</span><span class="w">
|
||||
|
||||
</span><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr.Number</span><span class="o">.</span><span class="n">to_string</span><span class="w"> </span><span class="mi">12345</span><span class="p">,</span><span class="w"> </span><span class="ss">format</span><span class="p">:</span><span class="w"> </span><span class="ss">:accounting</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">"THB"</span><span class="w">
|
||||
</span><span class="p" data-group-id="5896057229-7">{</span><span class="ss">:ok</span><span class="p">,</span><span class="w"> </span><span class="s">"THB 12,345.00"</span><span class="p" data-group-id="5896057229-7">}</span><span class="w">
|
||||
</span><span class="p" data-group-id="5158986125-7">{</span><span class="ss">:ok</span><span class="p">,</span><span class="w"> </span><span class="s">"THB 12,345.00"</span><span class="p" data-group-id="5158986125-7">}</span><span class="w">
|
||||
|
||||
</span><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr.Number</span><span class="o">.</span><span class="n">to_string</span><span class="w"> </span><span class="o">-</span><span class="mi">12345</span><span class="p">,</span><span class="w"> </span><span class="ss">format</span><span class="p">:</span><span class="w"> </span><span class="ss">:accounting</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">"THB"</span><span class="w">
|
||||
</span><span class="p" data-group-id="5896057229-8">{</span><span class="ss">:ok</span><span class="p">,</span><span class="w"> </span><span class="s">"(THB 12,345.00)"</span><span class="p" data-group-id="5896057229-8">}</span><span class="w">
|
||||
</span><span class="p" data-group-id="5158986125-8">{</span><span class="ss">:ok</span><span class="p">,</span><span class="w"> </span><span class="s">"(THB 12,345.00)"</span><span class="p" data-group-id="5158986125-8">}</span><span class="w">
|
||||
|
||||
</span><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr.Number</span><span class="o">.</span><span class="n">to_string</span><span class="w"> </span><span class="mi">12345</span><span class="p">,</span><span class="w"> </span><span class="ss">format</span><span class="p">:</span><span class="w"> </span><span class="ss">:accounting</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">"THB"</span><span class="p">,</span><span class="w">
|
||||
</span><span class="gp unselectable">...> </span><span class="ss">locale</span><span class="p">:</span><span class="w"> </span><span class="s">"th"</span><span class="w">
|
||||
</span><span class="p" data-group-id="5896057229-9">{</span><span class="ss">:ok</span><span class="p">,</span><span class="w"> </span><span class="s">"฿12,345.00"</span><span class="p" data-group-id="5896057229-9">}</span><span class="w">
|
||||
</span><span class="p" data-group-id="5158986125-9">{</span><span class="ss">:ok</span><span class="p">,</span><span class="w"> </span><span class="s">"฿12,345.00"</span><span class="p" data-group-id="5158986125-9">}</span><span class="w">
|
||||
|
||||
</span><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr.Number</span><span class="o">.</span><span class="n">to_string</span><span class="w"> </span><span class="mi">12345</span><span class="p">,</span><span class="w"> </span><span class="ss">format</span><span class="p">:</span><span class="w"> </span><span class="ss">:accounting</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">"THB"</span><span class="p">,</span><span class="w">
|
||||
</span><span class="gp unselectable">...> </span><span class="ss">locale</span><span class="p">:</span><span class="w"> </span><span class="s">"th"</span><span class="p">,</span><span class="w"> </span><span class="ss">number_system</span><span class="p">:</span><span class="w"> </span><span class="ss">:native</span><span class="w">
|
||||
</span><span class="p" data-group-id="5896057229-10">{</span><span class="ss">:ok</span><span class="p">,</span><span class="w"> </span><span class="s">"฿๑๒,๓๔๕.๐๐"</span><span class="p" data-group-id="5896057229-10">}</span><span class="w">
|
||||
</span><span class="p" data-group-id="5158986125-10">{</span><span class="ss">:ok</span><span class="p">,</span><span class="w"> </span><span class="s">"฿๑๒,๓๔๕.๐๐"</span><span class="p" data-group-id="5158986125-10">}</span><span class="w">
|
||||
|
||||
</span><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr.Number</span><span class="o">.</span><span class="n">to_string</span><span class="w"> </span><span class="mf">1244.30</span><span class="p">,</span><span class="w"> </span><span class="ss">format</span><span class="p">:</span><span class="w"> </span><span class="ss">:long</span><span class="w">
|
||||
</span><span class="p" data-group-id="5896057229-11">{</span><span class="ss">:ok</span><span class="p">,</span><span class="w"> </span><span class="s">"1 thousand"</span><span class="p" data-group-id="5896057229-11">}</span><span class="w">
|
||||
</span><span class="p" data-group-id="5158986125-11">{</span><span class="ss">:ok</span><span class="p">,</span><span class="w"> </span><span class="s">"1 thousand"</span><span class="p" data-group-id="5158986125-11">}</span><span class="w">
|
||||
|
||||
</span><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr.Number</span><span class="o">.</span><span class="n">to_string</span><span class="w"> </span><span class="mf">1244.30</span><span class="p">,</span><span class="w"> </span><span class="ss">format</span><span class="p">:</span><span class="w"> </span><span class="ss">:long</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">"USD"</span><span class="w">
|
||||
</span><span class="p" data-group-id="5896057229-12">{</span><span class="ss">:ok</span><span class="p">,</span><span class="w"> </span><span class="s">"1,244 US dollars"</span><span class="p" data-group-id="5896057229-12">}</span><span class="w">
|
||||
</span><span class="p" data-group-id="5158986125-12">{</span><span class="ss">:ok</span><span class="p">,</span><span class="w"> </span><span class="s">"1,244 US dollars"</span><span class="p" data-group-id="5158986125-12">}</span><span class="w">
|
||||
|
||||
</span><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr.Number</span><span class="o">.</span><span class="n">to_string</span><span class="w"> </span><span class="mf">1244.30</span><span class="p">,</span><span class="w"> </span><span class="ss">format</span><span class="p">:</span><span class="w"> </span><span class="ss">:short</span><span class="w">
|
||||
</span><span class="p" data-group-id="5896057229-13">{</span><span class="ss">:ok</span><span class="p">,</span><span class="w"> </span><span class="s">"1K"</span><span class="p" data-group-id="5896057229-13">}</span><span class="w">
|
||||
</span><span class="p" data-group-id="5158986125-13">{</span><span class="ss">:ok</span><span class="p">,</span><span class="w"> </span><span class="s">"1K"</span><span class="p" data-group-id="5158986125-13">}</span><span class="w">
|
||||
|
||||
</span><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr.Number</span><span class="o">.</span><span class="n">to_string</span><span class="w"> </span><span class="mf">1244.30</span><span class="p">,</span><span class="w"> </span><span class="ss">format</span><span class="p">:</span><span class="w"> </span><span class="ss">:short</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">"EUR"</span><span class="w">
|
||||
</span><span class="p" data-group-id="5896057229-14">{</span><span class="ss">:ok</span><span class="p">,</span><span class="w"> </span><span class="s">"€1K"</span><span class="p" data-group-id="5896057229-14">}</span><span class="w">
|
||||
</span><span class="p" data-group-id="5158986125-14">{</span><span class="ss">:ok</span><span class="p">,</span><span class="w"> </span><span class="s">"€1K"</span><span class="p" data-group-id="5158986125-14">}</span><span class="w">
|
||||
|
||||
</span><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr.Number</span><span class="o">.</span><span class="n">to_string</span><span class="w"> </span><span class="mi">1234</span><span class="p">,</span><span class="w"> </span><span class="ss">format</span><span class="p">:</span><span class="w"> </span><span class="ss">:spellout</span><span class="w">
|
||||
</span><span class="p" data-group-id="5896057229-15">{</span><span class="ss">:ok</span><span class="p">,</span><span class="w"> </span><span class="s">"one thousand two hundred thirty-four"</span><span class="p" data-group-id="5896057229-15">}</span><span class="w">
|
||||
</span><span class="p" data-group-id="5158986125-15">{</span><span class="ss">:ok</span><span class="p">,</span><span class="w"> </span><span class="s">"one thousand two hundred thirty-four"</span><span class="p" data-group-id="5158986125-15">}</span><span class="w">
|
||||
|
||||
</span><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr.Number</span><span class="o">.</span><span class="n">to_string</span><span class="w"> </span><span class="mi">1234</span><span class="p">,</span><span class="w"> </span><span class="ss">format</span><span class="p">:</span><span class="w"> </span><span class="ss">:spellout_verbose</span><span class="w">
|
||||
</span><span class="p" data-group-id="5896057229-16">{</span><span class="ss">:ok</span><span class="p">,</span><span class="w"> </span><span class="s">"one thousand two hundred and thirty-four"</span><span class="p" data-group-id="5896057229-16">}</span><span class="w">
|
||||
</span><span class="p" data-group-id="5158986125-16">{</span><span class="ss">:ok</span><span class="p">,</span><span class="w"> </span><span class="s">"one thousand two hundred and thirty-four"</span><span class="p" data-group-id="5158986125-16">}</span><span class="w">
|
||||
|
||||
</span><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr.Number</span><span class="o">.</span><span class="n">to_string</span><span class="w"> </span><span class="mi">1989</span><span class="p">,</span><span class="w"> </span><span class="ss">format</span><span class="p">:</span><span class="w"> </span><span class="ss">:spellout_year</span><span class="w">
|
||||
</span><span class="p" data-group-id="5896057229-17">{</span><span class="ss">:ok</span><span class="p">,</span><span class="w"> </span><span class="s">"nineteen eighty-nine"</span><span class="p" data-group-id="5896057229-17">}</span><span class="w">
|
||||
</span><span class="p" data-group-id="5158986125-17">{</span><span class="ss">:ok</span><span class="p">,</span><span class="w"> </span><span class="s">"nineteen eighty-nine"</span><span class="p" data-group-id="5158986125-17">}</span><span class="w">
|
||||
|
||||
</span><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr.Number</span><span class="o">.</span><span class="n">to_string</span><span class="w"> </span><span class="mi">123</span><span class="p">,</span><span class="w"> </span><span class="ss">format</span><span class="p">:</span><span class="w"> </span><span class="ss">:ordinal</span><span class="w">
|
||||
</span><span class="p" data-group-id="5896057229-18">{</span><span class="ss">:ok</span><span class="p">,</span><span class="w"> </span><span class="s">"123rd"</span><span class="p" data-group-id="5896057229-18">}</span><span class="w">
|
||||
</span><span class="p" data-group-id="5158986125-18">{</span><span class="ss">:ok</span><span class="p">,</span><span class="w"> </span><span class="s">"123rd"</span><span class="p" data-group-id="5158986125-18">}</span><span class="w">
|
||||
|
||||
</span><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr.Number</span><span class="o">.</span><span class="n">to_string</span><span class="w"> </span><span class="mi">123</span><span class="p">,</span><span class="w"> </span><span class="ss">format</span><span class="p">:</span><span class="w"> </span><span class="ss">:roman</span><span class="w">
|
||||
</span><span class="p" data-group-id="5896057229-19">{</span><span class="ss">:ok</span><span class="p">,</span><span class="w"> </span><span class="s">"CXXIII"</span><span class="p" data-group-id="5896057229-19">}</span><span class="w">
|
||||
</span><span class="p" data-group-id="5158986125-19">{</span><span class="ss">:ok</span><span class="p">,</span><span class="w"> </span><span class="s">"CXXIII"</span><span class="p" data-group-id="5158986125-19">}</span><span class="w">
|
||||
|
||||
</span><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr.Number</span><span class="o">.</span><span class="n">to_string</span><span class="w"> </span><span class="mi">123</span><span class="p">,</span><span class="w"> </span><span class="ss">locale</span><span class="p">:</span><span class="w"> </span><span class="s">"th-u-nu-thai"</span><span class="w">
|
||||
</span><span class="p" data-group-id="5896057229-20">{</span><span class="ss">:ok</span><span class="p">,</span><span class="w"> </span><span class="s">"๑๒๓"</span><span class="p" data-group-id="5896057229-20">}</span></code></pre><h2 id="to_string/2-errors" class="section-heading">
|
||||
</span><span class="p" data-group-id="5158986125-20">{</span><span class="ss">:ok</span><span class="p">,</span><span class="w"> </span><span class="s">"๑๒๓"</span><span class="p" data-group-id="5158986125-20">}</span></code></pre><h2 id="to_string/2-errors" class="section-heading">
|
||||
<a href="#to_string/2-errors" class="hover-link">
|
||||
<i class="ri-link-m" aria-hidden="true"></i>
|
||||
</a>
|
||||
<span class="text">Errors</span>
|
||||
</h2>
|
||||
<p>An error tuple <code class="inline">{:error, reason}</code> will be returned if an error is detected.
|
||||
The two most likely causes of an error return are:</p><ul><li>A format cannot be compiled. In this case the error tuple will look like:</li></ul><pre><code class="makeup elixir" translate="no"><span class="w"> </span><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr.Number</span><span class="o">.</span><span class="n">to_string</span><span class="p" data-group-id="7835757476-1">(</span><span class="mi">12345</span><span class="p">,</span><span class="w"> </span><span class="ss">format</span><span class="p">:</span><span class="w"> </span><span class="s">"0#"</span><span class="p" data-group-id="7835757476-1">)</span><span class="w">
|
||||
</span><span class="p" data-group-id="7835757476-2">{</span><span class="ss">:error</span><span class="p">,</span><span class="w"> </span><span class="p" data-group-id="7835757476-3">{</span><span class="nc">Cldr.FormatCompileError</span><span class="p">,</span><span class="w">
|
||||
</span><span class="s">"Decimal format compiler: syntax error before: </span><span class="se">\"</span><span class="s">#</span><span class="se">\"</span><span class="s">"</span><span class="p" data-group-id="7835757476-3">}</span><span class="p" data-group-id="7835757476-2">}</span></code></pre><ul><li>The format style requested is not defined for the <code class="inline">locale</code> and
|
||||
The two most likely causes of an error return are:</p><ul><li>A format cannot be compiled. In this case the error tuple will look like:</li></ul><pre><code class="makeup elixir" translate="no"><span class="w"> </span><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr.Number</span><span class="o">.</span><span class="n">to_string</span><span class="p" data-group-id="1594149628-1">(</span><span class="mi">12345</span><span class="p">,</span><span class="w"> </span><span class="ss">format</span><span class="p">:</span><span class="w"> </span><span class="s">"0#"</span><span class="p" data-group-id="1594149628-1">)</span><span class="w">
|
||||
</span><span class="p" data-group-id="1594149628-2">{</span><span class="ss">:error</span><span class="p">,</span><span class="w"> </span><span class="p" data-group-id="1594149628-3">{</span><span class="nc">Cldr.FormatCompileError</span><span class="p">,</span><span class="w">
|
||||
</span><span class="s">"Decimal format compiler: syntax error before: </span><span class="se">\"</span><span class="s">#</span><span class="se">\"</span><span class="s">"</span><span class="p" data-group-id="1594149628-3">}</span><span class="p" data-group-id="1594149628-2">}</span></code></pre><ul><li>The format style requested is not defined for the <code class="inline">locale</code> and
|
||||
<code class="inline">number_system</code>. This happens typically when the number system is
|
||||
<code class="inline">:algorithmic</code> rather than the more common <code class="inline">:numeric</code>. In this case the error
|
||||
return looks like:</li></ul><pre><code class="makeup elixir" translate="no"><span class="w"> </span><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr.Number</span><span class="o">.</span><span class="n">to_string</span><span class="p" data-group-id="8191059142-1">(</span><span class="mi">1234</span><span class="p">,</span><span class="w"> </span><span class="ss">locale</span><span class="p">:</span><span class="w"> </span><span class="s">"he"</span><span class="p">,</span><span class="w"> </span><span class="ss">number_system</span><span class="p">:</span><span class="w"> </span><span class="s">"hebr"</span><span class="p">,</span><span class="w"> </span><span class="ss">format</span><span class="p">:</span><span class="w"> </span><span class="ss">:percent</span><span class="p" data-group-id="8191059142-1">)</span><span class="w">
|
||||
</span><span class="p" data-group-id="8191059142-2">{</span><span class="ss">:error</span><span class="p">,</span><span class="w"> </span><span class="p" data-group-id="8191059142-3">{</span><span class="nc">Cldr.UnknownFormatError</span><span class="p">,</span><span class="w">
|
||||
</span><span class="s">"The locale :he with number system :hebr does not define a format :percent"</span><span class="p" data-group-id="8191059142-3">}</span><span class="p" data-group-id="8191059142-2">}</span></code></pre>
|
||||
return looks like:</li></ul><pre><code class="makeup elixir" translate="no"><span class="w"> </span><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr.Number</span><span class="o">.</span><span class="n">to_string</span><span class="p" data-group-id="4650733993-1">(</span><span class="mi">1234</span><span class="p">,</span><span class="w"> </span><span class="ss">locale</span><span class="p">:</span><span class="w"> </span><span class="s">"he"</span><span class="p">,</span><span class="w"> </span><span class="ss">number_system</span><span class="p">:</span><span class="w"> </span><span class="s">"hebr"</span><span class="p">,</span><span class="w"> </span><span class="ss">format</span><span class="p">:</span><span class="w"> </span><span class="ss">:percent</span><span class="p" data-group-id="4650733993-1">)</span><span class="w">
|
||||
</span><span class="p" data-group-id="4650733993-2">{</span><span class="ss">:error</span><span class="p">,</span><span class="w"> </span><span class="p" data-group-id="4650733993-3">{</span><span class="nc">Cldr.UnknownFormatError</span><span class="p">,</span><span class="w">
|
||||
</span><span class="s">"The locale :he with number system :hebr does not define a format :percent"</span><span class="p" data-group-id="4650733993-3">}</span><span class="p" data-group-id="4650733993-2">}</span></code></pre>
|
||||
</section>
|
||||
</section>
|
||||
<section class="detail" id="to_string!/2">
|
||||
@ -1346,17 +1346,17 @@ returned by <a href="https://hexdocs.pm/ex_cldr/2.37.5/Cldr.html#known_number_sy
|
||||
<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</span><span class="o">.</span><span class="n">validate_number_system</span><span class="w"> </span><span class="s">"en"</span><span class="p">,</span><span class="w"> </span><span class="ss">:latn</span><span class="w">
|
||||
</span><span class="p" data-group-id="2894739045-1">{</span><span class="ss">:ok</span><span class="p">,</span><span class="w"> </span><span class="ss">:latn</span><span class="p" data-group-id="2894739045-1">}</span><span class="w">
|
||||
</span><span class="p" data-group-id="5654497049-1">{</span><span class="ss">:ok</span><span class="p">,</span><span class="w"> </span><span class="ss">:latn</span><span class="p" data-group-id="5654497049-1">}</span><span class="w">
|
||||
|
||||
</span><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr.Number</span><span class="o">.</span><span class="n">validate_number_system</span><span class="w"> </span><span class="s">"en"</span><span class="p">,</span><span class="w"> </span><span class="ss">:default</span><span class="w">
|
||||
</span><span class="p" data-group-id="2894739045-2">{</span><span class="ss">:ok</span><span class="p">,</span><span class="w"> </span><span class="ss">:latn</span><span class="p" data-group-id="2894739045-2">}</span><span class="w">
|
||||
</span><span class="p" data-group-id="5654497049-2">{</span><span class="ss">:ok</span><span class="p">,</span><span class="w"> </span><span class="ss">:latn</span><span class="p" data-group-id="5654497049-2">}</span><span class="w">
|
||||
|
||||
</span><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr.Number</span><span class="o">.</span><span class="n">validate_number_system</span><span class="w"> </span><span class="s">"en"</span><span class="p">,</span><span class="w"> </span><span class="ss">:unknown</span><span class="w">
|
||||
</span><span class="p" data-group-id="2894739045-3">{</span><span class="ss">:error</span><span class="p">,</span><span class="w">
|
||||
</span><span class="p" data-group-id="2894739045-4">{</span><span class="nc">Cldr.UnknownNumberSystemError</span><span class="p">,</span><span class="w"> </span><span class="s">"The number system :unknown is unknown"</span><span class="p" data-group-id="2894739045-4">}</span><span class="p" data-group-id="2894739045-3">}</span><span class="w">
|
||||
</span><span class="p" data-group-id="5654497049-3">{</span><span class="ss">:error</span><span class="p">,</span><span class="w">
|
||||
</span><span class="p" data-group-id="5654497049-4">{</span><span class="nc">Cldr.UnknownNumberSystemError</span><span class="p">,</span><span class="w"> </span><span class="s">"The number system :unknown is unknown"</span><span class="p" data-group-id="5654497049-4">}</span><span class="p" data-group-id="5654497049-3">}</span><span class="w">
|
||||
|
||||
</span><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr.Number</span><span class="o">.</span><span class="n">validate_number_system</span><span class="w"> </span><span class="s">"zz"</span><span class="p">,</span><span class="w"> </span><span class="ss">:default</span><span class="w">
|
||||
</span><span class="p" data-group-id="2894739045-5">{</span><span class="ss">:error</span><span class="p">,</span><span class="w"> </span><span class="p" data-group-id="2894739045-6">{</span><span class="nc">Cldr.InvalidLanguageError</span><span class="p">,</span><span class="w"> </span><span class="s">"The language </span><span class="se">\"</span><span class="s">zz</span><span class="se">\"</span><span class="s"> is invalid"</span><span class="p" data-group-id="2894739045-6">}</span><span class="p" data-group-id="2894739045-5">}</span></code></pre>
|
||||
</span><span class="p" data-group-id="5654497049-5">{</span><span class="ss">:error</span><span class="p">,</span><span class="w"> </span><span class="p" data-group-id="5654497049-6">{</span><span class="nc">Cldr.InvalidLanguageError</span><span class="p">,</span><span class="w"> </span><span class="s">"The language </span><span class="se">\"</span><span class="s">zz</span><span class="se">\"</span><span class="s"> is invalid"</span><span class="p" data-group-id="5654497049-6">}</span><span class="p" data-group-id="5654497049-5">}</span></code></pre>
|
||||
</section>
|
||||
</section>
|
||||
|
||||
|
@ -145,9 +145,9 @@ Pages
|
||||
<section id="moduledoc">
|
||||
<p>Functions to implement the number system rule-based-number-format rules of CLDR.</p><p>These rules are defined only on the "und" locale and represent specialised
|
||||
number formatting.</p><p>The standard public API for RBNF is via the <a href="https://hexdocs.pm/ex_cldr_numbers/2.32.3/Cldr.Number.html#to_string/2"><code class="inline">Cldr.Number.to_string/2</code></a> function.</p><p>The functions on this module are defined at compile time based upon the RBNF rules
|
||||
defined in the Unicode CLDR data repository. Available rules are identified by:</p><pre><code class="makeup elixir" translate="no"><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr.Rbnf.NumberSystem</span><span class="o">.</span><span class="n">rule_sets</span><span class="p" data-group-id="3153682810-1">(</span><span class="ss">:und</span><span class="p" data-group-id="3153682810-1">)</span><span class="w">
|
||||
</span><span class="gp unselectable">...> </span><span class="o">|></span><span class="w"> </span><span class="nc">Enum</span><span class="o">.</span><span class="n">sort</span><span class="p" data-group-id="3153682810-2">(</span><span class="p" data-group-id="3153682810-2">)</span><span class="w">
|
||||
</span><span class="p" data-group-id="3153682810-3">[</span><span class="w">
|
||||
defined in the Unicode CLDR data repository. Available rules are identified by:</p><pre><code class="makeup elixir" translate="no"><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr.Rbnf.NumberSystem</span><span class="o">.</span><span class="n">rule_sets</span><span class="p" data-group-id="2731909759-1">(</span><span class="ss">:und</span><span class="p" data-group-id="2731909759-1">)</span><span class="w">
|
||||
</span><span class="gp unselectable">...> </span><span class="o">|></span><span class="w"> </span><span class="nc">Enum</span><span class="o">.</span><span class="n">sort</span><span class="p" data-group-id="2731909759-2">(</span><span class="p" data-group-id="2731909759-2">)</span><span class="w">
|
||||
</span><span class="p" data-group-id="2731909759-3">[</span><span class="w">
|
||||
</span><span class="ss">:armenian_lower</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">:armenian_upper</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">:cyrillic_lower</span><span class="p">,</span><span class="w">
|
||||
@ -161,9 +161,9 @@ defined in the Unicode CLDR data repository. Available rules are identified by:
|
||||
</span><span class="ss">:roman_upper</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">:tamil</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">:zz_default</span><span class="w">
|
||||
</span><span class="p" data-group-id="3153682810-3">]</span></code></pre><p>A rule can then be invoked on an available rule_set. For example</p><pre><code class="makeup elixir" translate="no"><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr.Rbnf.NumberSystem</span><span class="o">.</span><span class="n">roman_upper</span><span class="p" data-group-id="1579101289-1">(</span><span class="mi">123</span><span class="p">,</span><span class="w"> </span><span class="ss">:und</span><span class="p" data-group-id="1579101289-1">)</span><span class="w">
|
||||
</span><span class="s">"CXXIII"</span></code></pre><p>This particular call is equivalent to the call through the public API of:</p><pre><code class="makeup elixir" translate="no"><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr.Number</span><span class="o">.</span><span class="n">to_string</span><span class="p" data-group-id="6622567733-1">(</span><span class="mi">123</span><span class="p">,</span><span class="w"> </span><span class="ss">format</span><span class="p">:</span><span class="w"> </span><span class="ss">:roman</span><span class="p" data-group-id="6622567733-1">)</span><span class="w">
|
||||
</span><span class="p" data-group-id="6622567733-2">{</span><span class="ss">:ok</span><span class="p">,</span><span class="w"> </span><span class="s">"CXXIII"</span><span class="p" data-group-id="6622567733-2">}</span></code></pre>
|
||||
</span><span class="p" data-group-id="2731909759-3">]</span></code></pre><p>A rule can then be invoked on an available rule_set. For example</p><pre><code class="makeup elixir" translate="no"><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr.Rbnf.NumberSystem</span><span class="o">.</span><span class="n">roman_upper</span><span class="p" data-group-id="7123894959-1">(</span><span class="mi">123</span><span class="p">,</span><span class="w"> </span><span class="ss">:und</span><span class="p" data-group-id="7123894959-1">)</span><span class="w">
|
||||
</span><span class="s">"CXXIII"</span></code></pre><p>This particular call is equivalent to the call through the public API of:</p><pre><code class="makeup elixir" translate="no"><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr.Number</span><span class="o">.</span><span class="n">to_string</span><span class="p" data-group-id="5222712891-1">(</span><span class="mi">123</span><span class="p">,</span><span class="w"> </span><span class="ss">format</span><span class="p">:</span><span class="w"> </span><span class="ss">:roman</span><span class="p" data-group-id="5222712891-1">)</span><span class="w">
|
||||
</span><span class="p" data-group-id="5222712891-2">{</span><span class="ss">:ok</span><span class="p">,</span><span class="w"> </span><span class="s">"CXXIII"</span><span class="p" data-group-id="5222712891-2">}</span></code></pre>
|
||||
</section>
|
||||
|
||||
|
||||
|
@ -145,20 +145,20 @@ Pages
|
||||
<section id="moduledoc">
|
||||
<p>Functions to implement the ordinal rule-based-number-format rules of CLDR.</p><p>As CLDR notes, the data is incomplete or non-existent for many languages. It
|
||||
is considered complete for English however.</p><p>The standard public API for RBNF is via the <a href="https://hexdocs.pm/ex_cldr_numbers/2.32.3/Cldr.Number.html#to_string/2"><code class="inline">Cldr.Number.to_string/2</code></a> function.</p><p>The functions on this module are defined at compile time based upon the RBNF rules
|
||||
defined in the Unicode CLDR data repository. Available rules are identified by:</p><pre><code class="makeup elixir" translate="no"><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr.Rbnf.Ordinal</span><span class="o">.</span><span class="n">rule_sets</span><span class="p" data-group-id="5474782674-1">(</span><span class="ss">:en</span><span class="p" data-group-id="5474782674-1">)</span><span class="w">
|
||||
</span><span class="p" data-group-id="5474782674-2">[</span><span class="ss">:digits_ordinal</span><span class="p" data-group-id="5474782674-2">]</span><span class="w">
|
||||
defined in the Unicode CLDR data repository. Available rules are identified by:</p><pre><code class="makeup elixir" translate="no"><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr.Rbnf.Ordinal</span><span class="o">.</span><span class="n">rule_sets</span><span class="p" data-group-id="5477334330-1">(</span><span class="ss">:en</span><span class="p" data-group-id="5477334330-1">)</span><span class="w">
|
||||
</span><span class="p" data-group-id="5477334330-2">[</span><span class="ss">:digits_ordinal</span><span class="p" data-group-id="5477334330-2">]</span><span class="w">
|
||||
|
||||
</span><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr.Rbnf.Ordinal</span><span class="o">.</span><span class="n">rule_sets</span><span class="p" data-group-id="5474782674-3">(</span><span class="s">"fr"</span><span class="p" data-group-id="5474782674-3">)</span><span class="w">
|
||||
</span><span class="gp unselectable">...> </span><span class="o">|></span><span class="w"> </span><span class="nc">Enum</span><span class="o">.</span><span class="n">sort</span><span class="p" data-group-id="5474782674-4">(</span><span class="p" data-group-id="5474782674-4">)</span><span class="w">
|
||||
</span><span class="p" data-group-id="5474782674-5">[</span><span class="w">
|
||||
</span><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr.Rbnf.Ordinal</span><span class="o">.</span><span class="n">rule_sets</span><span class="p" data-group-id="5477334330-3">(</span><span class="s">"fr"</span><span class="p" data-group-id="5477334330-3">)</span><span class="w">
|
||||
</span><span class="gp unselectable">...> </span><span class="o">|></span><span class="w"> </span><span class="nc">Enum</span><span class="o">.</span><span class="n">sort</span><span class="p" data-group-id="5477334330-4">(</span><span class="p" data-group-id="5477334330-4">)</span><span class="w">
|
||||
</span><span class="p" data-group-id="5477334330-5">[</span><span class="w">
|
||||
</span><span class="ss">:digits_ordinal</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">:digits_ordinal_feminine</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">:digits_ordinal_feminine_plural</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">:digits_ordinal_masculine</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">:digits_ordinal_masculine_plural</span><span class="w">
|
||||
</span><span class="p" data-group-id="5474782674-5">]</span></code></pre><p>A rule can then be invoked on an available rule_set. For example</p><pre><code class="makeup elixir" translate="no"><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr.Rbnf.Ordinal</span><span class="o">.</span><span class="n">digits_ordinal</span><span class="p" data-group-id="9447056976-1">(</span><span class="mi">123</span><span class="p">,</span><span class="w"> </span><span class="ss">:en</span><span class="p" data-group-id="9447056976-1">)</span><span class="w">
|
||||
</span><span class="s">"123rd"</span></code></pre><p>This call is equivalent to the call through the public API of:</p><pre><code class="makeup elixir" translate="no"><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr.Number</span><span class="o">.</span><span class="n">to_string</span><span class="p" data-group-id="1978799277-1">(</span><span class="mi">123</span><span class="p">,</span><span class="w"> </span><span class="ss">format</span><span class="p">:</span><span class="w"> </span><span class="ss">:ordinal</span><span class="p" data-group-id="1978799277-1">)</span><span class="w">
|
||||
</span><span class="p" data-group-id="1978799277-2">{</span><span class="ss">:ok</span><span class="p">,</span><span class="w"> </span><span class="s">"123rd"</span><span class="p" data-group-id="1978799277-2">}</span></code></pre>
|
||||
</span><span class="p" data-group-id="5477334330-5">]</span></code></pre><p>A rule can then be invoked on an available rule_set. For example</p><pre><code class="makeup elixir" translate="no"><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr.Rbnf.Ordinal</span><span class="o">.</span><span class="n">digits_ordinal</span><span class="p" data-group-id="4380162939-1">(</span><span class="mi">123</span><span class="p">,</span><span class="w"> </span><span class="ss">:en</span><span class="p" data-group-id="4380162939-1">)</span><span class="w">
|
||||
</span><span class="s">"123rd"</span></code></pre><p>This call is equivalent to the call through the public API of:</p><pre><code class="makeup elixir" translate="no"><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr.Number</span><span class="o">.</span><span class="n">to_string</span><span class="p" data-group-id="4519217757-1">(</span><span class="mi">123</span><span class="p">,</span><span class="w"> </span><span class="ss">format</span><span class="p">:</span><span class="w"> </span><span class="ss">:ordinal</span><span class="p" data-group-id="4519217757-1">)</span><span class="w">
|
||||
</span><span class="p" data-group-id="4519217757-2">{</span><span class="ss">:ok</span><span class="p">,</span><span class="w"> </span><span class="s">"123rd"</span><span class="p" data-group-id="4519217757-2">}</span></code></pre>
|
||||
</section>
|
||||
|
||||
|
||||
|
@ -145,9 +145,9 @@ Pages
|
||||
<section id="moduledoc">
|
||||
<p>Functions to implement the spellout rule-based-number-format rules of CLDR.</p><p>As CLDR notes, the data is incomplete or non-existent for many languages. It
|
||||
is considered complete for English however.</p><p>The standard public API for RBNF is via the <a href="https://hexdocs.pm/ex_cldr_numbers/2.32.3/Cldr.Number.html#to_string/2"><code class="inline">Cldr.Number.to_string/2</code></a> function.</p><p>The functions on this module are defined at compile time based upon the RBNF rules
|
||||
defined in the Unicode CLDR data repository. Available rules are identified by:</p><pre><code class="makeup elixir" translate="no"><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr.Rbnf.Spellout</span><span class="o">.</span><span class="n">rule_sets</span><span class="p" data-group-id="1335732774-1">(</span><span class="s">"en"</span><span class="p" data-group-id="1335732774-1">)</span><span class="w">
|
||||
</span><span class="gp unselectable">...> </span><span class="o">|></span><span class="w"> </span><span class="nc">Enum</span><span class="o">.</span><span class="n">sort</span><span class="p" data-group-id="1335732774-2">(</span><span class="p" data-group-id="1335732774-2">)</span><span class="w">
|
||||
</span><span class="p" data-group-id="1335732774-3">[</span><span class="w">
|
||||
defined in the Unicode CLDR data repository. Available rules are identified by:</p><pre><code class="makeup elixir" translate="no"><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr.Rbnf.Spellout</span><span class="o">.</span><span class="n">rule_sets</span><span class="p" data-group-id="1244348826-1">(</span><span class="s">"en"</span><span class="p" data-group-id="1244348826-1">)</span><span class="w">
|
||||
</span><span class="gp unselectable">...> </span><span class="o">|></span><span class="w"> </span><span class="nc">Enum</span><span class="o">.</span><span class="n">sort</span><span class="p" data-group-id="1244348826-2">(</span><span class="p" data-group-id="1244348826-2">)</span><span class="w">
|
||||
</span><span class="p" data-group-id="1244348826-3">[</span><span class="w">
|
||||
</span><span class="ss">:spellout_cardinal</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">:spellout_cardinal_verbose</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">:spellout_numbering</span><span class="p">,</span><span class="w">
|
||||
@ -155,9 +155,9 @@ defined in the Unicode CLDR data repository. Available rules are identified by:
|
||||
</span><span class="ss">:spellout_numbering_year</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">:spellout_ordinal</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">:spellout_ordinal_verbose</span><span class="w">
|
||||
</span><span class="p" data-group-id="1335732774-3">]</span></code></pre><p>A rule can then be invoked on an available rule_set. For example:</p><pre><code class="makeup elixir" translate="no"><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr.Rbnf.Spellout</span><span class="o">.</span><span class="n">spellout_ordinal</span><span class="p" data-group-id="6255590367-1">(</span><span class="mi">123</span><span class="p">,</span><span class="w"> </span><span class="s">"en"</span><span class="p" data-group-id="6255590367-1">)</span><span class="w">
|
||||
</span><span class="s">"one hundred twenty-third"</span></code></pre><p>This call is equivalent to the call through the public API of:</p><pre><code class="makeup elixir" translate="no"><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr.Number</span><span class="o">.</span><span class="n">to_string</span><span class="p" data-group-id="8644061568-1">(</span><span class="mi">123</span><span class="p">,</span><span class="w"> </span><span class="ss">format</span><span class="p">:</span><span class="w"> </span><span class="ss">:spellout</span><span class="p" data-group-id="8644061568-1">)</span><span class="w">
|
||||
</span><span class="p" data-group-id="8644061568-2">{</span><span class="ss">:ok</span><span class="p">,</span><span class="w"> </span><span class="s">"one hundred twenty-three"</span><span class="p" data-group-id="8644061568-2">}</span></code></pre>
|
||||
</span><span class="p" data-group-id="1244348826-3">]</span></code></pre><p>A rule can then be invoked on an available rule_set. For example:</p><pre><code class="makeup elixir" translate="no"><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr.Rbnf.Spellout</span><span class="o">.</span><span class="n">spellout_ordinal</span><span class="p" data-group-id="9795234696-1">(</span><span class="mi">123</span><span class="p">,</span><span class="w"> </span><span class="s">"en"</span><span class="p" data-group-id="9795234696-1">)</span><span class="w">
|
||||
</span><span class="s">"one hundred twenty-third"</span></code></pre><p>This call is equivalent to the call through the public API of:</p><pre><code class="makeup elixir" translate="no"><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr.Number</span><span class="o">.</span><span class="n">to_string</span><span class="p" data-group-id="5377503731-1">(</span><span class="mi">123</span><span class="p">,</span><span class="w"> </span><span class="ss">format</span><span class="p">:</span><span class="w"> </span><span class="ss">:spellout</span><span class="p" data-group-id="5377503731-1">)</span><span class="w">
|
||||
</span><span class="p" data-group-id="5377503731-2">{</span><span class="ss">:ok</span><span class="p">,</span><span class="w"> </span><span class="s">"one hundred twenty-three"</span><span class="p" data-group-id="5377503731-2">}</span></code></pre>
|
||||
</section>
|
||||
|
||||
|
||||
|
@ -558,24 +558,24 @@ current locale is restored after the function.</p></div>
|
||||
</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</span><span class="o">.</span><span class="n">default_locale</span><span class="p" data-group-id="3490288064-1">(</span><span class="p" data-group-id="3490288064-1">)</span><span class="w">
|
||||
</span><span class="p" data-group-id="3490288064-2">%</span><span class="nc" data-group-id="3490288064-2">Cldr.LanguageTag</span><span class="p" data-group-id="3490288064-2">{</span><span class="w">
|
||||
<pre><code class="makeup elixir" translate="no"><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr</span><span class="o">.</span><span class="n">default_locale</span><span class="p" data-group-id="0487553866-1">(</span><span class="p" data-group-id="0487553866-1">)</span><span class="w">
|
||||
</span><span class="p" data-group-id="0487553866-2">%</span><span class="nc" data-group-id="0487553866-2">Cldr.LanguageTag</span><span class="p" data-group-id="0487553866-2">{</span><span class="w">
|
||||
</span><span class="ss">backend</span><span class="p">:</span><span class="w"> </span><span class="nc">Plausible.Cldr</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">canonical_locale_name</span><span class="p">:</span><span class="w"> </span><span class="s">"en-001"</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">cldr_locale_name</span><span class="p">:</span><span class="w"> </span><span class="ss">:"en-001"</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">language_subtags</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="3490288064-3">[</span><span class="p" data-group-id="3490288064-3">]</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">extensions</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="3490288064-4">%{</span><span class="p" data-group-id="3490288064-4">}</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">language_subtags</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="0487553866-3">[</span><span class="p" data-group-id="0487553866-3">]</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">extensions</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="0487553866-4">%{</span><span class="p" data-group-id="0487553866-4">}</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">gettext_locale_name</span><span class="p">:</span><span class="w"> </span><span class="s">"en"</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">language</span><span class="p">:</span><span class="w"> </span><span class="s">"en"</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">locale</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="3490288064-5">%{</span><span class="p" data-group-id="3490288064-5">}</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">private_use</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="3490288064-6">[</span><span class="p" data-group-id="3490288064-6">]</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">locale</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="0487553866-5">%{</span><span class="p" data-group-id="0487553866-5">}</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">private_use</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="0487553866-6">[</span><span class="p" data-group-id="0487553866-6">]</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">rbnf_locale_name</span><span class="p">:</span><span class="w"> </span><span class="ss">:en</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">requested_locale_name</span><span class="p">:</span><span class="w"> </span><span class="s">"en-001"</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">script</span><span class="p">:</span><span class="w"> </span><span class="ss">:Latn</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">territory</span><span class="p">:</span><span class="w"> </span><span class="ss">:"001"</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">transform</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="3490288064-7">%{</span><span class="p" data-group-id="3490288064-7">}</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">language_variants</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="3490288064-8">[</span><span class="p" data-group-id="3490288064-8">]</span><span class="w">
|
||||
</span><span class="p" data-group-id="3490288064-2">}</span></code></pre>
|
||||
</span><span class="ss">transform</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="0487553866-7">%{</span><span class="p" data-group-id="0487553866-7">}</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">language_variants</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="0487553866-8">[</span><span class="p" data-group-id="0487553866-8">]</span><span class="w">
|
||||
</span><span class="p" data-group-id="0487553866-2">}</span></code></pre>
|
||||
</section>
|
||||
</section>
|
||||
<section class="detail" id="default_territory/0">
|
||||
@ -610,7 +610,7 @@ does not specify one and none can be inferred.</p><h2 id="default_territory/0-ex
|
||||
</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</span><span class="o">.</span><span class="n">default_territory</span><span class="p" data-group-id="2785215393-1">(</span><span class="p" data-group-id="2785215393-1">)</span><span class="w">
|
||||
<pre><code class="makeup elixir" translate="no"><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr</span><span class="o">.</span><span class="n">default_territory</span><span class="p" data-group-id="5175919777-1">(</span><span class="p" data-group-id="5175919777-1">)</span><span class="w">
|
||||
</span><span class="ss">:"001"</span></code></pre>
|
||||
</section>
|
||||
</section>
|
||||
@ -670,16 +670,16 @@ is inserted between words or sentences. The valid options are
|
||||
</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</span><span class="o">.</span><span class="n">ellipsis</span><span class="p" data-group-id="1526743902-1">(</span><span class="s">"And furthermore"</span><span class="p" data-group-id="1526743902-1">)</span><span class="w">
|
||||
<pre><code class="makeup elixir" translate="no"><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr</span><span class="o">.</span><span class="n">ellipsis</span><span class="p" data-group-id="0708591719-1">(</span><span class="s">"And furthermore"</span><span class="p" data-group-id="0708591719-1">)</span><span class="w">
|
||||
</span><span class="s">"And furthermore…"</span><span class="w">
|
||||
|
||||
</span><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr</span><span class="o">.</span><span class="n">ellipsis</span><span class="p" data-group-id="1526743902-2">(</span><span class="p" data-group-id="1526743902-3">[</span><span class="s">"And furthermore"</span><span class="p">,</span><span class="w"> </span><span class="s">"there is much to be done"</span><span class="p" data-group-id="1526743902-3">]</span><span class="p">,</span><span class="w"> </span><span class="ss">locale</span><span class="p">:</span><span class="w"> </span><span class="ss">:ja</span><span class="p" data-group-id="1526743902-2">)</span><span class="w">
|
||||
</span><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr</span><span class="o">.</span><span class="n">ellipsis</span><span class="p" data-group-id="0708591719-2">(</span><span class="p" data-group-id="0708591719-3">[</span><span class="s">"And furthermore"</span><span class="p">,</span><span class="w"> </span><span class="s">"there is much to be done"</span><span class="p" data-group-id="0708591719-3">]</span><span class="p">,</span><span class="w"> </span><span class="ss">locale</span><span class="p">:</span><span class="w"> </span><span class="ss">:ja</span><span class="p" data-group-id="0708591719-2">)</span><span class="w">
|
||||
</span><span class="s">"And furthermore…there is much to be done"</span><span class="w">
|
||||
|
||||
</span><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr</span><span class="o">.</span><span class="n">ellipsis</span><span class="p" data-group-id="1526743902-4">(</span><span class="s">"And furthermore"</span><span class="p">,</span><span class="w"> </span><span class="ss">format</span><span class="p">:</span><span class="w"> </span><span class="ss">:word</span><span class="p" data-group-id="1526743902-4">)</span><span class="w">
|
||||
</span><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr</span><span class="o">.</span><span class="n">ellipsis</span><span class="p" data-group-id="0708591719-4">(</span><span class="s">"And furthermore"</span><span class="p">,</span><span class="w"> </span><span class="ss">format</span><span class="p">:</span><span class="w"> </span><span class="ss">:word</span><span class="p" data-group-id="0708591719-4">)</span><span class="w">
|
||||
</span><span class="s">"And furthermore …"</span><span class="w">
|
||||
|
||||
</span><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr</span><span class="o">.</span><span class="n">ellipsis</span><span class="p" data-group-id="1526743902-5">(</span><span class="p" data-group-id="1526743902-6">[</span><span class="s">"And furthermore"</span><span class="p">,</span><span class="w"> </span><span class="s">"there is much to be done"</span><span class="p" data-group-id="1526743902-6">]</span><span class="p">,</span><span class="w"> </span><span class="ss">locale</span><span class="p">:</span><span class="w"> </span><span class="ss">:ja</span><span class="p">,</span><span class="w"> </span><span class="ss">format</span><span class="p">:</span><span class="w"> </span><span class="ss">:word</span><span class="p" data-group-id="1526743902-5">)</span><span class="w">
|
||||
</span><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr</span><span class="o">.</span><span class="n">ellipsis</span><span class="p" data-group-id="0708591719-5">(</span><span class="p" data-group-id="0708591719-6">[</span><span class="s">"And furthermore"</span><span class="p">,</span><span class="w"> </span><span class="s">"there is much to be done"</span><span class="p" data-group-id="0708591719-6">]</span><span class="p">,</span><span class="w"> </span><span class="ss">locale</span><span class="p">:</span><span class="w"> </span><span class="ss">:ja</span><span class="p">,</span><span class="w"> </span><span class="ss">format</span><span class="p">:</span><span class="w"> </span><span class="ss">:word</span><span class="p" data-group-id="0708591719-5">)</span><span class="w">
|
||||
</span><span class="s">"And furthermore … there is much to be done"</span></code></pre>
|
||||
</section>
|
||||
</section>
|
||||
@ -715,23 +715,23 @@ take an optional locale parameter for which a locale is not supplied.</p><h2 id=
|
||||
</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</span><span class="o">.</span><span class="n">put_locale</span><span class="p" data-group-id="5164687710-1">(</span><span class="s">"pl"</span><span class="p" data-group-id="5164687710-1">)</span><span class="w">
|
||||
</span><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr</span><span class="o">.</span><span class="n">get_locale</span><span class="p" data-group-id="5164687710-2">(</span><span class="p" data-group-id="5164687710-2">)</span><span class="w">
|
||||
</span><span class="p" data-group-id="5164687710-3">%</span><span class="nc" data-group-id="5164687710-3">Cldr.LanguageTag</span><span class="p" data-group-id="5164687710-3">{</span><span class="w">
|
||||
<pre><code class="makeup elixir" translate="no"><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr</span><span class="o">.</span><span class="n">put_locale</span><span class="p" data-group-id="2412971581-1">(</span><span class="s">"pl"</span><span class="p" data-group-id="2412971581-1">)</span><span class="w">
|
||||
</span><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr</span><span class="o">.</span><span class="n">get_locale</span><span class="p" data-group-id="2412971581-2">(</span><span class="p" data-group-id="2412971581-2">)</span><span class="w">
|
||||
</span><span class="p" data-group-id="2412971581-3">%</span><span class="nc" data-group-id="2412971581-3">Cldr.LanguageTag</span><span class="p" data-group-id="2412971581-3">{</span><span class="w">
|
||||
</span><span class="ss">backend</span><span class="p">:</span><span class="w"> </span><span class="nc">Elixir.Plausible.Cldr</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">canonical_locale_name</span><span class="p">:</span><span class="w"> </span><span class="s">"pl"</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">cldr_locale_name</span><span class="p">:</span><span class="w"> </span><span class="ss">:pl</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">extensions</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="5164687710-4">%{</span><span class="p" data-group-id="5164687710-4">}</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">extensions</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="2412971581-4">%{</span><span class="p" data-group-id="2412971581-4">}</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">language</span><span class="p">:</span><span class="w"> </span><span class="s">"pl"</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">locale</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="5164687710-5">%{</span><span class="p" data-group-id="5164687710-5">}</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">private_use</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="5164687710-6">[</span><span class="p" data-group-id="5164687710-6">]</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">locale</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="2412971581-5">%{</span><span class="p" data-group-id="2412971581-5">}</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">private_use</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="2412971581-6">[</span><span class="p" data-group-id="2412971581-6">]</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">rbnf_locale_name</span><span class="p">:</span><span class="w"> </span><span class="ss">:pl</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">territory</span><span class="p">:</span><span class="w"> </span><span class="ss">:PL</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">requested_locale_name</span><span class="p">:</span><span class="w"> </span><span class="s">"pl"</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">script</span><span class="p">:</span><span class="w"> </span><span class="ss">:Latn</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">transform</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="5164687710-7">%{</span><span class="p" data-group-id="5164687710-7">}</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">language_variants</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="5164687710-8">[</span><span class="p" data-group-id="5164687710-8">]</span><span class="w">
|
||||
</span><span class="p" data-group-id="5164687710-3">}</span></code></pre>
|
||||
</span><span class="ss">transform</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="2412971581-7">%{</span><span class="p" data-group-id="2412971581-7">}</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">language_variants</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="2412971581-8">[</span><span class="p" data-group-id="2412971581-8">]</span><span class="w">
|
||||
</span><span class="p" data-group-id="2412971581-3">}</span></code></pre>
|
||||
</section>
|
||||
</section>
|
||||
<section class="detail" id="known_calendars/0">
|
||||
@ -818,10 +818,10 @@ take an optional locale parameter for which a locale is not supplied.</p><h2 id=
|
||||
</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</span><span class="o">.</span><span class="n">known_gettext_locale_name</span><span class="p" data-group-id="9388462232-1">(</span><span class="s">"en"</span><span class="p" data-group-id="9388462232-1">)</span><span class="w">
|
||||
<pre><code class="makeup elixir" translate="no"><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr</span><span class="o">.</span><span class="n">known_gettext_locale_name</span><span class="p" data-group-id="3530189685-1">(</span><span class="s">"en"</span><span class="p" data-group-id="3530189685-1">)</span><span class="w">
|
||||
</span><span class="s">"en"</span><span class="w">
|
||||
|
||||
</span><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr</span><span class="o">.</span><span class="n">known_gettext_locale_name</span><span class="p" data-group-id="9388462232-2">(</span><span class="s">"en-SA"</span><span class="p" data-group-id="9388462232-2">)</span><span class="w">
|
||||
</span><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr</span><span class="o">.</span><span class="n">known_gettext_locale_name</span><span class="p" data-group-id="3530189685-2">(</span><span class="s">"en-SA"</span><span class="p" data-group-id="3530189685-2">)</span><span class="w">
|
||||
</span><span class="no">false</span></code></pre>
|
||||
</section>
|
||||
</section>
|
||||
@ -864,10 +864,10 @@ name is configured and available in Gettext.</p><h2 id="known_gettext_locale_nam
|
||||
</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</span><span class="o">.</span><span class="n">known_gettext_locale_name?</span><span class="p" data-group-id="1553624525-1">(</span><span class="s">"en"</span><span class="p" data-group-id="1553624525-1">)</span><span class="w">
|
||||
<pre><code class="makeup elixir" translate="no"><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr</span><span class="o">.</span><span class="n">known_gettext_locale_name?</span><span class="p" data-group-id="2410637144-1">(</span><span class="s">"en"</span><span class="p" data-group-id="2410637144-1">)</span><span class="w">
|
||||
</span><span class="no">true</span><span class="w">
|
||||
|
||||
</span><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr</span><span class="o">.</span><span class="n">known_gettext_locale_name?</span><span class="p" data-group-id="1553624525-2">(</span><span class="s">"!!"</span><span class="p" data-group-id="1553624525-2">)</span><span class="w">
|
||||
</span><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr</span><span class="o">.</span><span class="n">known_gettext_locale_name?</span><span class="p" data-group-id="2410637144-2">(</span><span class="s">"!!"</span><span class="p" data-group-id="2410637144-2">)</span><span class="w">
|
||||
</span><span class="no">false</span></code></pre>
|
||||
</section>
|
||||
</section>
|
||||
@ -941,10 +941,10 @@ to return the first known locale name from a list.</p><h2 id="known_locale_name/
|
||||
</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</span><span class="o">.</span><span class="n">known_locale_name</span><span class="p" data-group-id="7749973853-1">(</span><span class="ss">:"en-AU"</span><span class="p" data-group-id="7749973853-1">)</span><span class="w">
|
||||
<pre><code class="makeup elixir" translate="no"><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr</span><span class="o">.</span><span class="n">known_locale_name</span><span class="p" data-group-id="1802188356-1">(</span><span class="ss">:"en-AU"</span><span class="p" data-group-id="1802188356-1">)</span><span class="w">
|
||||
</span><span class="ss">:"en-AU"</span><span class="w">
|
||||
|
||||
</span><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr</span><span class="o">.</span><span class="n">known_locale_name</span><span class="p" data-group-id="7749973853-2">(</span><span class="ss">:"en-SA"</span><span class="p" data-group-id="7749973853-2">)</span><span class="w">
|
||||
</span><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr</span><span class="o">.</span><span class="n">known_locale_name</span><span class="p" data-group-id="1802188356-2">(</span><span class="ss">:"en-SA"</span><span class="p" data-group-id="1802188356-2">)</span><span class="w">
|
||||
</span><span class="no">false</span></code></pre>
|
||||
</section>
|
||||
</section>
|
||||
@ -986,10 +986,10 @@ name is configured and available in Cldr.</p><h2 id="known_locale_name?/1-argume
|
||||
</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</span><span class="o">.</span><span class="n">known_locale_name?</span><span class="p" data-group-id="5183723508-1">(</span><span class="ss">:en</span><span class="p" data-group-id="5183723508-1">)</span><span class="w">
|
||||
<pre><code class="makeup elixir" translate="no"><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr</span><span class="o">.</span><span class="n">known_locale_name?</span><span class="p" data-group-id="2296214327-1">(</span><span class="ss">:en</span><span class="p" data-group-id="2296214327-1">)</span><span class="w">
|
||||
</span><span class="no">true</span><span class="w">
|
||||
|
||||
</span><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr</span><span class="o">.</span><span class="n">known_locale_name?</span><span class="p" data-group-id="5183723508-2">(</span><span class="ss">:"!!"</span><span class="p" data-group-id="5183723508-2">)</span><span class="w">
|
||||
</span><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr</span><span class="o">.</span><span class="n">known_locale_name?</span><span class="p" data-group-id="2296214327-2">(</span><span class="ss">:"!!"</span><span class="p" data-group-id="2296214327-2">)</span><span class="w">
|
||||
</span><span class="no">false</span></code></pre>
|
||||
</section>
|
||||
</section>
|
||||
@ -1043,8 +1043,8 @@ in this module or in <a href="https://hexdocs.pm/gettext/0.24.0/Gettext.html"><c
|
||||
</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</span><span class="o">.</span><span class="n">known_number_system_types</span><span class="p" data-group-id="3086467741-1">(</span><span class="p" data-group-id="3086467741-1">)</span><span class="w">
|
||||
</span><span class="p" data-group-id="3086467741-2">[</span><span class="ss">:default</span><span class="p">,</span><span class="w"> </span><span class="ss">:finance</span><span class="p">,</span><span class="w"> </span><span class="ss">:native</span><span class="p">,</span><span class="w"> </span><span class="ss">:traditional</span><span class="p" data-group-id="3086467741-2">]</span></code></pre>
|
||||
<pre><code class="makeup elixir" translate="no"><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr</span><span class="o">.</span><span class="n">known_number_system_types</span><span class="p" data-group-id="0013170738-1">(</span><span class="p" data-group-id="0013170738-1">)</span><span class="w">
|
||||
</span><span class="p" data-group-id="0013170738-2">[</span><span class="ss">:default</span><span class="p">,</span><span class="w"> </span><span class="ss">:finance</span><span class="p">,</span><span class="w"> </span><span class="ss">:native</span><span class="p">,</span><span class="w"> </span><span class="ss">:traditional</span><span class="p" data-group-id="0013170738-2">]</span></code></pre>
|
||||
</section>
|
||||
</section>
|
||||
<section class="detail" id="known_number_systems/0">
|
||||
@ -1109,10 +1109,10 @@ and has RBNF rules defined.</p><h2 id="known_rbnf_locale_name/1-arguments" class
|
||||
</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</span><span class="o">.</span><span class="n">known_rbnf_locale_name</span><span class="p" data-group-id="8360238149-1">(</span><span class="ss">:en</span><span class="p" data-group-id="8360238149-1">)</span><span class="w">
|
||||
<pre><code class="makeup elixir" translate="no"><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr</span><span class="o">.</span><span class="n">known_rbnf_locale_name</span><span class="p" data-group-id="3840123750-1">(</span><span class="ss">:en</span><span class="p" data-group-id="3840123750-1">)</span><span class="w">
|
||||
</span><span class="ss">:en</span><span class="w">
|
||||
|
||||
</span><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr</span><span class="o">.</span><span class="n">known_rbnf_locale_name</span><span class="p" data-group-id="8360238149-2">(</span><span class="ss">:"en-SA"</span><span class="p" data-group-id="8360238149-2">)</span><span class="w">
|
||||
</span><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr</span><span class="o">.</span><span class="n">known_rbnf_locale_name</span><span class="p" data-group-id="3840123750-2">(</span><span class="ss">:"en-SA"</span><span class="p" data-group-id="3840123750-2">)</span><span class="w">
|
||||
</span><span class="no">false</span></code></pre>
|
||||
</section>
|
||||
</section>
|
||||
@ -1155,10 +1155,10 @@ rules based number formats (RBNF).</p><h2 id="known_rbnf_locale_name?/1-argument
|
||||
</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</span><span class="o">.</span><span class="n">known_rbnf_locale_name?</span><span class="p" data-group-id="3165604047-1">(</span><span class="ss">:en</span><span class="p" data-group-id="3165604047-1">)</span><span class="w">
|
||||
<pre><code class="makeup elixir" translate="no"><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr</span><span class="o">.</span><span class="n">known_rbnf_locale_name?</span><span class="p" data-group-id="3518590680-1">(</span><span class="ss">:en</span><span class="p" data-group-id="3518590680-1">)</span><span class="w">
|
||||
</span><span class="no">true</span><span class="w">
|
||||
|
||||
</span><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr</span><span class="o">.</span><span class="n">known_rbnf_locale_name?</span><span class="p" data-group-id="3165604047-2">(</span><span class="ss">:"!!"</span><span class="p" data-group-id="3165604047-2">)</span><span class="w">
|
||||
</span><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr</span><span class="o">.</span><span class="n">known_rbnf_locale_name?</span><span class="p" data-group-id="3518590680-2">(</span><span class="ss">:"!!"</span><span class="p" data-group-id="3518590680-2">)</span><span class="w">
|
||||
</span><span class="no">false</span></code></pre>
|
||||
</section>
|
||||
</section>
|
||||
@ -1294,14 +1294,14 @@ CLDR backend defined by the <code class="inline">t:Cldr.LanguageTag</code> is se
|
||||
<span class="text">Examples</span>
|
||||
</h2>
|
||||
<pre><code class="makeup elixir" translate="no"><span class="gp unselectable">iex> </span><span class="kn">import</span><span class="w"> </span><span class="nc">Cldr.LanguageTag.Sigil</span><span class="w">
|
||||
</span><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr</span><span class="o">.</span><span class="n">put_gettext_locale</span><span class="p" data-group-id="7727211665-1">(</span><span class="sx">~l"en"</span><span class="p" data-group-id="7727211665-1">)</span><span class="w">
|
||||
</span><span class="p" data-group-id="7727211665-2">{</span><span class="ss">:ok</span><span class="p">,</span><span class="w"> </span><span class="s">"en"</span><span class="p" data-group-id="7727211665-2">}</span><span class="w">
|
||||
</span><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr</span><span class="o">.</span><span class="n">put_gettext_locale</span><span class="p" data-group-id="1419665640-1">(</span><span class="sx">~l"en"</span><span class="p" data-group-id="1419665640-1">)</span><span class="w">
|
||||
</span><span class="p" data-group-id="1419665640-2">{</span><span class="ss">:ok</span><span class="p">,</span><span class="w"> </span><span class="s">"en"</span><span class="p" data-group-id="1419665640-2">}</span><span class="w">
|
||||
|
||||
</span><span class="gp unselectable">iex> </span><span class="kn">import</span><span class="w"> </span><span class="nc">Cldr.LanguageTag.Sigil</span><span class="w">
|
||||
</span><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr</span><span class="o">.</span><span class="n">put_gettext_locale</span><span class="p" data-group-id="7727211665-3">(</span><span class="sx">~l"de"</span><span class="p" data-group-id="7727211665-3">)</span><span class="w">
|
||||
</span><span class="p" data-group-id="7727211665-4">{</span><span class="ss">:error</span><span class="p">,</span><span class="w">
|
||||
</span><span class="p" data-group-id="7727211665-5">{</span><span class="nc">Cldr.UnknownLocaleError</span><span class="p">,</span><span class="w">
|
||||
</span><span class="s">"Locale #Cldr.LanguageTag<de [validated]> does not map to a known gettext locale name"</span><span class="p" data-group-id="7727211665-5">}</span><span class="p" data-group-id="7727211665-4">}</span></code></pre>
|
||||
</span><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr</span><span class="o">.</span><span class="n">put_gettext_locale</span><span class="p" data-group-id="1419665640-3">(</span><span class="sx">~l"de"</span><span class="p" data-group-id="1419665640-3">)</span><span class="w">
|
||||
</span><span class="p" data-group-id="1419665640-4">{</span><span class="ss">:error</span><span class="p">,</span><span class="w">
|
||||
</span><span class="p" data-group-id="1419665640-5">{</span><span class="nc">Cldr.UnknownLocaleError</span><span class="p">,</span><span class="w">
|
||||
</span><span class="s">"Locale #Cldr.LanguageTag<de [validated]> does not map to a known gettext locale name"</span><span class="p" data-group-id="1419665640-5">}</span><span class="p" data-group-id="1419665640-4">}</span></code></pre>
|
||||
</section>
|
||||
</section>
|
||||
<section class="detail" id="put_locale/1">
|
||||
@ -1345,29 +1345,29 @@ of a language tag.</p><h2 id="put_locale/1-examples" class="section-heading">
|
||||
</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</span><span class="o">.</span><span class="n">put_locale</span><span class="p" data-group-id="6407726320-1">(</span><span class="s">"en"</span><span class="p" data-group-id="6407726320-1">)</span><span class="w">
|
||||
</span><span class="p" data-group-id="6407726320-2">{</span><span class="ss">:ok</span><span class="p">,</span><span class="w">
|
||||
</span><span class="p" data-group-id="6407726320-3">%</span><span class="nc" data-group-id="6407726320-3">Cldr.LanguageTag</span><span class="p" data-group-id="6407726320-3">{</span><span class="w">
|
||||
<pre><code class="makeup elixir" translate="no"><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr</span><span class="o">.</span><span class="n">put_locale</span><span class="p" data-group-id="2459705383-1">(</span><span class="s">"en"</span><span class="p" data-group-id="2459705383-1">)</span><span class="w">
|
||||
</span><span class="p" data-group-id="2459705383-2">{</span><span class="ss">:ok</span><span class="p">,</span><span class="w">
|
||||
</span><span class="p" data-group-id="2459705383-3">%</span><span class="nc" data-group-id="2459705383-3">Cldr.LanguageTag</span><span class="p" data-group-id="2459705383-3">{</span><span class="w">
|
||||
</span><span class="ss">backend</span><span class="p">:</span><span class="w"> </span><span class="nc">Plausible.Cldr</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">canonical_locale_name</span><span class="p">:</span><span class="w"> </span><span class="s">"en"</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">cldr_locale_name</span><span class="p">:</span><span class="w"> </span><span class="ss">:en</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">language_subtags</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="6407726320-4">[</span><span class="p" data-group-id="6407726320-4">]</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">extensions</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="6407726320-5">%{</span><span class="p" data-group-id="6407726320-5">}</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">language_subtags</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="2459705383-4">[</span><span class="p" data-group-id="2459705383-4">]</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">extensions</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="2459705383-5">%{</span><span class="p" data-group-id="2459705383-5">}</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">gettext_locale_name</span><span class="p">:</span><span class="w"> </span><span class="s">"en"</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">language</span><span class="p">:</span><span class="w"> </span><span class="s">"en"</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">locale</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="6407726320-6">%{</span><span class="p" data-group-id="6407726320-6">}</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">private_use</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="6407726320-7">[</span><span class="p" data-group-id="6407726320-7">]</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">locale</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="2459705383-6">%{</span><span class="p" data-group-id="2459705383-6">}</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">private_use</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="2459705383-7">[</span><span class="p" data-group-id="2459705383-7">]</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">rbnf_locale_name</span><span class="p">:</span><span class="w"> </span><span class="ss">:en</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">requested_locale_name</span><span class="p">:</span><span class="w"> </span><span class="s">"en"</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">script</span><span class="p">:</span><span class="w"> </span><span class="ss">:Latn</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">territory</span><span class="p">:</span><span class="w"> </span><span class="ss">:US</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">transform</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="6407726320-8">%{</span><span class="p" data-group-id="6407726320-8">}</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">language_variants</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="6407726320-9">[</span><span class="p" data-group-id="6407726320-9">]</span><span class="w">
|
||||
</span><span class="p" data-group-id="6407726320-3">}</span><span class="p" data-group-id="6407726320-2">}</span><span class="w">
|
||||
</span><span class="ss">transform</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="2459705383-8">%{</span><span class="p" data-group-id="2459705383-8">}</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">language_variants</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="2459705383-9">[</span><span class="p" data-group-id="2459705383-9">]</span><span class="w">
|
||||
</span><span class="p" data-group-id="2459705383-3">}</span><span class="p" data-group-id="2459705383-2">}</span><span class="w">
|
||||
|
||||
</span><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr</span><span class="o">.</span><span class="n">put_locale</span><span class="p" data-group-id="6407726320-10">(</span><span class="s">"invalid-locale!"</span><span class="p" data-group-id="6407726320-10">)</span><span class="w">
|
||||
</span><span class="p" data-group-id="6407726320-11">{</span><span class="ss">:error</span><span class="p">,</span><span class="w"> </span><span class="p" data-group-id="6407726320-12">{</span><span class="nc">Cldr.LanguageTag.ParseError</span><span class="p">,</span><span class="w">
|
||||
</span><span class="s">"Expected a BCP47 language tag. Could not parse the remaining </span><span class="se">\"</span><span class="s">!</span><span class="se">\"</span><span class="s"> starting at position 15"</span><span class="p" data-group-id="6407726320-12">}</span><span class="p" data-group-id="6407726320-11">}</span></code></pre>
|
||||
</span><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr</span><span class="o">.</span><span class="n">put_locale</span><span class="p" data-group-id="2459705383-10">(</span><span class="s">"invalid-locale!"</span><span class="p" data-group-id="2459705383-10">)</span><span class="w">
|
||||
</span><span class="p" data-group-id="2459705383-11">{</span><span class="ss">:error</span><span class="p">,</span><span class="w"> </span><span class="p" data-group-id="2459705383-12">{</span><span class="nc">Cldr.LanguageTag.ParseError</span><span class="p">,</span><span class="w">
|
||||
</span><span class="s">"Expected a BCP47 language tag. Could not parse the remaining </span><span class="se">\"</span><span class="s">!</span><span class="se">\"</span><span class="s"> starting at position 15"</span><span class="p" data-group-id="2459705383-12">}</span><span class="p" data-group-id="2459705383-11">}</span></code></pre>
|
||||
</section>
|
||||
</section>
|
||||
<section class="detail" id="quote/2">
|
||||
@ -1416,10 +1416,10 @@ The default is <a href="https://hexdocs.pm/ex_cldr/2.37.5/Cldr.html#get_locale/0
|
||||
</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</span><span class="o">.</span><span class="k">quote</span><span class="p" data-group-id="3666579047-1">(</span><span class="s">"Quoted String"</span><span class="p" data-group-id="3666579047-1">)</span><span class="w">
|
||||
<pre><code class="makeup elixir" translate="no"><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr</span><span class="o">.</span><span class="k">quote</span><span class="p" data-group-id="4669641899-1">(</span><span class="s">"Quoted String"</span><span class="p" data-group-id="4669641899-1">)</span><span class="w">
|
||||
</span><span class="s">"“Quoted String”"</span><span class="w">
|
||||
|
||||
</span><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr</span><span class="o">.</span><span class="k">quote</span><span class="p" data-group-id="3666579047-2">(</span><span class="s">"Quoted String"</span><span class="p">,</span><span class="w"> </span><span class="ss">locale</span><span class="p">:</span><span class="w"> </span><span class="ss">:ja</span><span class="p" data-group-id="3666579047-2">)</span><span class="w">
|
||||
</span><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr</span><span class="o">.</span><span class="k">quote</span><span class="p" data-group-id="4669641899-2">(</span><span class="s">"Quoted String"</span><span class="p">,</span><span class="w"> </span><span class="ss">locale</span><span class="p">:</span><span class="w"> </span><span class="ss">:ja</span><span class="p" data-group-id="4669641899-2">)</span><span class="w">
|
||||
</span><span class="s">"「Quoted String」"</span></code></pre>
|
||||
</section>
|
||||
</section>
|
||||
@ -1550,47 +1550,47 @@ of a language tag.</p><h2 id="validate_locale/1-examples" class="section-heading
|
||||
</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</span><span class="o">.</span><span class="n">validate_locale</span><span class="p" data-group-id="1043929284-1">(</span><span class="ss">:en</span><span class="p" data-group-id="1043929284-1">)</span><span class="w">
|
||||
</span><span class="p" data-group-id="1043929284-2">{</span><span class="ss">:ok</span><span class="p">,</span><span class="w">
|
||||
</span><span class="p" data-group-id="1043929284-3">%</span><span class="nc" data-group-id="1043929284-3">Cldr.LanguageTag</span><span class="p" data-group-id="1043929284-3">{</span><span class="w">
|
||||
<pre><code class="makeup elixir" translate="no"><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr</span><span class="o">.</span><span class="n">validate_locale</span><span class="p" data-group-id="2173059924-1">(</span><span class="ss">:en</span><span class="p" data-group-id="2173059924-1">)</span><span class="w">
|
||||
</span><span class="p" data-group-id="2173059924-2">{</span><span class="ss">:ok</span><span class="p">,</span><span class="w">
|
||||
</span><span class="p" data-group-id="2173059924-3">%</span><span class="nc" data-group-id="2173059924-3">Cldr.LanguageTag</span><span class="p" data-group-id="2173059924-3">{</span><span class="w">
|
||||
</span><span class="ss">backend</span><span class="p">:</span><span class="w"> </span><span class="nc">Plausible.Cldr</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">canonical_locale_name</span><span class="p">:</span><span class="w"> </span><span class="s">"en"</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">cldr_locale_name</span><span class="p">:</span><span class="w"> </span><span class="ss">:en</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">extensions</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="1043929284-4">%{</span><span class="p" data-group-id="1043929284-4">}</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">extensions</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="2173059924-4">%{</span><span class="p" data-group-id="2173059924-4">}</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">gettext_locale_name</span><span class="p">:</span><span class="w"> </span><span class="s">"en"</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">language</span><span class="p">:</span><span class="w"> </span><span class="s">"en"</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">locale</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="1043929284-5">%{</span><span class="p" data-group-id="1043929284-5">}</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">private_use</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="1043929284-6">[</span><span class="p" data-group-id="1043929284-6">]</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">locale</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="2173059924-5">%{</span><span class="p" data-group-id="2173059924-5">}</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">private_use</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="2173059924-6">[</span><span class="p" data-group-id="2173059924-6">]</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">rbnf_locale_name</span><span class="p">:</span><span class="w"> </span><span class="ss">:en</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">requested_locale_name</span><span class="p">:</span><span class="w"> </span><span class="s">"en"</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">script</span><span class="p">:</span><span class="w"> </span><span class="ss">:Latn</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">territory</span><span class="p">:</span><span class="w"> </span><span class="ss">:US</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">transform</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="1043929284-7">%{</span><span class="p" data-group-id="1043929284-7">}</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">language_variants</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="1043929284-8">[</span><span class="p" data-group-id="1043929284-8">]</span><span class="w">
|
||||
</span><span class="p" data-group-id="1043929284-3">}</span><span class="p" data-group-id="1043929284-2">}</span><span class="w">
|
||||
</span><span class="ss">transform</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="2173059924-7">%{</span><span class="p" data-group-id="2173059924-7">}</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">language_variants</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="2173059924-8">[</span><span class="p" data-group-id="2173059924-8">]</span><span class="w">
|
||||
</span><span class="p" data-group-id="2173059924-3">}</span><span class="p" data-group-id="2173059924-2">}</span><span class="w">
|
||||
|
||||
|
||||
</span><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr</span><span class="o">.</span><span class="n">validate_locale</span><span class="w"> </span><span class="nc">Plausible.Cldr</span><span class="o">.</span><span class="n">default_locale</span><span class="p" data-group-id="1043929284-9">(</span><span class="p" data-group-id="1043929284-9">)</span><span class="w">
|
||||
</span><span class="p" data-group-id="1043929284-10">{</span><span class="ss">:ok</span><span class="p">,</span><span class="w">
|
||||
</span><span class="p" data-group-id="1043929284-11">%</span><span class="nc" data-group-id="1043929284-11">Cldr.LanguageTag</span><span class="p" data-group-id="1043929284-11">{</span><span class="w">
|
||||
</span><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr</span><span class="o">.</span><span class="n">validate_locale</span><span class="w"> </span><span class="nc">Plausible.Cldr</span><span class="o">.</span><span class="n">default_locale</span><span class="p" data-group-id="2173059924-9">(</span><span class="p" data-group-id="2173059924-9">)</span><span class="w">
|
||||
</span><span class="p" data-group-id="2173059924-10">{</span><span class="ss">:ok</span><span class="p">,</span><span class="w">
|
||||
</span><span class="p" data-group-id="2173059924-11">%</span><span class="nc" data-group-id="2173059924-11">Cldr.LanguageTag</span><span class="p" data-group-id="2173059924-11">{</span><span class="w">
|
||||
</span><span class="ss">backend</span><span class="p">:</span><span class="w"> </span><span class="nc">Plausible.Cldr</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">canonical_locale_name</span><span class="p">:</span><span class="w"> </span><span class="s">"en-001"</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">cldr_locale_name</span><span class="p">:</span><span class="w"> </span><span class="ss">:"en-001"</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">extensions</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="1043929284-12">%{</span><span class="p" data-group-id="1043929284-12">}</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">extensions</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="2173059924-12">%{</span><span class="p" data-group-id="2173059924-12">}</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">gettext_locale_name</span><span class="p">:</span><span class="w"> </span><span class="s">"en"</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">language</span><span class="p">:</span><span class="w"> </span><span class="s">"en"</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">locale</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="1043929284-13">%{</span><span class="p" data-group-id="1043929284-13">}</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">private_use</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="1043929284-14">[</span><span class="p" data-group-id="1043929284-14">]</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">locale</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="2173059924-13">%{</span><span class="p" data-group-id="2173059924-13">}</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">private_use</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="2173059924-14">[</span><span class="p" data-group-id="2173059924-14">]</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">rbnf_locale_name</span><span class="p">:</span><span class="w"> </span><span class="ss">:en</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">requested_locale_name</span><span class="p">:</span><span class="w"> </span><span class="s">"en-001"</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">script</span><span class="p">:</span><span class="w"> </span><span class="ss">:Latn</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">territory</span><span class="p">:</span><span class="w"> </span><span class="ss">:"001"</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">transform</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="1043929284-15">%{</span><span class="p" data-group-id="1043929284-15">}</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">language_variants</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="1043929284-16">[</span><span class="p" data-group-id="1043929284-16">]</span><span class="w">
|
||||
</span><span class="p" data-group-id="1043929284-11">}</span><span class="p" data-group-id="1043929284-10">}</span><span class="w">
|
||||
</span><span class="ss">transform</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="2173059924-15">%{</span><span class="p" data-group-id="2173059924-15">}</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">language_variants</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="2173059924-16">[</span><span class="p" data-group-id="2173059924-16">]</span><span class="w">
|
||||
</span><span class="p" data-group-id="2173059924-11">}</span><span class="p" data-group-id="2173059924-10">}</span><span class="w">
|
||||
|
||||
</span><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr</span><span class="o">.</span><span class="n">validate_locale</span><span class="p" data-group-id="1043929284-17">(</span><span class="s">"zzz"</span><span class="p" data-group-id="1043929284-17">)</span><span class="w">
|
||||
</span><span class="p" data-group-id="1043929284-18">{</span><span class="ss">:error</span><span class="p">,</span><span class="w"> </span><span class="p" data-group-id="1043929284-19">{</span><span class="nc">Cldr.InvalidLanguageError</span><span class="p">,</span><span class="w"> </span><span class="s">"The language </span><span class="se">\"</span><span class="s">zzz</span><span class="se">\"</span><span class="s"> is invalid"</span><span class="p" data-group-id="1043929284-19">}</span><span class="p" data-group-id="1043929284-18">}</span></code></pre>
|
||||
</span><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr</span><span class="o">.</span><span class="n">validate_locale</span><span class="p" data-group-id="2173059924-17">(</span><span class="s">"zzz"</span><span class="p" data-group-id="2173059924-17">)</span><span class="w">
|
||||
</span><span class="p" data-group-id="2173059924-18">{</span><span class="ss">:error</span><span class="p">,</span><span class="w"> </span><span class="p" data-group-id="2173059924-19">{</span><span class="nc">Cldr.InvalidLanguageError</span><span class="p">,</span><span class="w"> </span><span class="s">"The language </span><span class="se">\"</span><span class="s">zzz</span><span class="se">\"</span><span class="s"> is invalid"</span><span class="p" data-group-id="2173059924-19">}</span><span class="p" data-group-id="2173059924-18">}</span></code></pre>
|
||||
</section>
|
||||
</section>
|
||||
<section class="detail" id="validate_number_system/1">
|
||||
@ -1660,23 +1660,23 @@ of a language tag.</p><h2 id="validate_locale/1-examples" class="section-heading
|
||||
</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</span><span class="o">.</span><span class="n">validate_number_system_type</span><span class="p" data-group-id="6099941992-1">(</span><span class="ss">:default</span><span class="p" data-group-id="6099941992-1">)</span><span class="w">
|
||||
</span><span class="p" data-group-id="6099941992-2">{</span><span class="ss">:ok</span><span class="p">,</span><span class="w"> </span><span class="ss">:default</span><span class="p" data-group-id="6099941992-2">}</span><span class="w">
|
||||
<pre><code class="makeup elixir" translate="no"><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr</span><span class="o">.</span><span class="n">validate_number_system_type</span><span class="p" data-group-id="2032947522-1">(</span><span class="ss">:default</span><span class="p" data-group-id="2032947522-1">)</span><span class="w">
|
||||
</span><span class="p" data-group-id="2032947522-2">{</span><span class="ss">:ok</span><span class="p">,</span><span class="w"> </span><span class="ss">:default</span><span class="p" data-group-id="2032947522-2">}</span><span class="w">
|
||||
|
||||
</span><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr</span><span class="o">.</span><span class="n">validate_number_system_type</span><span class="p" data-group-id="6099941992-3">(</span><span class="ss">:traditional</span><span class="p" data-group-id="6099941992-3">)</span><span class="w">
|
||||
</span><span class="p" data-group-id="6099941992-4">{</span><span class="ss">:ok</span><span class="p">,</span><span class="w"> </span><span class="ss">:traditional</span><span class="p" data-group-id="6099941992-4">}</span><span class="w">
|
||||
</span><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr</span><span class="o">.</span><span class="n">validate_number_system_type</span><span class="p" data-group-id="2032947522-3">(</span><span class="ss">:traditional</span><span class="p" data-group-id="2032947522-3">)</span><span class="w">
|
||||
</span><span class="p" data-group-id="2032947522-4">{</span><span class="ss">:ok</span><span class="p">,</span><span class="w"> </span><span class="ss">:traditional</span><span class="p" data-group-id="2032947522-4">}</span><span class="w">
|
||||
|
||||
</span><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr</span><span class="o">.</span><span class="n">validate_number_system_type</span><span class="p" data-group-id="6099941992-5">(</span><span class="ss">:latn</span><span class="p" data-group-id="6099941992-5">)</span><span class="w">
|
||||
</span><span class="p" data-group-id="6099941992-6">{</span><span class="w">
|
||||
</span><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr</span><span class="o">.</span><span class="n">validate_number_system_type</span><span class="p" data-group-id="2032947522-5">(</span><span class="ss">:latn</span><span class="p" data-group-id="2032947522-5">)</span><span class="w">
|
||||
</span><span class="p" data-group-id="2032947522-6">{</span><span class="w">
|
||||
</span><span class="ss">:error</span><span class="p">,</span><span class="w">
|
||||
</span><span class="p" data-group-id="6099941992-7">{</span><span class="nc">Cldr.UnknownNumberSystemTypeError</span><span class="p">,</span><span class="w"> </span><span class="s">"The number system type :latn is unknown"</span><span class="p" data-group-id="6099941992-7">}</span><span class="w">
|
||||
</span><span class="p" data-group-id="6099941992-6">}</span><span class="w">
|
||||
</span><span class="p" data-group-id="2032947522-7">{</span><span class="nc">Cldr.UnknownNumberSystemTypeError</span><span class="p">,</span><span class="w"> </span><span class="s">"The number system type :latn is unknown"</span><span class="p" data-group-id="2032947522-7">}</span><span class="w">
|
||||
</span><span class="p" data-group-id="2032947522-6">}</span><span class="w">
|
||||
|
||||
</span><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr</span><span class="o">.</span><span class="n">validate_number_system_type</span><span class="p" data-group-id="6099941992-8">(</span><span class="s">"bork"</span><span class="p" data-group-id="6099941992-8">)</span><span class="w">
|
||||
</span><span class="p" data-group-id="6099941992-9">{</span><span class="w">
|
||||
</span><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr</span><span class="o">.</span><span class="n">validate_number_system_type</span><span class="p" data-group-id="2032947522-8">(</span><span class="s">"bork"</span><span class="p" data-group-id="2032947522-8">)</span><span class="w">
|
||||
</span><span class="p" data-group-id="2032947522-9">{</span><span class="w">
|
||||
</span><span class="ss">:error</span><span class="p">,</span><span class="w">
|
||||
</span><span class="p" data-group-id="6099941992-10">{</span><span class="nc">Cldr.UnknownNumberSystemTypeError</span><span class="p">,</span><span class="w"> </span><span class="s">"The number system type </span><span class="se">\"</span><span class="s">bork</span><span class="se">\"</span><span class="s"> is invalid"</span><span class="p" data-group-id="6099941992-10">}</span><span class="w">
|
||||
</span><span class="p" data-group-id="6099941992-9">}</span></code></pre>
|
||||
</span><span class="p" data-group-id="2032947522-10">{</span><span class="nc">Cldr.UnknownNumberSystemTypeError</span><span class="p">,</span><span class="w"> </span><span class="s">"The number system type </span><span class="se">\"</span><span class="s">bork</span><span class="se">\"</span><span class="s"> is invalid"</span><span class="p" data-group-id="2032947522-10">}</span><span class="w">
|
||||
</span><span class="p" data-group-id="2032947522-9">}</span></code></pre>
|
||||
</section>
|
||||
</section>
|
||||
<section class="detail" id="validate_territory/1">
|
||||
|
@ -845,23 +845,23 @@ pool to disconnect within the given interval.</p><p>See <a href="https://hexdocs
|
||||
|
||||
<section class="docstring">
|
||||
|
||||
<p>Similar to <code class="inline">insert_all/2</code> but with the following differences:</p><ul><li>accepts rows as streams or lists</li><li>sends rows as a chunked request</li><li>doesn't autogenerate ids or does any other preprocessing</li></ul><p>Example:</p><pre><code class="makeup elixir" translate="no"><span class="nc">Repo</span><span class="o">.</span><span class="n">query!</span><span class="p" data-group-id="3202624689-1">(</span><span class="s">"create table ecto_ch_demo(a UInt64, b String) engine Null"</span><span class="p" data-group-id="3202624689-1">)</span><span class="w">
|
||||
<p>Similar to <code class="inline">insert_all/2</code> but with the following differences:</p><ul><li>accepts rows as streams or lists</li><li>sends rows as a chunked request</li><li>doesn't autogenerate ids or does any other preprocessing</li></ul><p>Example:</p><pre><code class="makeup elixir" translate="no"><span class="nc">Repo</span><span class="o">.</span><span class="n">query!</span><span class="p" data-group-id="9367664825-1">(</span><span class="s">"create table ecto_ch_demo(a UInt64, b String) engine Null"</span><span class="p" data-group-id="9367664825-1">)</span><span class="w">
|
||||
|
||||
</span><span class="kd">defmodule</span><span class="w"> </span><span class="nc">Demo</span><span class="w"> </span><span class="k" data-group-id="3202624689-2">do</span><span class="w">
|
||||
</span><span class="kd">defmodule</span><span class="w"> </span><span class="nc">Demo</span><span class="w"> </span><span class="k" data-group-id="9367664825-2">do</span><span class="w">
|
||||
</span><span class="kn">use</span><span class="w"> </span><span class="nc">Ecto.Schema</span><span class="w">
|
||||
|
||||
</span><span class="na">@primary_key</span><span class="w"> </span><span class="no">false</span><span class="w">
|
||||
</span><span class="n">schema</span><span class="w"> </span><span class="s">"ecto_ch_demo"</span><span class="w"> </span><span class="k" data-group-id="3202624689-3">do</span><span class="w">
|
||||
</span><span class="n">schema</span><span class="w"> </span><span class="s">"ecto_ch_demo"</span><span class="w"> </span><span class="k" data-group-id="9367664825-3">do</span><span class="w">
|
||||
</span><span class="n">field</span><span class="w"> </span><span class="ss">:a</span><span class="p">,</span><span class="w"> </span><span class="nc">Ch</span><span class="p">,</span><span class="w"> </span><span class="ss">type</span><span class="p">:</span><span class="w"> </span><span class="s">"UInt64"</span><span class="w">
|
||||
</span><span class="n">field</span><span class="w"> </span><span class="ss">:b</span><span class="p">,</span><span class="w"> </span><span class="ss">:string</span><span class="w">
|
||||
</span><span class="k" data-group-id="3202624689-3">end</span><span class="w">
|
||||
</span><span class="k" data-group-id="3202624689-2">end</span><span class="w">
|
||||
</span><span class="k" data-group-id="9367664825-3">end</span><span class="w">
|
||||
</span><span class="k" data-group-id="9367664825-2">end</span><span class="w">
|
||||
|
||||
</span><span class="n">rows</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nc">Stream</span><span class="o">.</span><span class="n">map</span><span class="p" data-group-id="3202624689-4">(</span><span class="mi">1</span><span class="o">..</span><span class="mi">100_000</span><span class="p">,</span><span class="w"> </span><span class="k" data-group-id="3202624689-5">fn</span><span class="w"> </span><span class="n">i</span><span class="w"> </span><span class="o">-></span><span class="w"> </span><span class="p" data-group-id="3202624689-6">%{</span><span class="ss">a</span><span class="p">:</span><span class="w"> </span><span class="n">i</span><span class="p">,</span><span class="w"> </span><span class="ss">b</span><span class="p">:</span><span class="w"> </span><span class="n">to_string</span><span class="p" data-group-id="3202624689-7">(</span><span class="n">i</span><span class="p" data-group-id="3202624689-7">)</span><span class="p" data-group-id="3202624689-6">}</span><span class="w"> </span><span class="k" data-group-id="3202624689-5">end</span><span class="p" data-group-id="3202624689-4">)</span><span class="w">
|
||||
</span><span class="p" data-group-id="3202624689-8">{</span><span class="mi">100_000</span><span class="p">,</span><span class="w"> </span><span class="no">nil</span><span class="p" data-group-id="3202624689-8">}</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nc">Repo</span><span class="o">.</span><span class="n">insert_stream</span><span class="p" data-group-id="3202624689-9">(</span><span class="nc">Demo</span><span class="p">,</span><span class="w"> </span><span class="n">rows</span><span class="p" data-group-id="3202624689-9">)</span><span class="w">
|
||||
</span><span class="n">rows</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nc">Stream</span><span class="o">.</span><span class="n">map</span><span class="p" data-group-id="9367664825-4">(</span><span class="mi">1</span><span class="o">..</span><span class="mi">100_000</span><span class="p">,</span><span class="w"> </span><span class="k" data-group-id="9367664825-5">fn</span><span class="w"> </span><span class="n">i</span><span class="w"> </span><span class="o">-></span><span class="w"> </span><span class="p" data-group-id="9367664825-6">%{</span><span class="ss">a</span><span class="p">:</span><span class="w"> </span><span class="n">i</span><span class="p">,</span><span class="w"> </span><span class="ss">b</span><span class="p">:</span><span class="w"> </span><span class="n">to_string</span><span class="p" data-group-id="9367664825-7">(</span><span class="n">i</span><span class="p" data-group-id="9367664825-7">)</span><span class="p" data-group-id="9367664825-6">}</span><span class="w"> </span><span class="k" data-group-id="9367664825-5">end</span><span class="p" data-group-id="9367664825-4">)</span><span class="w">
|
||||
</span><span class="p" data-group-id="9367664825-8">{</span><span class="mi">100_000</span><span class="p">,</span><span class="w"> </span><span class="no">nil</span><span class="p" data-group-id="9367664825-8">}</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nc">Repo</span><span class="o">.</span><span class="n">insert_stream</span><span class="p" data-group-id="9367664825-9">(</span><span class="nc">Demo</span><span class="p">,</span><span class="w"> </span><span class="n">rows</span><span class="p" data-group-id="9367664825-9">)</span><span class="w">
|
||||
|
||||
</span><span class="c1"># schemaless</span><span class="w">
|
||||
</span><span class="p" data-group-id="3202624689-10">{</span><span class="mi">100_000</span><span class="p">,</span><span class="w"> </span><span class="no">nil</span><span class="p" data-group-id="3202624689-10">}</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nc">Repo</span><span class="o">.</span><span class="n">insert_stream</span><span class="p" data-group-id="3202624689-11">(</span><span class="s">"ecto_ch_demo"</span><span class="p">,</span><span class="w"> </span><span class="n">rows</span><span class="p">,</span><span class="w"> </span><span class="ss">types</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="3202624689-12">[</span><span class="ss">a</span><span class="p">:</span><span class="w"> </span><span class="nc">Ch.Types</span><span class="o">.</span><span class="n">u64</span><span class="p" data-group-id="3202624689-13">(</span><span class="p" data-group-id="3202624689-13">)</span><span class="p">,</span><span class="w"> </span><span class="ss">b</span><span class="p">:</span><span class="w"> </span><span class="ss">:string</span><span class="p" data-group-id="3202624689-12">]</span><span class="p" data-group-id="3202624689-11">)</span></code></pre>
|
||||
</span><span class="p" data-group-id="9367664825-10">{</span><span class="mi">100_000</span><span class="p">,</span><span class="w"> </span><span class="no">nil</span><span class="p" data-group-id="9367664825-10">}</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nc">Repo</span><span class="o">.</span><span class="n">insert_stream</span><span class="p" data-group-id="9367664825-11">(</span><span class="s">"ecto_ch_demo"</span><span class="p">,</span><span class="w"> </span><span class="n">rows</span><span class="p">,</span><span class="w"> </span><span class="ss">types</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="9367664825-12">[</span><span class="ss">a</span><span class="p">:</span><span class="w"> </span><span class="nc">Ch.Types</span><span class="o">.</span><span class="n">u64</span><span class="p" data-group-id="9367664825-13">(</span><span class="p" data-group-id="9367664825-13">)</span><span class="p">,</span><span class="w"> </span><span class="ss">b</span><span class="p">:</span><span class="w"> </span><span class="ss">:string</span><span class="p" data-group-id="9367664825-12">]</span><span class="p" data-group-id="9367664825-11">)</span></code></pre>
|
||||
</section>
|
||||
</section>
|
||||
<section class="detail" id="load/2">
|
||||
@ -1200,7 +1200,7 @@ pool to disconnect within the given interval.</p><p>See <a href="https://hexdocs
|
||||
|
||||
</div>
|
||||
|
||||
<p>Similar to <a href="#to_sql/2"><code class="inline">to_sql/2</code></a> but inlines the parameters into the SQL query.</p><p>See <a href="https://hexdocs.pm/ecto_ch/0.3.4/Ecto.Adapters.ClickHouse.html#to_inline_sql/2"><code class="inline">Ecto.Adapters.ClickHouse.to_inline_sql/2</code></a> for more information.</p>
|
||||
<p>Similar to <a href="#to_sql/2"><code class="inline">to_sql/2</code></a> but inlines the parameters into the SQL query.</p><p>See <a href="https://hexdocs.pm/ecto_ch/0.3.5/Ecto.Adapters.ClickHouse.html#to_inline_sql/2"><code class="inline">Ecto.Adapters.ClickHouse.to_inline_sql/2</code></a> for more information.</p>
|
||||
</section>
|
||||
</section>
|
||||
<section class="detail" id="to_sql/2">
|
||||
|
@ -1162,23 +1162,23 @@ pool to disconnect within the given interval.</p><p>See <a href="https://hexdocs
|
||||
|
||||
<section class="docstring">
|
||||
|
||||
<p>Similar to <a href="#insert_all/2"><code class="inline">insert_all/2</code></a> but with the following differences:</p><ul><li>accepts rows as streams or lists</li><li>sends rows as a chunked request</li><li>doesn't autogenerate ids or does any other preprocessing</li></ul><p>Example:</p><pre><code class="makeup elixir" translate="no"><span class="nc">Repo</span><span class="o">.</span><span class="n">query!</span><span class="p" data-group-id="2015365746-1">(</span><span class="s">"create table ecto_ch_demo(a UInt64, b String) engine Null"</span><span class="p" data-group-id="2015365746-1">)</span><span class="w">
|
||||
<p>Similar to <a href="#insert_all/2"><code class="inline">insert_all/2</code></a> but with the following differences:</p><ul><li>accepts rows as streams or lists</li><li>sends rows as a chunked request</li><li>doesn't autogenerate ids or does any other preprocessing</li></ul><p>Example:</p><pre><code class="makeup elixir" translate="no"><span class="nc">Repo</span><span class="o">.</span><span class="n">query!</span><span class="p" data-group-id="2063693731-1">(</span><span class="s">"create table ecto_ch_demo(a UInt64, b String) engine Null"</span><span class="p" data-group-id="2063693731-1">)</span><span class="w">
|
||||
|
||||
</span><span class="kd">defmodule</span><span class="w"> </span><span class="nc">Demo</span><span class="w"> </span><span class="k" data-group-id="2015365746-2">do</span><span class="w">
|
||||
</span><span class="kd">defmodule</span><span class="w"> </span><span class="nc">Demo</span><span class="w"> </span><span class="k" data-group-id="2063693731-2">do</span><span class="w">
|
||||
</span><span class="kn">use</span><span class="w"> </span><span class="nc">Ecto.Schema</span><span class="w">
|
||||
|
||||
</span><span class="na">@primary_key</span><span class="w"> </span><span class="no">false</span><span class="w">
|
||||
</span><span class="n">schema</span><span class="w"> </span><span class="s">"ecto_ch_demo"</span><span class="w"> </span><span class="k" data-group-id="2015365746-3">do</span><span class="w">
|
||||
</span><span class="n">schema</span><span class="w"> </span><span class="s">"ecto_ch_demo"</span><span class="w"> </span><span class="k" data-group-id="2063693731-3">do</span><span class="w">
|
||||
</span><span class="n">field</span><span class="w"> </span><span class="ss">:a</span><span class="p">,</span><span class="w"> </span><span class="nc">Ch</span><span class="p">,</span><span class="w"> </span><span class="ss">type</span><span class="p">:</span><span class="w"> </span><span class="s">"UInt64"</span><span class="w">
|
||||
</span><span class="n">field</span><span class="w"> </span><span class="ss">:b</span><span class="p">,</span><span class="w"> </span><span class="ss">:string</span><span class="w">
|
||||
</span><span class="k" data-group-id="2015365746-3">end</span><span class="w">
|
||||
</span><span class="k" data-group-id="2015365746-2">end</span><span class="w">
|
||||
</span><span class="k" data-group-id="2063693731-3">end</span><span class="w">
|
||||
</span><span class="k" data-group-id="2063693731-2">end</span><span class="w">
|
||||
|
||||
</span><span class="n">rows</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nc">Stream</span><span class="o">.</span><span class="n">map</span><span class="p" data-group-id="2015365746-4">(</span><span class="mi">1</span><span class="o">..</span><span class="mi">100_000</span><span class="p">,</span><span class="w"> </span><span class="k" data-group-id="2015365746-5">fn</span><span class="w"> </span><span class="n">i</span><span class="w"> </span><span class="o">-></span><span class="w"> </span><span class="p" data-group-id="2015365746-6">%{</span><span class="ss">a</span><span class="p">:</span><span class="w"> </span><span class="n">i</span><span class="p">,</span><span class="w"> </span><span class="ss">b</span><span class="p">:</span><span class="w"> </span><span class="n">to_string</span><span class="p" data-group-id="2015365746-7">(</span><span class="n">i</span><span class="p" data-group-id="2015365746-7">)</span><span class="p" data-group-id="2015365746-6">}</span><span class="w"> </span><span class="k" data-group-id="2015365746-5">end</span><span class="p" data-group-id="2015365746-4">)</span><span class="w">
|
||||
</span><span class="p" data-group-id="2015365746-8">{</span><span class="mi">100_000</span><span class="p">,</span><span class="w"> </span><span class="no">nil</span><span class="p" data-group-id="2015365746-8">}</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nc">Repo</span><span class="o">.</span><span class="n">insert_stream</span><span class="p" data-group-id="2015365746-9">(</span><span class="nc">Demo</span><span class="p">,</span><span class="w"> </span><span class="n">rows</span><span class="p" data-group-id="2015365746-9">)</span><span class="w">
|
||||
</span><span class="n">rows</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nc">Stream</span><span class="o">.</span><span class="n">map</span><span class="p" data-group-id="2063693731-4">(</span><span class="mi">1</span><span class="o">..</span><span class="mi">100_000</span><span class="p">,</span><span class="w"> </span><span class="k" data-group-id="2063693731-5">fn</span><span class="w"> </span><span class="n">i</span><span class="w"> </span><span class="o">-></span><span class="w"> </span><span class="p" data-group-id="2063693731-6">%{</span><span class="ss">a</span><span class="p">:</span><span class="w"> </span><span class="n">i</span><span class="p">,</span><span class="w"> </span><span class="ss">b</span><span class="p">:</span><span class="w"> </span><span class="n">to_string</span><span class="p" data-group-id="2063693731-7">(</span><span class="n">i</span><span class="p" data-group-id="2063693731-7">)</span><span class="p" data-group-id="2063693731-6">}</span><span class="w"> </span><span class="k" data-group-id="2063693731-5">end</span><span class="p" data-group-id="2063693731-4">)</span><span class="w">
|
||||
</span><span class="p" data-group-id="2063693731-8">{</span><span class="mi">100_000</span><span class="p">,</span><span class="w"> </span><span class="no">nil</span><span class="p" data-group-id="2063693731-8">}</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nc">Repo</span><span class="o">.</span><span class="n">insert_stream</span><span class="p" data-group-id="2063693731-9">(</span><span class="nc">Demo</span><span class="p">,</span><span class="w"> </span><span class="n">rows</span><span class="p" data-group-id="2063693731-9">)</span><span class="w">
|
||||
|
||||
</span><span class="c1"># schemaless</span><span class="w">
|
||||
</span><span class="p" data-group-id="2015365746-10">{</span><span class="mi">100_000</span><span class="p">,</span><span class="w"> </span><span class="no">nil</span><span class="p" data-group-id="2015365746-10">}</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nc">Repo</span><span class="o">.</span><span class="n">insert_stream</span><span class="p" data-group-id="2015365746-11">(</span><span class="s">"ecto_ch_demo"</span><span class="p">,</span><span class="w"> </span><span class="n">rows</span><span class="p">,</span><span class="w"> </span><span class="ss">types</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="2015365746-12">[</span><span class="ss">a</span><span class="p">:</span><span class="w"> </span><span class="nc">Ch.Types</span><span class="o">.</span><span class="n">u64</span><span class="p" data-group-id="2015365746-13">(</span><span class="p" data-group-id="2015365746-13">)</span><span class="p">,</span><span class="w"> </span><span class="ss">b</span><span class="p">:</span><span class="w"> </span><span class="ss">:string</span><span class="p" data-group-id="2015365746-12">]</span><span class="p" data-group-id="2015365746-11">)</span></code></pre>
|
||||
</span><span class="p" data-group-id="2063693731-10">{</span><span class="mi">100_000</span><span class="p">,</span><span class="w"> </span><span class="no">nil</span><span class="p" data-group-id="2063693731-10">}</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nc">Repo</span><span class="o">.</span><span class="n">insert_stream</span><span class="p" data-group-id="2063693731-11">(</span><span class="s">"ecto_ch_demo"</span><span class="p">,</span><span class="w"> </span><span class="n">rows</span><span class="p">,</span><span class="w"> </span><span class="ss">types</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="2063693731-12">[</span><span class="ss">a</span><span class="p">:</span><span class="w"> </span><span class="nc">Ch.Types</span><span class="o">.</span><span class="n">u64</span><span class="p" data-group-id="2063693731-13">(</span><span class="p" data-group-id="2063693731-13">)</span><span class="p">,</span><span class="w"> </span><span class="ss">b</span><span class="p">:</span><span class="w"> </span><span class="ss">:string</span><span class="p" data-group-id="2063693731-12">]</span><span class="p" data-group-id="2063693731-11">)</span></code></pre>
|
||||
</section>
|
||||
</section>
|
||||
<section class="detail" id="load/2">
|
||||
@ -1539,7 +1539,7 @@ pool to disconnect within the given interval.</p><p>See <a href="https://hexdocs
|
||||
|
||||
</div>
|
||||
|
||||
<p>Similar to <a href="#to_sql/2"><code class="inline">to_sql/2</code></a> but inlines the parameters into the SQL query.</p><p>See <a href="https://hexdocs.pm/ecto_ch/0.3.4/Ecto.Adapters.ClickHouse.html#to_inline_sql/2"><code class="inline">Ecto.Adapters.ClickHouse.to_inline_sql/2</code></a> for more information.</p>
|
||||
<p>Similar to <a href="#to_sql/2"><code class="inline">to_sql/2</code></a> but inlines the parameters into the SQL query.</p><p>See <a href="https://hexdocs.pm/ecto_ch/0.3.5/Ecto.Adapters.ClickHouse.html#to_inline_sql/2"><code class="inline">Ecto.Adapters.ClickHouse.to_inline_sql/2</code></a> for more information.</p>
|
||||
</section>
|
||||
</section>
|
||||
<section class="detail" id="to_sql/2">
|
||||
|
@ -381,7 +381,7 @@ tables into the format of <code class="inline">imported_*</code> tables for a we
|
||||
|
||||
<section class="docstring">
|
||||
|
||||
<p>Renders export archive filename.</p><p>Examples:</p><pre><code class="makeup elixir" translate="no"><span class="gp unselectable">iex> </span><span class="n">archive_filename</span><span class="p" data-group-id="9138163585-1">(</span><span class="s">"plausible.io"</span><span class="p">,</span><span class="w"> </span><span class="c">_created_on</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="ld">~D[2024-12-31]</span><span class="p" data-group-id="9138163585-1">)</span><span class="w">
|
||||
<p>Renders export archive filename.</p><p>Examples:</p><pre><code class="makeup elixir" translate="no"><span class="gp unselectable">iex> </span><span class="n">archive_filename</span><span class="p" data-group-id="0283234646-1">(</span><span class="s">"plausible.io"</span><span class="p">,</span><span class="w"> </span><span class="c">_created_on</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="ld">~D[2024-12-31]</span><span class="p" data-group-id="0283234646-1">)</span><span class="w">
|
||||
</span><span class="s">"plausible_io_20241231.zip"</span></code></pre>
|
||||
</section>
|
||||
</section>
|
||||
@ -404,10 +404,10 @@ tables into the format of <code class="inline">imported_*</code> tables for a we
|
||||
|
||||
<section class="docstring">
|
||||
|
||||
<p>Safely renders content disposition for an arbitrary export filename.</p><p>Examples:</p><pre><code class="makeup elixir" translate="no"><span class="gp unselectable">iex> </span><span class="n">content_disposition</span><span class="p" data-group-id="6600707771-1">(</span><span class="s">"plausible_io_20241231.zip"</span><span class="p" data-group-id="6600707771-1">)</span><span class="w">
|
||||
<p>Safely renders content disposition for an arbitrary export filename.</p><p>Examples:</p><pre><code class="makeup elixir" translate="no"><span class="gp unselectable">iex> </span><span class="n">content_disposition</span><span class="p" data-group-id="6445950073-1">(</span><span class="s">"plausible_io_20241231.zip"</span><span class="p" data-group-id="6445950073-1">)</span><span class="w">
|
||||
</span><span class="s">"attachment; filename=</span><span class="se">\"</span><span class="s">plausible_io_20241231.zip</span><span class="se">\"</span><span class="s">"</span><span class="w">
|
||||
|
||||
</span><span class="gp unselectable">iex> </span><span class="n">content_disposition</span><span class="p" data-group-id="6600707771-2">(</span><span class="s">"📊.zip"</span><span class="p" data-group-id="6600707771-2">)</span><span class="w">
|
||||
</span><span class="gp unselectable">iex> </span><span class="n">content_disposition</span><span class="p" data-group-id="6445950073-2">(</span><span class="s">"📊.zip"</span><span class="p" data-group-id="6445950073-2">)</span><span class="w">
|
||||
</span><span class="s">"attachment; filename=</span><span class="se">\"</span><span class="s">plausible-export.zip</span><span class="se">\"</span><span class="s">; filename*=utf-8''%F0%9F%93%8A.zip"</span></code></pre>
|
||||
</section>
|
||||
</section>
|
||||
@ -724,14 +724,14 @@ tables into the format of <code class="inline">imported_*</code> tables for a we
|
||||
|
||||
</div>
|
||||
|
||||
<p>Creates a streamable Zip archive from the provided (named) Ecto queries.</p><p>Example usage:</p><pre><code class="makeup elixir" translate="no"><span class="p" data-group-id="3457984385-1">{</span><span class="ss">:ok</span><span class="p">,</span><span class="w"> </span><span class="n">pool</span><span class="p" data-group-id="3457984385-1">}</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nc">Ch</span><span class="o">.</span><span class="n">start_link</span><span class="p" data-group-id="3457984385-2">(</span><span class="ss">pool_size</span><span class="p">:</span><span class="w"> </span><span class="mi">1</span><span class="p" data-group-id="3457984385-2">)</span><span class="w">
|
||||
<p>Creates a streamable Zip archive from the provided (named) Ecto queries.</p><p>Example usage:</p><pre><code class="makeup elixir" translate="no"><span class="p" data-group-id="7680715493-1">{</span><span class="ss">:ok</span><span class="p">,</span><span class="w"> </span><span class="n">pool</span><span class="p" data-group-id="7680715493-1">}</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nc">Ch</span><span class="o">.</span><span class="n">start_link</span><span class="p" data-group-id="7680715493-2">(</span><span class="ss">pool_size</span><span class="p">:</span><span class="w"> </span><span class="mi">1</span><span class="p" data-group-id="7680715493-2">)</span><span class="w">
|
||||
|
||||
</span><span class="nc">DBConnection</span><span class="o">.</span><span class="n">run</span><span class="p" data-group-id="3457984385-3">(</span><span class="n">pool</span><span class="p">,</span><span class="w"> </span><span class="k" data-group-id="3457984385-4">fn</span><span class="w"> </span><span class="n">conn</span><span class="w"> </span><span class="o">-></span><span class="w">
|
||||
</span><span class="nc">DBConnection</span><span class="o">.</span><span class="n">run</span><span class="p" data-group-id="7680715493-3">(</span><span class="n">pool</span><span class="p">,</span><span class="w"> </span><span class="k" data-group-id="7680715493-4">fn</span><span class="w"> </span><span class="n">conn</span><span class="w"> </span><span class="o">-></span><span class="w">
|
||||
</span><span class="n">conn</span><span class="w">
|
||||
</span><span class="o">|></span><span class="w"> </span><span class="n">stream_archive</span><span class="p" data-group-id="3457984385-5">(</span><span class="n">export_queries</span><span class="p" data-group-id="3457984385-6">(</span><span class="c">_site_id</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="mi">1</span><span class="p" data-group-id="3457984385-6">)</span><span class="p">,</span><span class="w"> </span><span class="ss">format</span><span class="p">:</span><span class="w"> </span><span class="s">"CSVWithNames"</span><span class="p" data-group-id="3457984385-5">)</span><span class="w">
|
||||
</span><span class="o">|></span><span class="w"> </span><span class="nc">Stream</span><span class="o">.</span><span class="n">into</span><span class="p" data-group-id="3457984385-7">(</span><span class="nc">File</span><span class="o">.</span><span class="n">stream!</span><span class="p" data-group-id="3457984385-8">(</span><span class="s">"export.zip"</span><span class="p" data-group-id="3457984385-8">)</span><span class="p" data-group-id="3457984385-7">)</span><span class="w">
|
||||
</span><span class="o">|></span><span class="w"> </span><span class="nc">Stream</span><span class="o">.</span><span class="n">run</span><span class="p" data-group-id="3457984385-9">(</span><span class="p" data-group-id="3457984385-9">)</span><span class="w">
|
||||
</span><span class="k" data-group-id="3457984385-4">end</span><span class="p" data-group-id="3457984385-3">)</span></code></pre>
|
||||
</span><span class="o">|></span><span class="w"> </span><span class="n">stream_archive</span><span class="p" data-group-id="7680715493-5">(</span><span class="n">export_queries</span><span class="p" data-group-id="7680715493-6">(</span><span class="c">_site_id</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="mi">1</span><span class="p" data-group-id="7680715493-6">)</span><span class="p">,</span><span class="w"> </span><span class="ss">format</span><span class="p">:</span><span class="w"> </span><span class="s">"CSVWithNames"</span><span class="p" data-group-id="7680715493-5">)</span><span class="w">
|
||||
</span><span class="o">|></span><span class="w"> </span><span class="nc">Stream</span><span class="o">.</span><span class="n">into</span><span class="p" data-group-id="7680715493-7">(</span><span class="nc">File</span><span class="o">.</span><span class="n">stream!</span><span class="p" data-group-id="7680715493-8">(</span><span class="s">"export.zip"</span><span class="p" data-group-id="7680715493-8">)</span><span class="p" data-group-id="7680715493-7">)</span><span class="w">
|
||||
</span><span class="o">|></span><span class="w"> </span><span class="nc">Stream</span><span class="o">.</span><span class="n">run</span><span class="p" data-group-id="7680715493-9">(</span><span class="p" data-group-id="7680715493-9">)</span><span class="w">
|
||||
</span><span class="k" data-group-id="7680715493-4">end</span><span class="p" data-group-id="7680715493-3">)</span></code></pre>
|
||||
</section>
|
||||
</section>
|
||||
|
||||
|
@ -260,8 +260,8 @@ and MaxMind license key.</p></div>
|
||||
</a>
|
||||
<span class="text">Examples</span>
|
||||
</h2>
|
||||
<p> In the case of a DB-IP database:</p><pre><code class="makeup elixir" translate="no"><span class="gp unselectable">iex> </span><span class="n">database_type</span><span class="p" data-group-id="4463715269-1">(</span><span class="p" data-group-id="4463715269-1">)</span><span class="w">
|
||||
</span><span class="s">"DBIP-City-Lite"</span></code></pre><p> In the case of a MaxMind database:</p><pre><code class="makeup elixir" translate="no"><span class="gp unselectable">iex> </span><span class="n">database_type</span><span class="p" data-group-id="0647395588-1">(</span><span class="p" data-group-id="0647395588-1">)</span><span class="w">
|
||||
<p> In the case of a DB-IP database:</p><pre><code class="makeup elixir" translate="no"><span class="gp unselectable">iex> </span><span class="n">database_type</span><span class="p" data-group-id="6926635737-1">(</span><span class="p" data-group-id="6926635737-1">)</span><span class="w">
|
||||
</span><span class="s">"DBIP-City-Lite"</span></code></pre><p> In the case of a MaxMind database:</p><pre><code class="makeup elixir" translate="no"><span class="gp unselectable">iex> </span><span class="n">database_type</span><span class="p" data-group-id="8057949984-1">(</span><span class="p" data-group-id="8057949984-1">)</span><span class="w">
|
||||
</span><span class="s">"GeoLite2-City"</span></code></pre>
|
||||
</section>
|
||||
</section>
|
||||
@ -302,8 +302,8 @@ asynchronously.</p></li></ul><h2 id="load_db/1-examples" class="section-heading"
|
||||
</a>
|
||||
<span class="text">Examples</span>
|
||||
</h2>
|
||||
<p> Loading from a local file:</p><pre><code class="makeup elixir" translate="no"><span class="gp unselectable">iex> </span><span class="n">load_db</span><span class="p" data-group-id="0476573507-1">(</span><span class="ss">path</span><span class="p">:</span><span class="w"> </span><span class="s">"/etc/plausible/dbip-city.mmdb"</span><span class="p" data-group-id="0476573507-1">)</span><span class="w">
|
||||
</span><span class="ss">:ok</span></code></pre><p> Downloading a MaxMind DB (this license key is no longer active):</p><pre><code class="makeup elixir" translate="no"><span class="gp unselectable">iex> </span><span class="n">load_db</span><span class="p" data-group-id="8852545178-1">(</span><span class="ss">license_key</span><span class="p">:</span><span class="w"> </span><span class="s">"LNpsJCCKPis6XvBP"</span><span class="p">,</span><span class="w"> </span><span class="ss">edition</span><span class="p">:</span><span class="w"> </span><span class="s">"GeoLite2-City"</span><span class="p">,</span><span class="w"> </span><span class="ss">async</span><span class="p">:</span><span class="w"> </span><span class="no">true</span><span class="p" data-group-id="8852545178-1">)</span><span class="w">
|
||||
<p> Loading from a local file:</p><pre><code class="makeup elixir" translate="no"><span class="gp unselectable">iex> </span><span class="n">load_db</span><span class="p" data-group-id="6229039543-1">(</span><span class="ss">path</span><span class="p">:</span><span class="w"> </span><span class="s">"/etc/plausible/dbip-city.mmdb"</span><span class="p" data-group-id="6229039543-1">)</span><span class="w">
|
||||
</span><span class="ss">:ok</span></code></pre><p> Downloading a MaxMind DB (this license key is no longer active):</p><pre><code class="makeup elixir" translate="no"><span class="gp unselectable">iex> </span><span class="n">load_db</span><span class="p" data-group-id="8895662685-1">(</span><span class="ss">license_key</span><span class="p">:</span><span class="w"> </span><span class="s">"LNpsJCCKPis6XvBP"</span><span class="p">,</span><span class="w"> </span><span class="ss">edition</span><span class="p">:</span><span class="w"> </span><span class="s">"GeoLite2-City"</span><span class="p">,</span><span class="w"> </span><span class="ss">async</span><span class="p">:</span><span class="w"> </span><span class="no">true</span><span class="p" data-group-id="8895662685-1">)</span><span class="w">
|
||||
</span><span class="ss">:ok</span></code></pre>
|
||||
</section>
|
||||
</section>
|
||||
@ -332,21 +332,21 @@ asynchronously.</p></li></ul><h2 id="load_db/1-examples" class="section-heading"
|
||||
</a>
|
||||
<span class="text">Examples</span>
|
||||
</h2>
|
||||
<pre><code class="makeup elixir" translate="no"><span class="gp unselectable">iex> </span><span class="n">lookup</span><span class="p" data-group-id="4310821147-1">(</span><span class="s">"8.7.6.5"</span><span class="p" data-group-id="4310821147-1">)</span><span class="w">
|
||||
</span><span class="p" data-group-id="4310821147-2">%{</span><span class="w">
|
||||
</span><span class="s">"city"</span><span class="w"> </span><span class="p">=></span><span class="w"> </span><span class="p" data-group-id="4310821147-3">%{</span><span class="w">
|
||||
<pre><code class="makeup elixir" translate="no"><span class="gp unselectable">iex> </span><span class="n">lookup</span><span class="p" data-group-id="5912584120-1">(</span><span class="s">"8.7.6.5"</span><span class="p" data-group-id="5912584120-1">)</span><span class="w">
|
||||
</span><span class="p" data-group-id="5912584120-2">%{</span><span class="w">
|
||||
</span><span class="s">"city"</span><span class="w"> </span><span class="p">=></span><span class="w"> </span><span class="p" data-group-id="5912584120-3">%{</span><span class="w">
|
||||
</span><span class="s">"geoname_id"</span><span class="w"> </span><span class="p">=></span><span class="w"> </span><span class="mi">5349755</span><span class="p">,</span><span class="w">
|
||||
</span><span class="s">"names"</span><span class="w"> </span><span class="p">=></span><span class="w"> </span><span class="p" data-group-id="4310821147-4">%{</span><span class="w">
|
||||
</span><span class="s">"names"</span><span class="w"> </span><span class="p">=></span><span class="w"> </span><span class="p" data-group-id="5912584120-4">%{</span><span class="w">
|
||||
</span><span class="s">"de"</span><span class="w"> </span><span class="p">=></span><span class="w"> </span><span class="s">"Fontana"</span><span class="p">,</span><span class="w">
|
||||
</span><span class="s">"en"</span><span class="w"> </span><span class="p">=></span><span class="w"> </span><span class="s">"Fontana"</span><span class="p">,</span><span class="w">
|
||||
</span><span class="s">"ja"</span><span class="w"> </span><span class="p">=></span><span class="w"> </span><span class="s">"フォンタナ"</span><span class="p">,</span><span class="w">
|
||||
</span><span class="s">"ru"</span><span class="w"> </span><span class="p">=></span><span class="w"> </span><span class="s">"Фонтана"</span><span class="w">
|
||||
</span><span class="p" data-group-id="4310821147-4">}</span><span class="w">
|
||||
</span><span class="p" data-group-id="4310821147-3">}</span><span class="p">,</span><span class="w">
|
||||
</span><span class="s">"continent"</span><span class="w"> </span><span class="p">=></span><span class="w"> </span><span class="p" data-group-id="4310821147-5">%{</span><span class="w">
|
||||
</span><span class="p" data-group-id="5912584120-4">}</span><span class="w">
|
||||
</span><span class="p" data-group-id="5912584120-3">}</span><span class="p">,</span><span class="w">
|
||||
</span><span class="s">"continent"</span><span class="w"> </span><span class="p">=></span><span class="w"> </span><span class="p" data-group-id="5912584120-5">%{</span><span class="w">
|
||||
</span><span class="s">"code"</span><span class="w"> </span><span class="p">=></span><span class="w"> </span><span class="s">"NA"</span><span class="p">,</span><span class="w">
|
||||
</span><span class="s">"geoname_id"</span><span class="w"> </span><span class="p">=></span><span class="w"> </span><span class="mi">6255149</span><span class="p">,</span><span class="w">
|
||||
</span><span class="s">"names"</span><span class="w"> </span><span class="p">=></span><span class="w"> </span><span class="p" data-group-id="4310821147-6">%{</span><span class="w">
|
||||
</span><span class="s">"names"</span><span class="w"> </span><span class="p">=></span><span class="w"> </span><span class="p" data-group-id="5912584120-6">%{</span><span class="w">
|
||||
</span><span class="s">"de"</span><span class="w"> </span><span class="p">=></span><span class="w"> </span><span class="s">"Nordamerika"</span><span class="p">,</span><span class="w">
|
||||
</span><span class="s">"en"</span><span class="w"> </span><span class="p">=></span><span class="w"> </span><span class="s">"North America"</span><span class="p">,</span><span class="w">
|
||||
</span><span class="s">"es"</span><span class="w"> </span><span class="p">=></span><span class="w"> </span><span class="s">"Norteamérica"</span><span class="p">,</span><span class="w">
|
||||
@ -355,12 +355,12 @@ asynchronously.</p></li></ul><h2 id="load_db/1-examples" class="section-heading"
|
||||
</span><span class="s">"pt-BR"</span><span class="w"> </span><span class="p">=></span><span class="w"> </span><span class="s">"América do Norte"</span><span class="p">,</span><span class="w">
|
||||
</span><span class="s">"ru"</span><span class="w"> </span><span class="p">=></span><span class="w"> </span><span class="s">"Северная Америка"</span><span class="p">,</span><span class="w">
|
||||
</span><span class="s">"zh-CN"</span><span class="w"> </span><span class="p">=></span><span class="w"> </span><span class="s">"北美洲"</span><span class="w">
|
||||
</span><span class="p" data-group-id="4310821147-6">}</span><span class="w">
|
||||
</span><span class="p" data-group-id="4310821147-5">}</span><span class="p">,</span><span class="w">
|
||||
</span><span class="s">"country"</span><span class="w"> </span><span class="p">=></span><span class="w"> </span><span class="p" data-group-id="4310821147-7">%{</span><span class="w">
|
||||
</span><span class="p" data-group-id="5912584120-6">}</span><span class="w">
|
||||
</span><span class="p" data-group-id="5912584120-5">}</span><span class="p">,</span><span class="w">
|
||||
</span><span class="s">"country"</span><span class="w"> </span><span class="p">=></span><span class="w"> </span><span class="p" data-group-id="5912584120-7">%{</span><span class="w">
|
||||
</span><span class="s">"geoname_id"</span><span class="w"> </span><span class="p">=></span><span class="w"> </span><span class="mi">6252001</span><span class="p">,</span><span class="w">
|
||||
</span><span class="s">"iso_code"</span><span class="w"> </span><span class="p">=></span><span class="w"> </span><span class="s">"US"</span><span class="p">,</span><span class="w">
|
||||
</span><span class="s">"names"</span><span class="w"> </span><span class="p">=></span><span class="w"> </span><span class="p" data-group-id="4310821147-8">%{</span><span class="w">
|
||||
</span><span class="s">"names"</span><span class="w"> </span><span class="p">=></span><span class="w"> </span><span class="p" data-group-id="5912584120-8">%{</span><span class="w">
|
||||
</span><span class="s">"de"</span><span class="w"> </span><span class="p">=></span><span class="w"> </span><span class="s">"Vereinigte Staaten"</span><span class="p">,</span><span class="w">
|
||||
</span><span class="s">"en"</span><span class="w"> </span><span class="p">=></span><span class="w"> </span><span class="s">"United States"</span><span class="p">,</span><span class="w">
|
||||
</span><span class="s">"es"</span><span class="w"> </span><span class="p">=></span><span class="w"> </span><span class="s">"Estados Unidos"</span><span class="p">,</span><span class="w">
|
||||
@ -369,20 +369,20 @@ asynchronously.</p></li></ul><h2 id="load_db/1-examples" class="section-heading"
|
||||
</span><span class="s">"pt-BR"</span><span class="w"> </span><span class="p">=></span><span class="w"> </span><span class="s">"EUA"</span><span class="p">,</span><span class="w">
|
||||
</span><span class="s">"ru"</span><span class="w"> </span><span class="p">=></span><span class="w"> </span><span class="s">"США"</span><span class="p">,</span><span class="w">
|
||||
</span><span class="s">"zh-CN"</span><span class="w"> </span><span class="p">=></span><span class="w"> </span><span class="s">"美国"</span><span class="w">
|
||||
</span><span class="p" data-group-id="4310821147-8">}</span><span class="w">
|
||||
</span><span class="p" data-group-id="4310821147-7">}</span><span class="p">,</span><span class="w">
|
||||
</span><span class="s">"location"</span><span class="w"> </span><span class="p">=></span><span class="w"> </span><span class="p" data-group-id="4310821147-9">%{</span><span class="w">
|
||||
</span><span class="p" data-group-id="5912584120-8">}</span><span class="w">
|
||||
</span><span class="p" data-group-id="5912584120-7">}</span><span class="p">,</span><span class="w">
|
||||
</span><span class="s">"location"</span><span class="w"> </span><span class="p">=></span><span class="w"> </span><span class="p" data-group-id="5912584120-9">%{</span><span class="w">
|
||||
</span><span class="s">"accuracy_radius"</span><span class="w"> </span><span class="p">=></span><span class="w"> </span><span class="mi">50</span><span class="p">,</span><span class="w">
|
||||
</span><span class="s">"latitude"</span><span class="w"> </span><span class="p">=></span><span class="w"> </span><span class="mf">34.1211</span><span class="p">,</span><span class="w">
|
||||
</span><span class="s">"longitude"</span><span class="w"> </span><span class="p">=></span><span class="w"> </span><span class="o">-</span><span class="mf">117.4362</span><span class="p">,</span><span class="w">
|
||||
</span><span class="s">"metro_code"</span><span class="w"> </span><span class="p">=></span><span class="w"> </span><span class="mi">803</span><span class="p">,</span><span class="w">
|
||||
</span><span class="s">"time_zone"</span><span class="w"> </span><span class="p">=></span><span class="w"> </span><span class="s">"America/Los_Angeles"</span><span class="w">
|
||||
</span><span class="p" data-group-id="4310821147-9">}</span><span class="p">,</span><span class="w">
|
||||
</span><span class="s">"postal"</span><span class="w"> </span><span class="p">=></span><span class="w"> </span><span class="p" data-group-id="4310821147-10">%{</span><span class="s">"code"</span><span class="w"> </span><span class="p">=></span><span class="w"> </span><span class="s">"92336"</span><span class="p" data-group-id="4310821147-10">}</span><span class="p">,</span><span class="w">
|
||||
</span><span class="s">"registered_country"</span><span class="w"> </span><span class="p">=></span><span class="w"> </span><span class="p" data-group-id="4310821147-11">%{</span><span class="w">
|
||||
</span><span class="p" data-group-id="5912584120-9">}</span><span class="p">,</span><span class="w">
|
||||
</span><span class="s">"postal"</span><span class="w"> </span><span class="p">=></span><span class="w"> </span><span class="p" data-group-id="5912584120-10">%{</span><span class="s">"code"</span><span class="w"> </span><span class="p">=></span><span class="w"> </span><span class="s">"92336"</span><span class="p" data-group-id="5912584120-10">}</span><span class="p">,</span><span class="w">
|
||||
</span><span class="s">"registered_country"</span><span class="w"> </span><span class="p">=></span><span class="w"> </span><span class="p" data-group-id="5912584120-11">%{</span><span class="w">
|
||||
</span><span class="s">"geoname_id"</span><span class="w"> </span><span class="p">=></span><span class="w"> </span><span class="mi">6252001</span><span class="p">,</span><span class="w">
|
||||
</span><span class="s">"iso_code"</span><span class="w"> </span><span class="p">=></span><span class="w"> </span><span class="s">"US"</span><span class="p">,</span><span class="w">
|
||||
</span><span class="s">"names"</span><span class="w"> </span><span class="p">=></span><span class="w"> </span><span class="p" data-group-id="4310821147-12">%{</span><span class="w">
|
||||
</span><span class="s">"names"</span><span class="w"> </span><span class="p">=></span><span class="w"> </span><span class="p" data-group-id="5912584120-12">%{</span><span class="w">
|
||||
</span><span class="s">"de"</span><span class="w"> </span><span class="p">=></span><span class="w"> </span><span class="s">"Vereinigte Staaten"</span><span class="p">,</span><span class="w">
|
||||
</span><span class="s">"en"</span><span class="w"> </span><span class="p">=></span><span class="w"> </span><span class="s">"United States"</span><span class="p">,</span><span class="w">
|
||||
</span><span class="s">"es"</span><span class="w"> </span><span class="p">=></span><span class="w"> </span><span class="s">"Estados Unidos"</span><span class="p">,</span><span class="w">
|
||||
@ -391,13 +391,13 @@ asynchronously.</p></li></ul><h2 id="load_db/1-examples" class="section-heading"
|
||||
</span><span class="s">"pt-BR"</span><span class="w"> </span><span class="p">=></span><span class="w"> </span><span class="s">"EUA"</span><span class="p">,</span><span class="w">
|
||||
</span><span class="s">"ru"</span><span class="w"> </span><span class="p">=></span><span class="w"> </span><span class="s">"США"</span><span class="p">,</span><span class="w">
|
||||
</span><span class="s">"zh-CN"</span><span class="w"> </span><span class="p">=></span><span class="w"> </span><span class="s">"美国"</span><span class="w">
|
||||
</span><span class="p" data-group-id="4310821147-12">}</span><span class="w">
|
||||
</span><span class="p" data-group-id="4310821147-11">}</span><span class="p">,</span><span class="w">
|
||||
</span><span class="s">"subdivisions"</span><span class="w"> </span><span class="p">=></span><span class="w"> </span><span class="p" data-group-id="4310821147-13">[</span><span class="w">
|
||||
</span><span class="p" data-group-id="4310821147-14">%{</span><span class="w">
|
||||
</span><span class="p" data-group-id="5912584120-12">}</span><span class="w">
|
||||
</span><span class="p" data-group-id="5912584120-11">}</span><span class="p">,</span><span class="w">
|
||||
</span><span class="s">"subdivisions"</span><span class="w"> </span><span class="p">=></span><span class="w"> </span><span class="p" data-group-id="5912584120-13">[</span><span class="w">
|
||||
</span><span class="p" data-group-id="5912584120-14">%{</span><span class="w">
|
||||
</span><span class="s">"geoname_id"</span><span class="w"> </span><span class="p">=></span><span class="w"> </span><span class="mi">5332921</span><span class="p">,</span><span class="w">
|
||||
</span><span class="s">"iso_code"</span><span class="w"> </span><span class="p">=></span><span class="w"> </span><span class="s">"CA"</span><span class="p">,</span><span class="w">
|
||||
</span><span class="s">"names"</span><span class="w"> </span><span class="p">=></span><span class="w"> </span><span class="p" data-group-id="4310821147-15">%{</span><span class="w">
|
||||
</span><span class="s">"names"</span><span class="w"> </span><span class="p">=></span><span class="w"> </span><span class="p" data-group-id="5912584120-15">%{</span><span class="w">
|
||||
</span><span class="s">"de"</span><span class="w"> </span><span class="p">=></span><span class="w"> </span><span class="s">"Kalifornien"</span><span class="p">,</span><span class="w">
|
||||
</span><span class="s">"en"</span><span class="w"> </span><span class="p">=></span><span class="w"> </span><span class="s">"California"</span><span class="p">,</span><span class="w">
|
||||
</span><span class="s">"es"</span><span class="w"> </span><span class="p">=></span><span class="w"> </span><span class="s">"California"</span><span class="p">,</span><span class="w">
|
||||
@ -406,10 +406,10 @@ asynchronously.</p></li></ul><h2 id="load_db/1-examples" class="section-heading"
|
||||
</span><span class="s">"pt-BR"</span><span class="w"> </span><span class="p">=></span><span class="w"> </span><span class="s">"Califórnia"</span><span class="p">,</span><span class="w">
|
||||
</span><span class="s">"ru"</span><span class="w"> </span><span class="p">=></span><span class="w"> </span><span class="s">"Калифорния"</span><span class="p">,</span><span class="w">
|
||||
</span><span class="s">"zh-CN"</span><span class="w"> </span><span class="p">=></span><span class="w"> </span><span class="s">"加州"</span><span class="w">
|
||||
</span><span class="p" data-group-id="4310821147-15">}</span><span class="w">
|
||||
</span><span class="p" data-group-id="4310821147-14">}</span><span class="w">
|
||||
</span><span class="p" data-group-id="4310821147-13">]</span><span class="w">
|
||||
</span><span class="p" data-group-id="4310821147-2">}</span></code></pre>
|
||||
</span><span class="p" data-group-id="5912584120-15">}</span><span class="w">
|
||||
</span><span class="p" data-group-id="5912584120-14">}</span><span class="w">
|
||||
</span><span class="p" data-group-id="5912584120-13">]</span><span class="w">
|
||||
</span><span class="p" data-group-id="5912584120-2">}</span></code></pre>
|
||||
</section>
|
||||
</section>
|
||||
|
||||
|
@ -1153,23 +1153,23 @@ pool to disconnect within the given interval.</p><p>See <a href="https://hexdocs
|
||||
|
||||
<section class="docstring">
|
||||
|
||||
<p>Similar to <a href="#insert_all/2"><code class="inline">insert_all/2</code></a> but with the following differences:</p><ul><li>accepts rows as streams or lists</li><li>sends rows as a chunked request</li><li>doesn't autogenerate ids or does any other preprocessing</li></ul><p>Example:</p><pre><code class="makeup elixir" translate="no"><span class="nc">Repo</span><span class="o">.</span><span class="n">query!</span><span class="p" data-group-id="1766837243-1">(</span><span class="s">"create table ecto_ch_demo(a UInt64, b String) engine Null"</span><span class="p" data-group-id="1766837243-1">)</span><span class="w">
|
||||
<p>Similar to <a href="#insert_all/2"><code class="inline">insert_all/2</code></a> but with the following differences:</p><ul><li>accepts rows as streams or lists</li><li>sends rows as a chunked request</li><li>doesn't autogenerate ids or does any other preprocessing</li></ul><p>Example:</p><pre><code class="makeup elixir" translate="no"><span class="nc">Repo</span><span class="o">.</span><span class="n">query!</span><span class="p" data-group-id="2250646288-1">(</span><span class="s">"create table ecto_ch_demo(a UInt64, b String) engine Null"</span><span class="p" data-group-id="2250646288-1">)</span><span class="w">
|
||||
|
||||
</span><span class="kd">defmodule</span><span class="w"> </span><span class="nc">Demo</span><span class="w"> </span><span class="k" data-group-id="1766837243-2">do</span><span class="w">
|
||||
</span><span class="kd">defmodule</span><span class="w"> </span><span class="nc">Demo</span><span class="w"> </span><span class="k" data-group-id="2250646288-2">do</span><span class="w">
|
||||
</span><span class="kn">use</span><span class="w"> </span><span class="nc">Ecto.Schema</span><span class="w">
|
||||
|
||||
</span><span class="na">@primary_key</span><span class="w"> </span><span class="no">false</span><span class="w">
|
||||
</span><span class="n">schema</span><span class="w"> </span><span class="s">"ecto_ch_demo"</span><span class="w"> </span><span class="k" data-group-id="1766837243-3">do</span><span class="w">
|
||||
</span><span class="n">schema</span><span class="w"> </span><span class="s">"ecto_ch_demo"</span><span class="w"> </span><span class="k" data-group-id="2250646288-3">do</span><span class="w">
|
||||
</span><span class="n">field</span><span class="w"> </span><span class="ss">:a</span><span class="p">,</span><span class="w"> </span><span class="nc">Ch</span><span class="p">,</span><span class="w"> </span><span class="ss">type</span><span class="p">:</span><span class="w"> </span><span class="s">"UInt64"</span><span class="w">
|
||||
</span><span class="n">field</span><span class="w"> </span><span class="ss">:b</span><span class="p">,</span><span class="w"> </span><span class="ss">:string</span><span class="w">
|
||||
</span><span class="k" data-group-id="1766837243-3">end</span><span class="w">
|
||||
</span><span class="k" data-group-id="1766837243-2">end</span><span class="w">
|
||||
</span><span class="k" data-group-id="2250646288-3">end</span><span class="w">
|
||||
</span><span class="k" data-group-id="2250646288-2">end</span><span class="w">
|
||||
|
||||
</span><span class="n">rows</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nc">Stream</span><span class="o">.</span><span class="n">map</span><span class="p" data-group-id="1766837243-4">(</span><span class="mi">1</span><span class="o">..</span><span class="mi">100_000</span><span class="p">,</span><span class="w"> </span><span class="k" data-group-id="1766837243-5">fn</span><span class="w"> </span><span class="n">i</span><span class="w"> </span><span class="o">-></span><span class="w"> </span><span class="p" data-group-id="1766837243-6">%{</span><span class="ss">a</span><span class="p">:</span><span class="w"> </span><span class="n">i</span><span class="p">,</span><span class="w"> </span><span class="ss">b</span><span class="p">:</span><span class="w"> </span><span class="n">to_string</span><span class="p" data-group-id="1766837243-7">(</span><span class="n">i</span><span class="p" data-group-id="1766837243-7">)</span><span class="p" data-group-id="1766837243-6">}</span><span class="w"> </span><span class="k" data-group-id="1766837243-5">end</span><span class="p" data-group-id="1766837243-4">)</span><span class="w">
|
||||
</span><span class="p" data-group-id="1766837243-8">{</span><span class="mi">100_000</span><span class="p">,</span><span class="w"> </span><span class="no">nil</span><span class="p" data-group-id="1766837243-8">}</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nc">Repo</span><span class="o">.</span><span class="n">insert_stream</span><span class="p" data-group-id="1766837243-9">(</span><span class="nc">Demo</span><span class="p">,</span><span class="w"> </span><span class="n">rows</span><span class="p" data-group-id="1766837243-9">)</span><span class="w">
|
||||
</span><span class="n">rows</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nc">Stream</span><span class="o">.</span><span class="n">map</span><span class="p" data-group-id="2250646288-4">(</span><span class="mi">1</span><span class="o">..</span><span class="mi">100_000</span><span class="p">,</span><span class="w"> </span><span class="k" data-group-id="2250646288-5">fn</span><span class="w"> </span><span class="n">i</span><span class="w"> </span><span class="o">-></span><span class="w"> </span><span class="p" data-group-id="2250646288-6">%{</span><span class="ss">a</span><span class="p">:</span><span class="w"> </span><span class="n">i</span><span class="p">,</span><span class="w"> </span><span class="ss">b</span><span class="p">:</span><span class="w"> </span><span class="n">to_string</span><span class="p" data-group-id="2250646288-7">(</span><span class="n">i</span><span class="p" data-group-id="2250646288-7">)</span><span class="p" data-group-id="2250646288-6">}</span><span class="w"> </span><span class="k" data-group-id="2250646288-5">end</span><span class="p" data-group-id="2250646288-4">)</span><span class="w">
|
||||
</span><span class="p" data-group-id="2250646288-8">{</span><span class="mi">100_000</span><span class="p">,</span><span class="w"> </span><span class="no">nil</span><span class="p" data-group-id="2250646288-8">}</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nc">Repo</span><span class="o">.</span><span class="n">insert_stream</span><span class="p" data-group-id="2250646288-9">(</span><span class="nc">Demo</span><span class="p">,</span><span class="w"> </span><span class="n">rows</span><span class="p" data-group-id="2250646288-9">)</span><span class="w">
|
||||
|
||||
</span><span class="c1"># schemaless</span><span class="w">
|
||||
</span><span class="p" data-group-id="1766837243-10">{</span><span class="mi">100_000</span><span class="p">,</span><span class="w"> </span><span class="no">nil</span><span class="p" data-group-id="1766837243-10">}</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nc">Repo</span><span class="o">.</span><span class="n">insert_stream</span><span class="p" data-group-id="1766837243-11">(</span><span class="s">"ecto_ch_demo"</span><span class="p">,</span><span class="w"> </span><span class="n">rows</span><span class="p">,</span><span class="w"> </span><span class="ss">types</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="1766837243-12">[</span><span class="ss">a</span><span class="p">:</span><span class="w"> </span><span class="nc">Ch.Types</span><span class="o">.</span><span class="n">u64</span><span class="p" data-group-id="1766837243-13">(</span><span class="p" data-group-id="1766837243-13">)</span><span class="p">,</span><span class="w"> </span><span class="ss">b</span><span class="p">:</span><span class="w"> </span><span class="ss">:string</span><span class="p" data-group-id="1766837243-12">]</span><span class="p" data-group-id="1766837243-11">)</span></code></pre>
|
||||
</span><span class="p" data-group-id="2250646288-10">{</span><span class="mi">100_000</span><span class="p">,</span><span class="w"> </span><span class="no">nil</span><span class="p" data-group-id="2250646288-10">}</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nc">Repo</span><span class="o">.</span><span class="n">insert_stream</span><span class="p" data-group-id="2250646288-11">(</span><span class="s">"ecto_ch_demo"</span><span class="p">,</span><span class="w"> </span><span class="n">rows</span><span class="p">,</span><span class="w"> </span><span class="ss">types</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="2250646288-12">[</span><span class="ss">a</span><span class="p">:</span><span class="w"> </span><span class="nc">Ch.Types</span><span class="o">.</span><span class="n">u64</span><span class="p" data-group-id="2250646288-13">(</span><span class="p" data-group-id="2250646288-13">)</span><span class="p">,</span><span class="w"> </span><span class="ss">b</span><span class="p">:</span><span class="w"> </span><span class="ss">:string</span><span class="p" data-group-id="2250646288-12">]</span><span class="p" data-group-id="2250646288-11">)</span></code></pre>
|
||||
</section>
|
||||
</section>
|
||||
<section class="detail" id="load/2">
|
||||
@ -1508,7 +1508,7 @@ pool to disconnect within the given interval.</p><p>See <a href="https://hexdocs
|
||||
|
||||
</div>
|
||||
|
||||
<p>Similar to <a href="#to_sql/2"><code class="inline">to_sql/2</code></a> but inlines the parameters into the SQL query.</p><p>See <a href="https://hexdocs.pm/ecto_ch/0.3.4/Ecto.Adapters.ClickHouse.html#to_inline_sql/2"><code class="inline">Ecto.Adapters.ClickHouse.to_inline_sql/2</code></a> for more information.</p>
|
||||
<p>Similar to <a href="#to_sql/2"><code class="inline">to_sql/2</code></a> but inlines the parameters into the SQL query.</p><p>See <a href="https://hexdocs.pm/ecto_ch/0.3.5/Ecto.Adapters.ClickHouse.html#to_inline_sql/2"><code class="inline">Ecto.Adapters.ClickHouse.to_inline_sql/2</code></a> for more information.</p>
|
||||
</section>
|
||||
</section>
|
||||
<section class="detail" id="to_sql/2">
|
||||
|
@ -257,13 +257,13 @@ or from local storage for which it uses <a href="https://clickhouse.com/docs/en/
|
||||
|
||||
</div>
|
||||
|
||||
<p>Extracts min/max date range from a list of uploads.</p><p>Examples:</p><pre><code class="makeup elixir" translate="no"><span class="gp unselectable">iex> </span><span class="n">date_range</span><span class="p" data-group-id="8462791302-1">(</span><span class="p" data-group-id="8462791302-2">[</span><span class="w">
|
||||
</span><span class="gp unselectable">...> </span><span class="w"> </span><span class="p" data-group-id="8462791302-3">%{</span><span class="s">"filename"</span><span class="w"> </span><span class="p">=></span><span class="w"> </span><span class="s">"imported_devices_20190101_20210101.csv"</span><span class="p" data-group-id="8462791302-3">}</span><span class="p">,</span><span class="w">
|
||||
<p>Extracts min/max date range from a list of uploads.</p><p>Examples:</p><pre><code class="makeup elixir" translate="no"><span class="gp unselectable">iex> </span><span class="n">date_range</span><span class="p" data-group-id="7994585890-1">(</span><span class="p" data-group-id="7994585890-2">[</span><span class="w">
|
||||
</span><span class="gp unselectable">...> </span><span class="w"> </span><span class="p" data-group-id="7994585890-3">%{</span><span class="s">"filename"</span><span class="w"> </span><span class="p">=></span><span class="w"> </span><span class="s">"imported_devices_20190101_20210101.csv"</span><span class="p" data-group-id="7994585890-3">}</span><span class="p">,</span><span class="w">
|
||||
</span><span class="gp unselectable">...> </span><span class="w"> </span><span class="s">"pages_20200101_20220101.csv"</span><span class="w">
|
||||
</span><span class="gp unselectable">...> </span><span class="p" data-group-id="8462791302-2">]</span><span class="p" data-group-id="8462791302-1">)</span><span class="w">
|
||||
</span><span class="nc">Date</span><span class="o">.</span><span class="n">range</span><span class="p" data-group-id="8462791302-4">(</span><span class="ld">~D[2019-01-01]</span><span class="p">,</span><span class="w"> </span><span class="ld">~D[2022-01-01]</span><span class="p" data-group-id="8462791302-4">)</span><span class="w">
|
||||
</span><span class="gp unselectable">...> </span><span class="p" data-group-id="7994585890-2">]</span><span class="p" data-group-id="7994585890-1">)</span><span class="w">
|
||||
</span><span class="nc">Date</span><span class="o">.</span><span class="n">range</span><span class="p" data-group-id="7994585890-4">(</span><span class="ld">~D[2019-01-01]</span><span class="p">,</span><span class="w"> </span><span class="ld">~D[2022-01-01]</span><span class="p" data-group-id="7994585890-4">)</span><span class="w">
|
||||
|
||||
</span><span class="gp unselectable">iex> </span><span class="n">date_range</span><span class="p" data-group-id="8462791302-5">(</span><span class="p" data-group-id="8462791302-6">[</span><span class="p" data-group-id="8462791302-6">]</span><span class="p" data-group-id="8462791302-5">)</span><span class="w">
|
||||
</span><span class="gp unselectable">iex> </span><span class="n">date_range</span><span class="p" data-group-id="7994585890-5">(</span><span class="p" data-group-id="7994585890-6">[</span><span class="p" data-group-id="7994585890-6">]</span><span class="p" data-group-id="7994585890-5">)</span><span class="w">
|
||||
</span><span class="no">nil</span></code></pre>
|
||||
</section>
|
||||
</section>
|
||||
@ -292,13 +292,13 @@ or from local storage for which it uses <a href="https://clickhouse.com/docs/en/
|
||||
|
||||
</div>
|
||||
|
||||
<p>Extracts the table name from the provided filename.</p><p>Raises if the filename doesn't conform to the expected format.</p><p>Examples:</p><pre><code class="makeup elixir" translate="no"><span class="gp unselectable">iex> </span><span class="n">extract_table</span><span class="p" data-group-id="5784167920-1">(</span><span class="s">"my_data.csv"</span><span class="p" data-group-id="5784167920-1">)</span><span class="w">
|
||||
<p>Extracts the table name from the provided filename.</p><p>Raises if the filename doesn't conform to the expected format.</p><p>Examples:</p><pre><code class="makeup elixir" translate="no"><span class="gp unselectable">iex> </span><span class="n">extract_table</span><span class="p" data-group-id="0474523999-1">(</span><span class="s">"my_data.csv"</span><span class="p" data-group-id="0474523999-1">)</span><span class="w">
|
||||
</span><span class="gt">** (ArgumentError) invalid filename</span><span class="w">
|
||||
|
||||
</span><span class="gp unselectable">iex> </span><span class="n">extract_table</span><span class="p" data-group-id="5784167920-2">(</span><span class="s">"imported_devices_00010101_20250101.csv"</span><span class="p" data-group-id="5784167920-2">)</span><span class="w">
|
||||
</span><span class="gp unselectable">iex> </span><span class="n">extract_table</span><span class="p" data-group-id="0474523999-2">(</span><span class="s">"imported_devices_00010101_20250101.csv"</span><span class="p" data-group-id="0474523999-2">)</span><span class="w">
|
||||
</span><span class="s">"imported_devices"</span><span class="w">
|
||||
|
||||
</span><span class="gp unselectable">iex> </span><span class="n">extract_table</span><span class="p" data-group-id="5784167920-3">(</span><span class="s">"devices_00010101_20250101.csv"</span><span class="p" data-group-id="5784167920-3">)</span><span class="w">
|
||||
</span><span class="gp unselectable">iex> </span><span class="n">extract_table</span><span class="p" data-group-id="0474523999-3">(</span><span class="s">"devices_00010101_20250101.csv"</span><span class="p" data-group-id="0474523999-3">)</span><span class="w">
|
||||
</span><span class="s">"imported_devices"</span></code></pre>
|
||||
</section>
|
||||
</section>
|
||||
@ -321,8 +321,8 @@ or from local storage for which it uses <a href="https://clickhouse.com/docs/en/
|
||||
|
||||
<section class="docstring">
|
||||
|
||||
<p>Returns local directory for CSV imports storage.</p><p>Builds upon <code class="inline">$PERSISTENT_CACHE_DIR</code> (if set) and falls back to /tmp</p><p>Examples:</p><pre><code class="makeup elixir" translate="no"><span class="gp unselectable">iex> </span><span class="n">local_dir</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">local_dir</span><span class="p" data-group-id="5414680126-1">(</span><span class="c">_site_id</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="mi">37</span><span class="p" data-group-id="5414680126-1">)</span><span class="w">
|
||||
</span><span class="gp unselectable">iex> </span><span class="nc">String</span><span class="o">.</span><span class="n">ends_with?</span><span class="p" data-group-id="5414680126-2">(</span><span class="n">local_dir</span><span class="p">,</span><span class="w"> </span><span class="s">"/plausible-imports/37"</span><span class="p" data-group-id="5414680126-2">)</span><span class="w">
|
||||
<p>Returns local directory for CSV imports storage.</p><p>Builds upon <code class="inline">$PERSISTENT_CACHE_DIR</code> (if set) and falls back to /tmp</p><p>Examples:</p><pre><code class="makeup elixir" translate="no"><span class="gp unselectable">iex> </span><span class="n">local_dir</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">local_dir</span><span class="p" data-group-id="2772735015-1">(</span><span class="c">_site_id</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="mi">37</span><span class="p" data-group-id="2772735015-1">)</span><span class="w">
|
||||
</span><span class="gp unselectable">iex> </span><span class="nc">String</span><span class="o">.</span><span class="n">ends_with?</span><span class="p" data-group-id="2772735015-2">(</span><span class="n">local_dir</span><span class="p">,</span><span class="w"> </span><span class="s">"/plausible-imports/37"</span><span class="p" data-group-id="2772735015-2">)</span><span class="w">
|
||||
</span><span class="no">true</span></code></pre>
|
||||
</section>
|
||||
</section>
|
||||
@ -382,14 +382,14 @@ or from local storage for which it uses <a href="https://clickhouse.com/docs/en/
|
||||
|
||||
</div>
|
||||
|
||||
<p>Extracts table name and min/max dates from the filename.</p><p>Examples:</p><pre><code class="makeup elixir" translate="no"><span class="gp unselectable">iex> </span><span class="n">parse_filename!</span><span class="p" data-group-id="6155819894-1">(</span><span class="s">"my_data.csv"</span><span class="p" data-group-id="6155819894-1">)</span><span class="w">
|
||||
<p>Extracts table name and min/max dates from the filename.</p><p>Examples:</p><pre><code class="makeup elixir" translate="no"><span class="gp unselectable">iex> </span><span class="n">parse_filename!</span><span class="p" data-group-id="5362509805-1">(</span><span class="s">"my_data.csv"</span><span class="p" data-group-id="5362509805-1">)</span><span class="w">
|
||||
</span><span class="gt">** (ArgumentError) invalid filename</span><span class="w">
|
||||
|
||||
</span><span class="gp unselectable">iex> </span><span class="n">parse_filename!</span><span class="p" data-group-id="6155819894-2">(</span><span class="s">"imported_devices_00010101_20250101.csv"</span><span class="p" data-group-id="6155819894-2">)</span><span class="w">
|
||||
</span><span class="p" data-group-id="6155819894-3">{</span><span class="s">"imported_devices"</span><span class="p">,</span><span class="w"> </span><span class="ld">~D[0001-01-01]</span><span class="p">,</span><span class="w"> </span><span class="ld">~D[2025-01-01]</span><span class="p" data-group-id="6155819894-3">}</span><span class="w">
|
||||
</span><span class="gp unselectable">iex> </span><span class="n">parse_filename!</span><span class="p" data-group-id="5362509805-2">(</span><span class="s">"imported_devices_00010101_20250101.csv"</span><span class="p" data-group-id="5362509805-2">)</span><span class="w">
|
||||
</span><span class="p" data-group-id="5362509805-3">{</span><span class="s">"imported_devices"</span><span class="p">,</span><span class="w"> </span><span class="ld">~D[0001-01-01]</span><span class="p">,</span><span class="w"> </span><span class="ld">~D[2025-01-01]</span><span class="p" data-group-id="5362509805-3">}</span><span class="w">
|
||||
|
||||
</span><span class="gp unselectable">iex> </span><span class="n">parse_filename!</span><span class="p" data-group-id="6155819894-4">(</span><span class="s">"devices_00010101_20250101.csv"</span><span class="p" data-group-id="6155819894-4">)</span><span class="w">
|
||||
</span><span class="p" data-group-id="6155819894-5">{</span><span class="s">"imported_devices"</span><span class="p">,</span><span class="w"> </span><span class="ld">~D[0001-01-01]</span><span class="p">,</span><span class="w"> </span><span class="ld">~D[2025-01-01]</span><span class="p" data-group-id="6155819894-5">}</span></code></pre>
|
||||
</span><span class="gp unselectable">iex> </span><span class="n">parse_filename!</span><span class="p" data-group-id="5362509805-4">(</span><span class="s">"devices_00010101_20250101.csv"</span><span class="p" data-group-id="5362509805-4">)</span><span class="w">
|
||||
</span><span class="p" data-group-id="5362509805-5">{</span><span class="s">"imported_devices"</span><span class="p">,</span><span class="w"> </span><span class="ld">~D[0001-01-01]</span><span class="p">,</span><span class="w"> </span><span class="ld">~D[2025-01-01]</span><span class="p" data-group-id="5362509805-5">}</span></code></pre>
|
||||
</section>
|
||||
</section>
|
||||
<section class="detail" id="valid_filename?/1">
|
||||
@ -417,13 +417,13 @@ or from local storage for which it uses <a href="https://clickhouse.com/docs/en/
|
||||
|
||||
</div>
|
||||
|
||||
<p>Checks if the provided filename conforms to the expected format.</p><p>Examples:</p><pre><code class="makeup elixir" translate="no"><span class="gp unselectable">iex> </span><span class="n">valid_filename?</span><span class="p" data-group-id="6977556649-1">(</span><span class="s">"my_data.csv"</span><span class="p" data-group-id="6977556649-1">)</span><span class="w">
|
||||
<p>Checks if the provided filename conforms to the expected format.</p><p>Examples:</p><pre><code class="makeup elixir" translate="no"><span class="gp unselectable">iex> </span><span class="n">valid_filename?</span><span class="p" data-group-id="2274480232-1">(</span><span class="s">"my_data.csv"</span><span class="p" data-group-id="2274480232-1">)</span><span class="w">
|
||||
</span><span class="no">false</span><span class="w">
|
||||
|
||||
</span><span class="gp unselectable">iex> </span><span class="n">valid_filename?</span><span class="p" data-group-id="6977556649-2">(</span><span class="s">"imported_devices_00010101_20250101.csv"</span><span class="p" data-group-id="6977556649-2">)</span><span class="w">
|
||||
</span><span class="gp unselectable">iex> </span><span class="n">valid_filename?</span><span class="p" data-group-id="2274480232-2">(</span><span class="s">"imported_devices_00010101_20250101.csv"</span><span class="p" data-group-id="2274480232-2">)</span><span class="w">
|
||||
</span><span class="no">true</span><span class="w">
|
||||
|
||||
</span><span class="gp unselectable">iex> </span><span class="n">valid_filename?</span><span class="p" data-group-id="6977556649-3">(</span><span class="s">"devices_00010101_20250101.csv"</span><span class="p" data-group-id="6977556649-3">)</span><span class="w">
|
||||
</span><span class="gp unselectable">iex> </span><span class="n">valid_filename?</span><span class="p" data-group-id="2274480232-3">(</span><span class="s">"devices_00010101_20250101.csv"</span><span class="p" data-group-id="2274480232-3">)</span><span class="w">
|
||||
</span><span class="no">true</span></code></pre>
|
||||
</section>
|
||||
</section>
|
||||
|
@ -183,30 +183,30 @@ scope of importer logic and is expected to be implemented separately.</p><h2 id=
|
||||
</h2>
|
||||
<p>In case it's necessary to run the whole import job fully synchronously, the
|
||||
<a href="Plausible.Workers.ImportAnalytics.html"><code class="inline">Plausible.Workers.ImportAnalytics</code></a> worker sends an <a href="https://hexdocs.pm/oban/2.17.2/Oban.Notifier.html"><code class="inline">Oban.Notifier</code></a> message
|
||||
on completion, failure or transient failure of the import.</p><p>A basic usage scenario looks like this:</p><pre><code class="makeup elixir" translate="no"><span class="p" data-group-id="2023205121-1">{</span><span class="ss">:ok</span><span class="p">,</span><span class="w"> </span><span class="n">job</span><span class="p" data-group-id="2023205121-1">}</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nc">Plausible.Imported.NoopImporter</span><span class="o">.</span><span class="n">new_import</span><span class="p" data-group-id="2023205121-2">(</span><span class="w">
|
||||
on completion, failure or transient failure of the import.</p><p>A basic usage scenario looks like this:</p><pre><code class="makeup elixir" translate="no"><span class="p" data-group-id="3078980490-1">{</span><span class="ss">:ok</span><span class="p">,</span><span class="w"> </span><span class="n">job</span><span class="p" data-group-id="3078980490-1">}</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nc">Plausible.Imported.NoopImporter</span><span class="o">.</span><span class="n">new_import</span><span class="p" data-group-id="3078980490-2">(</span><span class="w">
|
||||
</span><span class="n">site</span><span class="p">,</span><span class="w">
|
||||
</span><span class="n">user</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">start_date</span><span class="p">:</span><span class="w"> </span><span class="ld">~D[2005-01-01]</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">end_date</span><span class="p">:</span><span class="w"> </span><span class="nc">Date</span><span class="o">.</span><span class="n">utc_today</span><span class="p" data-group-id="2023205121-3">(</span><span class="p" data-group-id="2023205121-3">)</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">end_date</span><span class="p">:</span><span class="w"> </span><span class="nc">Date</span><span class="o">.</span><span class="n">utc_today</span><span class="p" data-group-id="3078980490-3">(</span><span class="p" data-group-id="3078980490-3">)</span><span class="p">,</span><span class="w">
|
||||
</span><span class="c1"># this option is necessary to setup the calling process as listener</span><span class="w">
|
||||
</span><span class="ss">listen?</span><span class="p">:</span><span class="w"> </span><span class="no">true</span><span class="w">
|
||||
</span><span class="p" data-group-id="2023205121-2">)</span><span class="w">
|
||||
</span><span class="p" data-group-id="3078980490-2">)</span><span class="w">
|
||||
|
||||
</span><span class="n">import_id</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">job</span><span class="o">.</span><span class="n">args</span><span class="p" data-group-id="2023205121-4">[</span><span class="ss">:import_id</span><span class="p" data-group-id="2023205121-4">]</span><span class="w">
|
||||
</span><span class="n">import_id</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">job</span><span class="o">.</span><span class="n">args</span><span class="p" data-group-id="3078980490-4">[</span><span class="ss">:import_id</span><span class="p" data-group-id="3078980490-4">]</span><span class="w">
|
||||
|
||||
</span><span class="k">receive</span><span class="w"> </span><span class="k" data-group-id="2023205121-5">do</span><span class="w">
|
||||
</span><span class="p" data-group-id="2023205121-6">{</span><span class="ss">:notification</span><span class="p">,</span><span class="w"> </span><span class="ss">:analytics_imports_jobs</span><span class="p">,</span><span class="w"> </span><span class="p" data-group-id="2023205121-7">%{</span><span class="s">"event"</span><span class="w"> </span><span class="p">=></span><span class="w"> </span><span class="s">"complete"</span><span class="p">,</span><span class="w"> </span><span class="s">"import_id"</span><span class="w"> </span><span class="p">=></span><span class="w"> </span><span class="o">^</span><span class="n">import_id</span><span class="p" data-group-id="2023205121-7">}</span><span class="p" data-group-id="2023205121-6">}</span><span class="w"> </span><span class="o">-></span><span class="w">
|
||||
</span><span class="nc">IO</span><span class="o">.</span><span class="n">puts</span><span class="p" data-group-id="2023205121-8">(</span><span class="s">"Job completed"</span><span class="p" data-group-id="2023205121-8">)</span><span class="w">
|
||||
</span><span class="k">receive</span><span class="w"> </span><span class="k" data-group-id="3078980490-5">do</span><span class="w">
|
||||
</span><span class="p" data-group-id="3078980490-6">{</span><span class="ss">:notification</span><span class="p">,</span><span class="w"> </span><span class="ss">:analytics_imports_jobs</span><span class="p">,</span><span class="w"> </span><span class="p" data-group-id="3078980490-7">%{</span><span class="s">"event"</span><span class="w"> </span><span class="p">=></span><span class="w"> </span><span class="s">"complete"</span><span class="p">,</span><span class="w"> </span><span class="s">"import_id"</span><span class="w"> </span><span class="p">=></span><span class="w"> </span><span class="o">^</span><span class="n">import_id</span><span class="p" data-group-id="3078980490-7">}</span><span class="p" data-group-id="3078980490-6">}</span><span class="w"> </span><span class="o">-></span><span class="w">
|
||||
</span><span class="nc">IO</span><span class="o">.</span><span class="n">puts</span><span class="p" data-group-id="3078980490-8">(</span><span class="s">"Job completed"</span><span class="p" data-group-id="3078980490-8">)</span><span class="w">
|
||||
|
||||
</span><span class="p" data-group-id="2023205121-9">{</span><span class="ss">:notification</span><span class="p">,</span><span class="w"> </span><span class="ss">:analytics_imports_jobs</span><span class="p">,</span><span class="w"> </span><span class="p" data-group-id="2023205121-10">%{</span><span class="s">"event"</span><span class="w"> </span><span class="p">=></span><span class="w"> </span><span class="s">"transient_fail"</span><span class="p">,</span><span class="w"> </span><span class="s">"import_id"</span><span class="w"> </span><span class="p">=></span><span class="w"> </span><span class="o">^</span><span class="n">import_id</span><span class="p" data-group-id="2023205121-10">}</span><span class="p" data-group-id="2023205121-9">}</span><span class="w"> </span><span class="o">-></span><span class="w">
|
||||
</span><span class="nc">IO</span><span class="o">.</span><span class="n">puts</span><span class="p" data-group-id="2023205121-11">(</span><span class="s">"Job failed transiently"</span><span class="p" data-group-id="2023205121-11">)</span><span class="w">
|
||||
</span><span class="p" data-group-id="3078980490-9">{</span><span class="ss">:notification</span><span class="p">,</span><span class="w"> </span><span class="ss">:analytics_imports_jobs</span><span class="p">,</span><span class="w"> </span><span class="p" data-group-id="3078980490-10">%{</span><span class="s">"event"</span><span class="w"> </span><span class="p">=></span><span class="w"> </span><span class="s">"transient_fail"</span><span class="p">,</span><span class="w"> </span><span class="s">"import_id"</span><span class="w"> </span><span class="p">=></span><span class="w"> </span><span class="o">^</span><span class="n">import_id</span><span class="p" data-group-id="3078980490-10">}</span><span class="p" data-group-id="3078980490-9">}</span><span class="w"> </span><span class="o">-></span><span class="w">
|
||||
</span><span class="nc">IO</span><span class="o">.</span><span class="n">puts</span><span class="p" data-group-id="3078980490-11">(</span><span class="s">"Job failed transiently"</span><span class="p" data-group-id="3078980490-11">)</span><span class="w">
|
||||
|
||||
</span><span class="p" data-group-id="2023205121-12">{</span><span class="ss">:notification</span><span class="p">,</span><span class="w"> </span><span class="ss">:analytics_imports_jobs</span><span class="p">,</span><span class="w"> </span><span class="p" data-group-id="2023205121-13">%{</span><span class="s">"event"</span><span class="w"> </span><span class="p">=></span><span class="w"> </span><span class="s">"fail"</span><span class="p">,</span><span class="w"> </span><span class="s">"import_id"</span><span class="w"> </span><span class="p">=></span><span class="w"> </span><span class="o">^</span><span class="n">import_id</span><span class="p" data-group-id="2023205121-13">}</span><span class="p" data-group-id="2023205121-12">}</span><span class="w"> </span><span class="o">-></span><span class="w">
|
||||
</span><span class="nc">IO</span><span class="o">.</span><span class="n">puts</span><span class="p" data-group-id="2023205121-14">(</span><span class="s">"Job failed permanently"</span><span class="p" data-group-id="2023205121-14">)</span><span class="w">
|
||||
</span><span class="k" data-group-id="2023205121-5">after</span><span class="w">
|
||||
</span><span class="p" data-group-id="3078980490-12">{</span><span class="ss">:notification</span><span class="p">,</span><span class="w"> </span><span class="ss">:analytics_imports_jobs</span><span class="p">,</span><span class="w"> </span><span class="p" data-group-id="3078980490-13">%{</span><span class="s">"event"</span><span class="w"> </span><span class="p">=></span><span class="w"> </span><span class="s">"fail"</span><span class="p">,</span><span class="w"> </span><span class="s">"import_id"</span><span class="w"> </span><span class="p">=></span><span class="w"> </span><span class="o">^</span><span class="n">import_id</span><span class="p" data-group-id="3078980490-13">}</span><span class="p" data-group-id="3078980490-12">}</span><span class="w"> </span><span class="o">-></span><span class="w">
|
||||
</span><span class="nc">IO</span><span class="o">.</span><span class="n">puts</span><span class="p" data-group-id="3078980490-14">(</span><span class="s">"Job failed permanently"</span><span class="p" data-group-id="3078980490-14">)</span><span class="w">
|
||||
</span><span class="k" data-group-id="3078980490-5">after</span><span class="w">
|
||||
</span><span class="mi">15_000</span><span class="w"> </span><span class="o">-></span><span class="w">
|
||||
</span><span class="nc">IO</span><span class="o">.</span><span class="n">puts</span><span class="p" data-group-id="2023205121-15">(</span><span class="s">"Job didn't finish in 15 seconds"</span><span class="p" data-group-id="2023205121-15">)</span><span class="w">
|
||||
</span><span class="k" data-group-id="2023205121-5">end</span></code></pre><p>In a more realistic scenario, job scheduling will be done inside a GenServer process
|
||||
</span><span class="nc">IO</span><span class="o">.</span><span class="n">puts</span><span class="p" data-group-id="3078980490-15">(</span><span class="s">"Job didn't finish in 15 seconds"</span><span class="p" data-group-id="3078980490-15">)</span><span class="w">
|
||||
</span><span class="k" data-group-id="3078980490-5">end</span></code></pre><p>In a more realistic scenario, job scheduling will be done inside a GenServer process
|
||||
like LiveView, where notifications can be listened for via <code class="inline">handle_info/2</code>.</p>
|
||||
</section>
|
||||
|
||||
|
@ -1153,23 +1153,23 @@ pool to disconnect within the given interval.</p><p>See <a href="https://hexdocs
|
||||
|
||||
<section class="docstring">
|
||||
|
||||
<p>Similar to <a href="#insert_all/2"><code class="inline">insert_all/2</code></a> but with the following differences:</p><ul><li>accepts rows as streams or lists</li><li>sends rows as a chunked request</li><li>doesn't autogenerate ids or does any other preprocessing</li></ul><p>Example:</p><pre><code class="makeup elixir" translate="no"><span class="nc">Repo</span><span class="o">.</span><span class="n">query!</span><span class="p" data-group-id="7961101659-1">(</span><span class="s">"create table ecto_ch_demo(a UInt64, b String) engine Null"</span><span class="p" data-group-id="7961101659-1">)</span><span class="w">
|
||||
<p>Similar to <a href="#insert_all/2"><code class="inline">insert_all/2</code></a> but with the following differences:</p><ul><li>accepts rows as streams or lists</li><li>sends rows as a chunked request</li><li>doesn't autogenerate ids or does any other preprocessing</li></ul><p>Example:</p><pre><code class="makeup elixir" translate="no"><span class="nc">Repo</span><span class="o">.</span><span class="n">query!</span><span class="p" data-group-id="3429973133-1">(</span><span class="s">"create table ecto_ch_demo(a UInt64, b String) engine Null"</span><span class="p" data-group-id="3429973133-1">)</span><span class="w">
|
||||
|
||||
</span><span class="kd">defmodule</span><span class="w"> </span><span class="nc">Demo</span><span class="w"> </span><span class="k" data-group-id="7961101659-2">do</span><span class="w">
|
||||
</span><span class="kd">defmodule</span><span class="w"> </span><span class="nc">Demo</span><span class="w"> </span><span class="k" data-group-id="3429973133-2">do</span><span class="w">
|
||||
</span><span class="kn">use</span><span class="w"> </span><span class="nc">Ecto.Schema</span><span class="w">
|
||||
|
||||
</span><span class="na">@primary_key</span><span class="w"> </span><span class="no">false</span><span class="w">
|
||||
</span><span class="n">schema</span><span class="w"> </span><span class="s">"ecto_ch_demo"</span><span class="w"> </span><span class="k" data-group-id="7961101659-3">do</span><span class="w">
|
||||
</span><span class="n">schema</span><span class="w"> </span><span class="s">"ecto_ch_demo"</span><span class="w"> </span><span class="k" data-group-id="3429973133-3">do</span><span class="w">
|
||||
</span><span class="n">field</span><span class="w"> </span><span class="ss">:a</span><span class="p">,</span><span class="w"> </span><span class="nc">Ch</span><span class="p">,</span><span class="w"> </span><span class="ss">type</span><span class="p">:</span><span class="w"> </span><span class="s">"UInt64"</span><span class="w">
|
||||
</span><span class="n">field</span><span class="w"> </span><span class="ss">:b</span><span class="p">,</span><span class="w"> </span><span class="ss">:string</span><span class="w">
|
||||
</span><span class="k" data-group-id="7961101659-3">end</span><span class="w">
|
||||
</span><span class="k" data-group-id="7961101659-2">end</span><span class="w">
|
||||
</span><span class="k" data-group-id="3429973133-3">end</span><span class="w">
|
||||
</span><span class="k" data-group-id="3429973133-2">end</span><span class="w">
|
||||
|
||||
</span><span class="n">rows</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nc">Stream</span><span class="o">.</span><span class="n">map</span><span class="p" data-group-id="7961101659-4">(</span><span class="mi">1</span><span class="o">..</span><span class="mi">100_000</span><span class="p">,</span><span class="w"> </span><span class="k" data-group-id="7961101659-5">fn</span><span class="w"> </span><span class="n">i</span><span class="w"> </span><span class="o">-></span><span class="w"> </span><span class="p" data-group-id="7961101659-6">%{</span><span class="ss">a</span><span class="p">:</span><span class="w"> </span><span class="n">i</span><span class="p">,</span><span class="w"> </span><span class="ss">b</span><span class="p">:</span><span class="w"> </span><span class="n">to_string</span><span class="p" data-group-id="7961101659-7">(</span><span class="n">i</span><span class="p" data-group-id="7961101659-7">)</span><span class="p" data-group-id="7961101659-6">}</span><span class="w"> </span><span class="k" data-group-id="7961101659-5">end</span><span class="p" data-group-id="7961101659-4">)</span><span class="w">
|
||||
</span><span class="p" data-group-id="7961101659-8">{</span><span class="mi">100_000</span><span class="p">,</span><span class="w"> </span><span class="no">nil</span><span class="p" data-group-id="7961101659-8">}</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nc">Repo</span><span class="o">.</span><span class="n">insert_stream</span><span class="p" data-group-id="7961101659-9">(</span><span class="nc">Demo</span><span class="p">,</span><span class="w"> </span><span class="n">rows</span><span class="p" data-group-id="7961101659-9">)</span><span class="w">
|
||||
</span><span class="n">rows</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nc">Stream</span><span class="o">.</span><span class="n">map</span><span class="p" data-group-id="3429973133-4">(</span><span class="mi">1</span><span class="o">..</span><span class="mi">100_000</span><span class="p">,</span><span class="w"> </span><span class="k" data-group-id="3429973133-5">fn</span><span class="w"> </span><span class="n">i</span><span class="w"> </span><span class="o">-></span><span class="w"> </span><span class="p" data-group-id="3429973133-6">%{</span><span class="ss">a</span><span class="p">:</span><span class="w"> </span><span class="n">i</span><span class="p">,</span><span class="w"> </span><span class="ss">b</span><span class="p">:</span><span class="w"> </span><span class="n">to_string</span><span class="p" data-group-id="3429973133-7">(</span><span class="n">i</span><span class="p" data-group-id="3429973133-7">)</span><span class="p" data-group-id="3429973133-6">}</span><span class="w"> </span><span class="k" data-group-id="3429973133-5">end</span><span class="p" data-group-id="3429973133-4">)</span><span class="w">
|
||||
</span><span class="p" data-group-id="3429973133-8">{</span><span class="mi">100_000</span><span class="p">,</span><span class="w"> </span><span class="no">nil</span><span class="p" data-group-id="3429973133-8">}</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nc">Repo</span><span class="o">.</span><span class="n">insert_stream</span><span class="p" data-group-id="3429973133-9">(</span><span class="nc">Demo</span><span class="p">,</span><span class="w"> </span><span class="n">rows</span><span class="p" data-group-id="3429973133-9">)</span><span class="w">
|
||||
|
||||
</span><span class="c1"># schemaless</span><span class="w">
|
||||
</span><span class="p" data-group-id="7961101659-10">{</span><span class="mi">100_000</span><span class="p">,</span><span class="w"> </span><span class="no">nil</span><span class="p" data-group-id="7961101659-10">}</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nc">Repo</span><span class="o">.</span><span class="n">insert_stream</span><span class="p" data-group-id="7961101659-11">(</span><span class="s">"ecto_ch_demo"</span><span class="p">,</span><span class="w"> </span><span class="n">rows</span><span class="p">,</span><span class="w"> </span><span class="ss">types</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="7961101659-12">[</span><span class="ss">a</span><span class="p">:</span><span class="w"> </span><span class="nc">Ch.Types</span><span class="o">.</span><span class="n">u64</span><span class="p" data-group-id="7961101659-13">(</span><span class="p" data-group-id="7961101659-13">)</span><span class="p">,</span><span class="w"> </span><span class="ss">b</span><span class="p">:</span><span class="w"> </span><span class="ss">:string</span><span class="p" data-group-id="7961101659-12">]</span><span class="p" data-group-id="7961101659-11">)</span></code></pre>
|
||||
</span><span class="p" data-group-id="3429973133-10">{</span><span class="mi">100_000</span><span class="p">,</span><span class="w"> </span><span class="no">nil</span><span class="p" data-group-id="3429973133-10">}</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nc">Repo</span><span class="o">.</span><span class="n">insert_stream</span><span class="p" data-group-id="3429973133-11">(</span><span class="s">"ecto_ch_demo"</span><span class="p">,</span><span class="w"> </span><span class="n">rows</span><span class="p">,</span><span class="w"> </span><span class="ss">types</span><span class="p">:</span><span class="w"> </span><span class="p" data-group-id="3429973133-12">[</span><span class="ss">a</span><span class="p">:</span><span class="w"> </span><span class="nc">Ch.Types</span><span class="o">.</span><span class="n">u64</span><span class="p" data-group-id="3429973133-13">(</span><span class="p" data-group-id="3429973133-13">)</span><span class="p">,</span><span class="w"> </span><span class="ss">b</span><span class="p">:</span><span class="w"> </span><span class="ss">:string</span><span class="p" data-group-id="3429973133-12">]</span><span class="p" data-group-id="3429973133-11">)</span></code></pre>
|
||||
</section>
|
||||
</section>
|
||||
<section class="detail" id="load/2">
|
||||
@ -1508,7 +1508,7 @@ pool to disconnect within the given interval.</p><p>See <a href="https://hexdocs
|
||||
|
||||
</div>
|
||||
|
||||
<p>Similar to <a href="#to_sql/2"><code class="inline">to_sql/2</code></a> but inlines the parameters into the SQL query.</p><p>See <a href="https://hexdocs.pm/ecto_ch/0.3.4/Ecto.Adapters.ClickHouse.html#to_inline_sql/2"><code class="inline">Ecto.Adapters.ClickHouse.to_inline_sql/2</code></a> for more information.</p>
|
||||
<p>Similar to <a href="#to_sql/2"><code class="inline">to_sql/2</code></a> but inlines the parameters into the SQL query.</p><p>See <a href="https://hexdocs.pm/ecto_ch/0.3.5/Ecto.Adapters.ClickHouse.html#to_inline_sql/2"><code class="inline">Ecto.Adapters.ClickHouse.to_inline_sql/2</code></a> for more information.</p>
|
||||
</section>
|
||||
</section>
|
||||
<section class="detail" id="to_sql/2">
|
||||
|
@ -316,7 +316,7 @@ The URL expires in 300 seconds, which should be enough for a redirect.</p><p>In
|
||||
</div>
|
||||
|
||||
<p>Returns the pre-configured S3 bucket for CSV exports.</p><pre><code class="makeup elixir" translate="no"><span class="n">config</span><span class="w"> </span><span class="ss">:plausible</span><span class="p">,</span><span class="w"> </span><span class="nc">Plausible.S3</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">exports_bucket</span><span class="p">:</span><span class="w"> </span><span class="nc">System</span><span class="o">.</span><span class="n">fetch_env!</span><span class="p" data-group-id="6022619692-1">(</span><span class="s">"S3_EXPORTS_BUCKET"</span><span class="p" data-group-id="6022619692-1">)</span></code></pre><p>Example:</p><pre><code class="makeup elixir" translate="no"><span class="gp unselectable">iex> </span><span class="n">exports_bucket</span><span class="p" data-group-id="1589608784-1">(</span><span class="p" data-group-id="1589608784-1">)</span><span class="w">
|
||||
</span><span class="ss">exports_bucket</span><span class="p">:</span><span class="w"> </span><span class="nc">System</span><span class="o">.</span><span class="n">fetch_env!</span><span class="p" data-group-id="7780790418-1">(</span><span class="s">"S3_EXPORTS_BUCKET"</span><span class="p" data-group-id="7780790418-1">)</span></code></pre><p>Example:</p><pre><code class="makeup elixir" translate="no"><span class="gp unselectable">iex> </span><span class="n">exports_bucket</span><span class="p" data-group-id="3597103622-1">(</span><span class="p" data-group-id="3597103622-1">)</span><span class="w">
|
||||
</span><span class="s">"test-exports"</span></code></pre>
|
||||
</section>
|
||||
</section>
|
||||
@ -348,8 +348,8 @@ The URL expires in 300 seconds, which should be enough for a redirect.</p><p>In
|
||||
|
||||
</div>
|
||||
|
||||
<p>Returns <code class="inline">access_key_id</code> and <code class="inline">secret_access_key</code> to be used by ClickHouse during imports from S3.</p><p>Example:</p><pre><code class="makeup elixir" translate="no"><span class="gp unselectable">iex> </span><span class="n">import_clickhouse_credentials</span><span class="p" data-group-id="5828614238-1">(</span><span class="p" data-group-id="5828614238-1">)</span><span class="w">
|
||||
</span><span class="p" data-group-id="5828614238-2">%{</span><span class="ss">access_key_id</span><span class="p">:</span><span class="w"> </span><span class="s">"minioadmin"</span><span class="p">,</span><span class="w"> </span><span class="ss">secret_access_key</span><span class="p">:</span><span class="w"> </span><span class="s">"minioadmin"</span><span class="p" data-group-id="5828614238-2">}</span></code></pre>
|
||||
<p>Returns <code class="inline">access_key_id</code> and <code class="inline">secret_access_key</code> to be used by ClickHouse during imports from S3.</p><p>Example:</p><pre><code class="makeup elixir" translate="no"><span class="gp unselectable">iex> </span><span class="n">import_clickhouse_credentials</span><span class="p" data-group-id="4150111192-1">(</span><span class="p" data-group-id="4150111192-1">)</span><span class="w">
|
||||
</span><span class="p" data-group-id="4150111192-2">%{</span><span class="ss">access_key_id</span><span class="p">:</span><span class="w"> </span><span class="s">"minioadmin"</span><span class="p">,</span><span class="w"> </span><span class="ss">secret_access_key</span><span class="p">:</span><span class="w"> </span><span class="s">"minioadmin"</span><span class="p" data-group-id="4150111192-2">}</span></code></pre>
|
||||
</section>
|
||||
</section>
|
||||
<section class="detail" id="import_presign_upload/2">
|
||||
@ -371,9 +371,9 @@ The URL expires in 300 seconds, which should be enough for a redirect.</p><p>In
|
||||
|
||||
<section class="docstring">
|
||||
|
||||
<p>Presigns an upload for an imported file.</p><p>In the current implementation the bucket always goes into the path component.</p><p>Example:</p><pre><code class="makeup elixir" translate="no"><span class="gp unselectable">iex> </span><span class="n">upload</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">import_presign_upload</span><span class="p" data-group-id="4529862613-1">(</span><span class="c">_site_id</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="mi">123</span><span class="p">,</span><span class="w"> </span><span class="c">_filename</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">"imported_browsers.csv"</span><span class="p" data-group-id="4529862613-1">)</span><span class="w">
|
||||
</span><span class="gp unselectable">iex> </span><span class="no">true</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nc">String</span><span class="o">.</span><span class="n">ends_with?</span><span class="p" data-group-id="4529862613-2">(</span><span class="n">upload</span><span class="o">.</span><span class="n">s3_url</span><span class="p">,</span><span class="w"> </span><span class="s">"/test-imports/123/imported_browsers.csv"</span><span class="p" data-group-id="4529862613-2">)</span><span class="w">
|
||||
</span><span class="gp unselectable">iex> </span><span class="no">true</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nc">String</span><span class="o">.</span><span class="n">contains?</span><span class="p" data-group-id="4529862613-3">(</span><span class="n">upload</span><span class="o">.</span><span class="n">presigned_url</span><span class="p">,</span><span class="w"> </span><span class="s">"/test-imports/123/imported_browsers.csv?X-Amz-Algorithm=AWS4-HMAC-SHA256&"</span><span class="p" data-group-id="4529862613-3">)</span></code></pre>
|
||||
<p>Presigns an upload for an imported file.</p><p>In the current implementation the bucket always goes into the path component.</p><p>Example:</p><pre><code class="makeup elixir" translate="no"><span class="gp unselectable">iex> </span><span class="n">upload</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">import_presign_upload</span><span class="p" data-group-id="7948923096-1">(</span><span class="c">_site_id</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="mi">123</span><span class="p">,</span><span class="w"> </span><span class="c">_filename</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">"imported_browsers.csv"</span><span class="p" data-group-id="7948923096-1">)</span><span class="w">
|
||||
</span><span class="gp unselectable">iex> </span><span class="no">true</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nc">String</span><span class="o">.</span><span class="n">ends_with?</span><span class="p" data-group-id="7948923096-2">(</span><span class="n">upload</span><span class="o">.</span><span class="n">s3_url</span><span class="p">,</span><span class="w"> </span><span class="s">"/test-imports/123/imported_browsers.csv"</span><span class="p" data-group-id="7948923096-2">)</span><span class="w">
|
||||
</span><span class="gp unselectable">iex> </span><span class="no">true</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nc">String</span><span class="o">.</span><span class="n">contains?</span><span class="p" data-group-id="7948923096-3">(</span><span class="n">upload</span><span class="o">.</span><span class="n">presigned_url</span><span class="p">,</span><span class="w"> </span><span class="s">"/test-imports/123/imported_browsers.csv?X-Amz-Algorithm=AWS4-HMAC-SHA256&"</span><span class="p" data-group-id="7948923096-3">)</span></code></pre>
|
||||
</section>
|
||||
</section>
|
||||
<section class="detail" id="imports_bucket/0">
|
||||
@ -402,7 +402,7 @@ The URL expires in 300 seconds, which should be enough for a redirect.</p><p>In
|
||||
</div>
|
||||
|
||||
<p>Returns the pre-configured S3 bucket for CSV imports.</p><pre><code class="makeup elixir" translate="no"><span class="n">config</span><span class="w"> </span><span class="ss">:plausible</span><span class="p">,</span><span class="w"> </span><span class="nc">Plausible.S3</span><span class="p">,</span><span class="w">
|
||||
</span><span class="ss">imports_bucket</span><span class="p">:</span><span class="w"> </span><span class="nc">System</span><span class="o">.</span><span class="n">fetch_env!</span><span class="p" data-group-id="5239868428-1">(</span><span class="s">"S3_IMPORTS_BUCKET"</span><span class="p" data-group-id="5239868428-1">)</span></code></pre><p>Example:</p><pre><code class="makeup elixir" translate="no"><span class="gp unselectable">iex> </span><span class="n">imports_bucket</span><span class="p" data-group-id="9170289878-1">(</span><span class="p" data-group-id="9170289878-1">)</span><span class="w">
|
||||
</span><span class="ss">imports_bucket</span><span class="p">:</span><span class="w"> </span><span class="nc">System</span><span class="o">.</span><span class="n">fetch_env!</span><span class="p" data-group-id="1919467591-1">(</span><span class="s">"S3_IMPORTS_BUCKET"</span><span class="p" data-group-id="1919467591-1">)</span></code></pre><p>Example:</p><pre><code class="makeup elixir" translate="no"><span class="gp unselectable">iex> </span><span class="n">imports_bucket</span><span class="p" data-group-id="7854947221-1">(</span><span class="p" data-group-id="7854947221-1">)</span><span class="w">
|
||||
</span><span class="s">"test-imports"</span></code></pre>
|
||||
</section>
|
||||
</section>
|
||||
|
@ -283,14 +283,14 @@ Pages
|
||||
</a>
|
||||
<span class="text">Examples:</span>
|
||||
</h3>
|
||||
<pre><code class="makeup elixir" translate="no"><span class="gp unselectable">iex> </span><span class="nc">Filters</span><span class="o">.</span><span class="n">parse</span><span class="p" data-group-id="7208580668-1">(</span><span class="s">"{</span><span class="se">\"</span><span class="s">page</span><span class="se">\"</span><span class="s">:</span><span class="se">\"</span><span class="s">/blog/**</span><span class="se">\"</span><span class="s">}"</span><span class="p" data-group-id="7208580668-1">)</span><span class="w">
|
||||
</span><span class="p" data-group-id="7208580668-2">%{</span><span class="s">"event:page"</span><span class="w"> </span><span class="p">=></span><span class="w"> </span><span class="p" data-group-id="7208580668-3">{</span><span class="ss">:matches</span><span class="p">,</span><span class="w"> </span><span class="s">"/blog/**"</span><span class="p" data-group-id="7208580668-3">}</span><span class="p" data-group-id="7208580668-2">}</span><span class="w">
|
||||
<pre><code class="makeup elixir" translate="no"><span class="gp unselectable">iex> </span><span class="nc">Filters</span><span class="o">.</span><span class="n">parse</span><span class="p" data-group-id="6680010028-1">(</span><span class="s">"{</span><span class="se">\"</span><span class="s">page</span><span class="se">\"</span><span class="s">:</span><span class="se">\"</span><span class="s">/blog/**</span><span class="se">\"</span><span class="s">}"</span><span class="p" data-group-id="6680010028-1">)</span><span class="w">
|
||||
</span><span class="p" data-group-id="6680010028-2">%{</span><span class="s">"event:page"</span><span class="w"> </span><span class="p">=></span><span class="w"> </span><span class="p" data-group-id="6680010028-3">{</span><span class="ss">:matches</span><span class="p">,</span><span class="w"> </span><span class="s">"/blog/**"</span><span class="p" data-group-id="6680010028-3">}</span><span class="p" data-group-id="6680010028-2">}</span><span class="w">
|
||||
|
||||
</span><span class="gp unselectable">iex> </span><span class="nc">Filters</span><span class="o">.</span><span class="n">parse</span><span class="p" data-group-id="7208580668-4">(</span><span class="s">"visit:browser!=Chrome"</span><span class="p" data-group-id="7208580668-4">)</span><span class="w">
|
||||
</span><span class="p" data-group-id="7208580668-5">%{</span><span class="s">"visit:browser"</span><span class="w"> </span><span class="p">=></span><span class="w"> </span><span class="p" data-group-id="7208580668-6">{</span><span class="ss">:is_not</span><span class="p">,</span><span class="w"> </span><span class="s">"Chrome"</span><span class="p" data-group-id="7208580668-6">}</span><span class="p" data-group-id="7208580668-5">}</span><span class="w">
|
||||
</span><span class="gp unselectable">iex> </span><span class="nc">Filters</span><span class="o">.</span><span class="n">parse</span><span class="p" data-group-id="6680010028-4">(</span><span class="s">"visit:browser!=Chrome"</span><span class="p" data-group-id="6680010028-4">)</span><span class="w">
|
||||
</span><span class="p" data-group-id="6680010028-5">%{</span><span class="s">"visit:browser"</span><span class="w"> </span><span class="p">=></span><span class="w"> </span><span class="p" data-group-id="6680010028-6">{</span><span class="ss">:is_not</span><span class="p">,</span><span class="w"> </span><span class="s">"Chrome"</span><span class="p" data-group-id="6680010028-6">}</span><span class="p" data-group-id="6680010028-5">}</span><span class="w">
|
||||
|
||||
</span><span class="gp unselectable">iex> </span><span class="nc">Filters</span><span class="o">.</span><span class="n">parse</span><span class="p" data-group-id="7208580668-7">(</span><span class="no">nil</span><span class="p" data-group-id="7208580668-7">)</span><span class="w">
|
||||
</span><span class="p" data-group-id="7208580668-8">%{</span><span class="p" data-group-id="7208580668-8">}</span></code></pre>
|
||||
</span><span class="gp unselectable">iex> </span><span class="nc">Filters</span><span class="o">.</span><span class="n">parse</span><span class="p" data-group-id="6680010028-7">(</span><span class="no">nil</span><span class="p" data-group-id="6680010028-7">)</span><span class="w">
|
||||
</span><span class="p" data-group-id="6680010028-8">%{</span><span class="p" data-group-id="6680010028-8">}</span></code></pre>
|
||||
</section>
|
||||
</section>
|
||||
<section class="detail" id="visit_props/0">
|
||||
|
BIN
Plausible.epub
BIN
Plausible.epub
Binary file not shown.
@ -747,13 +747,13 @@ and <code class="inline">month</code>. The default depends on the <code class="i
|
||||
<code class="inline">Plausible.Query.from/2</code> for each default.</p></li><li><p><code class="inline">filters</code> - optional filters to drill down data. See the Stats API
|
||||
<a href="https://plausible.io/docs/stats-api#filtering">"Filtering"</a> section for
|
||||
more details.</p></li><li><p><code class="inline">with_imported</code> - boolean indicating whether to include Google Analytics
|
||||
imported data or not. Defaults to <code class="inline">false</code>.</p></li></ul><p>Full example:</p><pre><code class="makeup elixir" translate="no"><span class="p" data-group-id="2933667829-1">%{</span><span class="w">
|
||||
imported data or not. Defaults to <code class="inline">false</code>.</p></li></ul><p>Full example:</p><pre><code class="makeup elixir" translate="no"><span class="p" data-group-id="1298584619-1">%{</span><span class="w">
|
||||
</span><span class="s">"from"</span><span class="w"> </span><span class="p">=></span><span class="w"> </span><span class="s">"2021-09-06"</span><span class="p">,</span><span class="w">
|
||||
</span><span class="s">"interval"</span><span class="w"> </span><span class="p">=></span><span class="w"> </span><span class="s">"month"</span><span class="p">,</span><span class="w">
|
||||
</span><span class="s">"metric"</span><span class="w"> </span><span class="p">=></span><span class="w"> </span><span class="s">"visitors"</span><span class="p">,</span><span class="w">
|
||||
</span><span class="s">"period"</span><span class="w"> </span><span class="p">=></span><span class="w"> </span><span class="s">"custom"</span><span class="p">,</span><span class="w">
|
||||
</span><span class="s">"to"</span><span class="w"> </span><span class="p">=></span><span class="w"> </span><span class="s">"2021-12-13"</span><span class="w">
|
||||
</span><span class="p" data-group-id="2933667829-1">}</span></code></pre><h2 id="main_graph/2-response" class="section-heading">
|
||||
</span><span class="p" data-group-id="1298584619-1">}</span></code></pre><h2 id="main_graph/2-response" class="section-heading">
|
||||
<a href="#main_graph/2-response" class="hover-link">
|
||||
<i class="ri-link-m" aria-hidden="true"></i>
|
||||
</a>
|
||||
@ -768,20 +768,20 @@ cut off by the requested date range or not. For example, if looking at a
|
||||
month week-by-week, some weeks may be cut off by the month boundaries.
|
||||
It's useful to adjust the graph display slightly in case the interval is
|
||||
not 'full' so that the user understands why the numbers might be lower for
|
||||
those partial periods.</p></li></ul><p>Full example:</p><pre><code class="makeup elixir" translate="no"><span class="p" data-group-id="7719587746-1">%{</span><span class="w">
|
||||
</span><span class="s">"full_intervals"</span><span class="w"> </span><span class="p">=></span><span class="w"> </span><span class="p" data-group-id="7719587746-2">%{</span><span class="w">
|
||||
those partial periods.</p></li></ul><p>Full example:</p><pre><code class="makeup elixir" translate="no"><span class="p" data-group-id="3166489147-1">%{</span><span class="w">
|
||||
</span><span class="s">"full_intervals"</span><span class="w"> </span><span class="p">=></span><span class="w"> </span><span class="p" data-group-id="3166489147-2">%{</span><span class="w">
|
||||
</span><span class="s">"2021-09-01"</span><span class="w"> </span><span class="p">=></span><span class="w"> </span><span class="no">false</span><span class="p">,</span><span class="w">
|
||||
</span><span class="s">"2021-10-01"</span><span class="w"> </span><span class="p">=></span><span class="w"> </span><span class="no">true</span><span class="p">,</span><span class="w">
|
||||
</span><span class="s">"2021-11-01"</span><span class="w"> </span><span class="p">=></span><span class="w"> </span><span class="no">true</span><span class="p">,</span><span class="w">
|
||||
</span><span class="s">"2021-12-01"</span><span class="w"> </span><span class="p">=></span><span class="w"> </span><span class="no">false</span><span class="w">
|
||||
</span><span class="p" data-group-id="7719587746-2">}</span><span class="p">,</span><span class="w">
|
||||
</span><span class="p" data-group-id="3166489147-2">}</span><span class="p">,</span><span class="w">
|
||||
</span><span class="s">"imports_exist"</span><span class="w"> </span><span class="p">=></span><span class="w"> </span><span class="no">false</span><span class="p">,</span><span class="w">
|
||||
</span><span class="s">"interval"</span><span class="w"> </span><span class="p">=></span><span class="w"> </span><span class="s">"month"</span><span class="p">,</span><span class="w">
|
||||
</span><span class="s">"labels"</span><span class="w"> </span><span class="p">=></span><span class="w"> </span><span class="p" data-group-id="7719587746-3">[</span><span class="s">"2021-09-01"</span><span class="p">,</span><span class="w"> </span><span class="s">"2021-10-01"</span><span class="p">,</span><span class="w"> </span><span class="s">"2021-11-01"</span><span class="p">,</span><span class="w"> </span><span class="s">"2021-12-01"</span><span class="p" data-group-id="7719587746-3">]</span><span class="p">,</span><span class="w">
|
||||
</span><span class="s">"plot"</span><span class="w"> </span><span class="p">=></span><span class="w"> </span><span class="p" data-group-id="7719587746-4">[</span><span class="mi">0</span><span class="p">,</span><span class="w"> </span><span class="mi">0</span><span class="p">,</span><span class="w"> </span><span class="mi">0</span><span class="p">,</span><span class="w"> </span><span class="mi">0</span><span class="p" data-group-id="7719587746-4">]</span><span class="p">,</span><span class="w">
|
||||
</span><span class="s">"labels"</span><span class="w"> </span><span class="p">=></span><span class="w"> </span><span class="p" data-group-id="3166489147-3">[</span><span class="s">"2021-09-01"</span><span class="p">,</span><span class="w"> </span><span class="s">"2021-10-01"</span><span class="p">,</span><span class="w"> </span><span class="s">"2021-11-01"</span><span class="p">,</span><span class="w"> </span><span class="s">"2021-12-01"</span><span class="p" data-group-id="3166489147-3">]</span><span class="p">,</span><span class="w">
|
||||
</span><span class="s">"plot"</span><span class="w"> </span><span class="p">=></span><span class="w"> </span><span class="p" data-group-id="3166489147-4">[</span><span class="mi">0</span><span class="p">,</span><span class="w"> </span><span class="mi">0</span><span class="p">,</span><span class="w"> </span><span class="mi">0</span><span class="p">,</span><span class="w"> </span><span class="mi">0</span><span class="p" data-group-id="3166489147-4">]</span><span class="p">,</span><span class="w">
|
||||
</span><span class="s">"present_index"</span><span class="w"> </span><span class="p">=></span><span class="w"> </span><span class="no">nil</span><span class="p">,</span><span class="w">
|
||||
</span><span class="s">"with_imported"</span><span class="w"> </span><span class="p">=></span><span class="w"> </span><span class="no">false</span><span class="w">
|
||||
</span><span class="p" data-group-id="7719587746-1">}</span></code></pre>
|
||||
</span><span class="p" data-group-id="3166489147-1">}</span></code></pre>
|
||||
</section>
|
||||
</section>
|
||||
<section class="detail" id="operating_system_versions/2">
|
||||
|
@ -153,18 +153,18 @@ on connections with high latency.</p><h2 id="module-usage" class="section-headin
|
||||
<span class="text">Usage</span>
|
||||
</h2>
|
||||
<p>An example use case for a modal is embedding a form inside
|
||||
existing live view which allows adding new entries of some kind:</p><pre><code class="makeup elixir" translate="no"><span class="o"><</span><span class="o">.</span><span class="n">live_component</span><span class="w"> </span><span class="n">module</span><span class="o">=</span><span class="p" data-group-id="1643545402-1">{</span><span class="nc">Modal</span><span class="p" data-group-id="1643545402-1">}</span><span class="w"> </span><span class="n">id</span><span class="o">=</span><span class="s">"some-form-modal"</span><span class="o">></span><span class="w">
|
||||
existing live view which allows adding new entries of some kind:</p><pre><code class="makeup elixir" translate="no"><span class="o"><</span><span class="o">.</span><span class="n">live_component</span><span class="w"> </span><span class="n">module</span><span class="o">=</span><span class="p" data-group-id="1325408427-1">{</span><span class="nc">Modal</span><span class="p" data-group-id="1325408427-1">}</span><span class="w"> </span><span class="n">id</span><span class="o">=</span><span class="s">"some-form-modal"</span><span class="o">></span><span class="w">
|
||||
</span><span class="o"><</span><span class="o">.</span><span class="n">live_component</span><span class="w">
|
||||
</span><span class="n">module</span><span class="o">=</span><span class="p" data-group-id="1643545402-2">{</span><span class="nc">SomeForm</span><span class="p" data-group-id="1643545402-2">}</span><span class="w">
|
||||
</span><span class="n">module</span><span class="o">=</span><span class="p" data-group-id="1325408427-2">{</span><span class="nc">SomeForm</span><span class="p" data-group-id="1325408427-2">}</span><span class="w">
|
||||
</span><span class="n">id</span><span class="o">=</span><span class="s">"some-form"</span><span class="w">
|
||||
</span><span class="n">on_save_form</span><span class="o">=</span><span class="p" data-group-id="1643545402-3">{</span><span class="w">
|
||||
</span><span class="k" data-group-id="1643545402-4">fn</span><span class="w"> </span><span class="n">entry</span><span class="p">,</span><span class="w"> </span><span class="n">socket</span><span class="w"> </span><span class="o">-></span><span class="w">
|
||||
</span><span class="n">send</span><span class="p" data-group-id="1643545402-5">(</span><span class="n">self</span><span class="p" data-group-id="1643545402-6">(</span><span class="p" data-group-id="1643545402-6">)</span><span class="p">,</span><span class="w"> </span><span class="p" data-group-id="1643545402-7">{</span><span class="ss">:entry_added</span><span class="p">,</span><span class="w"> </span><span class="n">entry</span><span class="p" data-group-id="1643545402-7">}</span><span class="p" data-group-id="1643545402-5">)</span><span class="w">
|
||||
</span><span class="nc">Modal</span><span class="o">.</span><span class="n">close</span><span class="p" data-group-id="1643545402-8">(</span><span class="n">socket</span><span class="p">,</span><span class="w"> </span><span class="s">"some-form-modal"</span><span class="p" data-group-id="1643545402-8">)</span><span class="w">
|
||||
</span><span class="k" data-group-id="1643545402-4">end</span><span class="w">
|
||||
</span><span class="p" data-group-id="1643545402-3">}</span><span class="w">
|
||||
</span><span class="n">on_save_form</span><span class="o">=</span><span class="p" data-group-id="1325408427-3">{</span><span class="w">
|
||||
</span><span class="k" data-group-id="1325408427-4">fn</span><span class="w"> </span><span class="n">entry</span><span class="p">,</span><span class="w"> </span><span class="n">socket</span><span class="w"> </span><span class="o">-></span><span class="w">
|
||||
</span><span class="n">send</span><span class="p" data-group-id="1325408427-5">(</span><span class="n">self</span><span class="p" data-group-id="1325408427-6">(</span><span class="p" data-group-id="1325408427-6">)</span><span class="p">,</span><span class="w"> </span><span class="p" data-group-id="1325408427-7">{</span><span class="ss">:entry_added</span><span class="p">,</span><span class="w"> </span><span class="n">entry</span><span class="p" data-group-id="1325408427-7">}</span><span class="p" data-group-id="1325408427-5">)</span><span class="w">
|
||||
</span><span class="nc">Modal</span><span class="o">.</span><span class="n">close</span><span class="p" data-group-id="1325408427-8">(</span><span class="n">socket</span><span class="p">,</span><span class="w"> </span><span class="s">"some-form-modal"</span><span class="p" data-group-id="1325408427-8">)</span><span class="w">
|
||||
</span><span class="k" data-group-id="1325408427-4">end</span><span class="w">
|
||||
</span><span class="p" data-group-id="1325408427-3">}</span><span class="w">
|
||||
</span><span class="o">/</span><span class="o">></span><span class="w">
|
||||
</span><span class="o"><</span><span class="o">/</span><span class="o">.</span><span class="n">live_component</span><span class="o">></span></code></pre><p>Then somewhere in the same live view the modal is rendered in:</p><pre><code class="makeup elixir" translate="no"><span class="o"><</span><span class="o">.</span><span class="n">button</span><span class="w"> </span><span class="n">x</span><span class="o">-</span><span class="n">data</span><span class="w"> </span><span class="n">x</span><span class="o">-</span><span class="n">on</span><span class="ss">:click</span><span class="o">=</span><span class="p" data-group-id="5827196590-1">{</span><span class="nc">Modal.JS</span><span class="o">.</span><span class="n">open</span><span class="p" data-group-id="5827196590-2">(</span><span class="s">"goals-form-modal"</span><span class="p" data-group-id="5827196590-2">)</span><span class="p" data-group-id="5827196590-1">}</span><span class="o">></span><span class="w">
|
||||
</span><span class="o"><</span><span class="o">/</span><span class="o">.</span><span class="n">live_component</span><span class="o">></span></code></pre><p>Then somewhere in the same live view the modal is rendered in:</p><pre><code class="makeup elixir" translate="no"><span class="o"><</span><span class="o">.</span><span class="n">button</span><span class="w"> </span><span class="n">x</span><span class="o">-</span><span class="n">data</span><span class="w"> </span><span class="n">x</span><span class="o">-</span><span class="n">on</span><span class="ss">:click</span><span class="o">=</span><span class="p" data-group-id="3181679657-1">{</span><span class="nc">Modal.JS</span><span class="o">.</span><span class="n">open</span><span class="p" data-group-id="3181679657-2">(</span><span class="s">"goals-form-modal"</span><span class="p" data-group-id="3181679657-2">)</span><span class="p" data-group-id="3181679657-1">}</span><span class="o">></span><span class="w">
|
||||
</span><span class="o">+</span><span class="w"> </span><span class="nc">Add</span><span class="w"> </span><span class="nc">Entry</span><span class="w">
|
||||
</span><span class="o"><</span><span class="o">/</span><span class="o">.</span><span class="n">button</span><span class="o">></span></code></pre><h2 id="module-explanation" class="section-heading">
|
||||
<a href="#module-explanation" class="hover-link">
|
||||
@ -184,26 +184,26 @@ itself - adding <code class="inline">x-data</code> attribute without any value i
|
||||
to ensure that.</p></li><li><p><code class="inline">Modal.close/2</code> - to close the modal from the backend; usually
|
||||
done inside wrapped component's <code class="inline">handle_event/2</code>. The example
|
||||
quoted above shows one way to implement this, under that assumption
|
||||
that the component exposes a callback, like this:</p><pre><code class="makeup elixir" translate="no"><span class="kd">defmodule</span><span class="w"> </span><span class="nc">SomeForm</span><span class="w"> </span><span class="k" data-group-id="3131110210-1">do</span><span class="w">
|
||||
that the component exposes a callback, like this:</p><pre><code class="makeup elixir" translate="no"><span class="kd">defmodule</span><span class="w"> </span><span class="nc">SomeForm</span><span class="w"> </span><span class="k" data-group-id="6782174543-1">do</span><span class="w">
|
||||
</span><span class="kn">use</span><span class="w"> </span><span class="nc">Phoenix.LiveComponent</span><span class="w">
|
||||
|
||||
</span><span class="kd">def</span><span class="w"> </span><span class="nf">update</span><span class="p" data-group-id="3131110210-2">(</span><span class="n">assigns</span><span class="p">,</span><span class="w"> </span><span class="n">socket</span><span class="p" data-group-id="3131110210-2">)</span><span class="w"> </span><span class="k" data-group-id="3131110210-3">do</span><span class="w">
|
||||
</span><span class="kd">def</span><span class="w"> </span><span class="nf">update</span><span class="p" data-group-id="6782174543-2">(</span><span class="n">assigns</span><span class="p">,</span><span class="w"> </span><span class="n">socket</span><span class="p" data-group-id="6782174543-2">)</span><span class="w"> </span><span class="k" data-group-id="6782174543-3">do</span><span class="w">
|
||||
</span><span class="c1"># ...</span><span class="w">
|
||||
|
||||
</span><span class="p" data-group-id="3131110210-4">{</span><span class="ss">:ok</span><span class="p">,</span><span class="w"> </span><span class="n">assign</span><span class="p" data-group-id="3131110210-5">(</span><span class="n">socket</span><span class="p">,</span><span class="w"> </span><span class="ss">:on_save_form</span><span class="p">,</span><span class="w"> </span><span class="n">assigns</span><span class="o">.</span><span class="n">on_save_form</span><span class="p" data-group-id="3131110210-5">)</span><span class="p" data-group-id="3131110210-4">}</span><span class="w">
|
||||
</span><span class="k" data-group-id="3131110210-3">end</span><span class="w">
|
||||
</span><span class="p" data-group-id="6782174543-4">{</span><span class="ss">:ok</span><span class="p">,</span><span class="w"> </span><span class="n">assign</span><span class="p" data-group-id="6782174543-5">(</span><span class="n">socket</span><span class="p">,</span><span class="w"> </span><span class="ss">:on_save_form</span><span class="p">,</span><span class="w"> </span><span class="n">assigns</span><span class="o">.</span><span class="n">on_save_form</span><span class="p" data-group-id="6782174543-5">)</span><span class="p" data-group-id="6782174543-4">}</span><span class="w">
|
||||
</span><span class="k" data-group-id="6782174543-3">end</span><span class="w">
|
||||
|
||||
</span><span class="c1">#...</span><span class="w">
|
||||
|
||||
</span><span class="kd">def</span><span class="w"> </span><span class="nf">handle_event</span><span class="p" data-group-id="3131110210-6">(</span><span class="s">"save-form"</span><span class="p">,</span><span class="w"> </span><span class="p" data-group-id="3131110210-7">%{</span><span class="s">"form"</span><span class="w"> </span><span class="p">=></span><span class="w"> </span><span class="n">form</span><span class="p" data-group-id="3131110210-7">}</span><span class="p">,</span><span class="w"> </span><span class="n">socket</span><span class="p" data-group-id="3131110210-6">)</span><span class="w"> </span><span class="k" data-group-id="3131110210-8">do</span><span class="w">
|
||||
</span><span class="k">case</span><span class="w"> </span><span class="n">save_entry</span><span class="p" data-group-id="3131110210-9">(</span><span class="n">form</span><span class="p" data-group-id="3131110210-9">)</span><span class="w"> </span><span class="k" data-group-id="3131110210-10">do</span><span class="w">
|
||||
</span><span class="p" data-group-id="3131110210-11">{</span><span class="ss">:ok</span><span class="p">,</span><span class="w"> </span><span class="n">entry</span><span class="p" data-group-id="3131110210-11">}</span><span class="w"> </span><span class="o">-></span><span class="w">
|
||||
</span><span class="p" data-group-id="3131110210-12">{</span><span class="ss">:noreply</span><span class="p">,</span><span class="w"> </span><span class="n">socket</span><span class="o">.</span><span class="n">assigns</span><span class="o">.</span><span class="n">on_save_form</span><span class="p" data-group-id="3131110210-13">(</span><span class="n">entry</span><span class="p">,</span><span class="w"> </span><span class="n">socket</span><span class="p" data-group-id="3131110210-13">)</span><span class="p" data-group-id="3131110210-12">}</span><span class="w">
|
||||
</span><span class="kd">def</span><span class="w"> </span><span class="nf">handle_event</span><span class="p" data-group-id="6782174543-6">(</span><span class="s">"save-form"</span><span class="p">,</span><span class="w"> </span><span class="p" data-group-id="6782174543-7">%{</span><span class="s">"form"</span><span class="w"> </span><span class="p">=></span><span class="w"> </span><span class="n">form</span><span class="p" data-group-id="6782174543-7">}</span><span class="p">,</span><span class="w"> </span><span class="n">socket</span><span class="p" data-group-id="6782174543-6">)</span><span class="w"> </span><span class="k" data-group-id="6782174543-8">do</span><span class="w">
|
||||
</span><span class="k">case</span><span class="w"> </span><span class="n">save_entry</span><span class="p" data-group-id="6782174543-9">(</span><span class="n">form</span><span class="p" data-group-id="6782174543-9">)</span><span class="w"> </span><span class="k" data-group-id="6782174543-10">do</span><span class="w">
|
||||
</span><span class="p" data-group-id="6782174543-11">{</span><span class="ss">:ok</span><span class="p">,</span><span class="w"> </span><span class="n">entry</span><span class="p" data-group-id="6782174543-11">}</span><span class="w"> </span><span class="o">-></span><span class="w">
|
||||
</span><span class="p" data-group-id="6782174543-12">{</span><span class="ss">:noreply</span><span class="p">,</span><span class="w"> </span><span class="n">socket</span><span class="o">.</span><span class="n">assigns</span><span class="o">.</span><span class="n">on_save_form</span><span class="p" data-group-id="6782174543-13">(</span><span class="n">entry</span><span class="p">,</span><span class="w"> </span><span class="n">socket</span><span class="p" data-group-id="6782174543-13">)</span><span class="p" data-group-id="6782174543-12">}</span><span class="w">
|
||||
|
||||
</span><span class="c1"># error case handling ...</span><span class="w">
|
||||
</span><span class="k" data-group-id="3131110210-10">end</span><span class="w">
|
||||
</span><span class="k" data-group-id="3131110210-8">end</span><span class="w">
|
||||
</span><span class="k" data-group-id="3131110210-1">end</span></code></pre><p>Using callback approach has an added benefit of making the
|
||||
</span><span class="k" data-group-id="6782174543-10">end</span><span class="w">
|
||||
</span><span class="k" data-group-id="6782174543-8">end</span><span class="w">
|
||||
</span><span class="k" data-group-id="6782174543-1">end</span></code></pre><p>Using callback approach has an added benefit of making the
|
||||
component more flexible.</p></li></ul>
|
||||
</section>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user