mirror of
https://github.com/plausible/analytics.git
synced 2024-11-23 20:13:31 +03:00
842 lines
43 KiB
HTML
842 lines
43 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<meta http-equiv="x-ua-compatible" content="ie=edge">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<meta name="generator" content="ExDoc v0.31.1">
|
|
<meta name="project" content="Plausible v0.0.1">
|
|
|
|
|
|
<title>Plausible.Cldr.Locale — Plausible v0.0.1</title>
|
|
<link rel="stylesheet" href="dist/html-elixir-FM2CSD74.css" />
|
|
|
|
|
|
<script src="dist/handlebars.runtime-NWIB6V2M.js"></script>
|
|
<script src="dist/handlebars.templates-43PMFBC7.js"></script>
|
|
<script src="dist/sidebar_items-592676E6.js"></script>
|
|
|
|
<script src="docs_config.js"></script>
|
|
|
|
<script async src="dist/html-L4O5OK2K.js"></script>
|
|
|
|
|
|
</head>
|
|
<body data-type="modules" class="page-module">
|
|
<script>
|
|
|
|
try {
|
|
var settings = JSON.parse(localStorage.getItem('ex_doc:settings') || '{}');
|
|
|
|
if (settings.theme === 'dark' ||
|
|
((settings.theme === 'system' || settings.theme == null) &&
|
|
window.matchMedia('(prefers-color-scheme: dark)').matches)
|
|
) {
|
|
document.body.classList.add('dark')
|
|
}
|
|
} catch (error) { }
|
|
</script>
|
|
|
|
<div class="main">
|
|
|
|
<button id="sidebar-menu" class="sidebar-button sidebar-toggle" aria-label="toggle sidebar" aria-controls="sidebar">
|
|
<i class="ri-menu-line ri-lg" title="Collapse/expand sidebar"></i>
|
|
</button>
|
|
|
|
<div class="background-layer"></div>
|
|
|
|
<nav id="sidebar" class="sidebar">
|
|
|
|
<div class="sidebar-header">
|
|
<div class="sidebar-projectInfo">
|
|
|
|
<a href="readme.html" class="sidebar-projectImage">
|
|
<img src="assets/logo.png" alt="Plausible" />
|
|
</a>
|
|
|
|
<div>
|
|
<a href="readme.html" class="sidebar-projectName" translate="no">
|
|
Plausible
|
|
</a>
|
|
<div class="sidebar-projectVersion" translate="no">
|
|
v0.0.1
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<ul id="sidebar-listNav" class="sidebar-listNav" role="tablist">
|
|
<li>
|
|
<button id="extras-list-tab-button" role="tab" data-type="extras" aria-controls="extras-tab-panel" aria-selected="true" tabindex="0">
|
|
Pages
|
|
</button>
|
|
</li>
|
|
|
|
<li>
|
|
<button id="modules-list-tab-button" role="tab" data-type="modules" aria-controls="modules-tab-panel" aria-selected="false" tabindex="-1">
|
|
Modules
|
|
</button>
|
|
</li>
|
|
|
|
|
|
<li>
|
|
<button id="tasks-list-tab-button" role="tab" data-type="tasks" aria-controls="tasks-tab-panel" aria-selected="false" tabindex="-1">
|
|
<span translate="no">Mix</span> Tasks
|
|
</button>
|
|
</li>
|
|
|
|
</ul>
|
|
</div>
|
|
|
|
<div id="extras-tab-panel" class="sidebar-tabpanel" role="tabpanel" aria-labelledby="extras-list-tab-button">
|
|
<ul id="extras-full-list" class="full-list"></ul>
|
|
</div>
|
|
|
|
<div id="modules-tab-panel" class="sidebar-tabpanel" role="tabpanel" aria-labelledby="modules-list-tab-button" hidden>
|
|
<ul id="modules-full-list" class="full-list"></ul>
|
|
</div>
|
|
|
|
|
|
<div id="tasks-tab-panel" class="sidebar-tabpanel" role="tabpanel" aria-labelledby="tasks-list-tab-button" hidden>
|
|
<ul id="tasks-full-list" class="full-list"></ul>
|
|
</div>
|
|
|
|
</nav>
|
|
|
|
<main class="content">
|
|
<output role="status" id="toast"></output>
|
|
<div class="content-outer">
|
|
<div id="content" class="content-inner">
|
|
<div class="top-search">
|
|
<div class="search-settings">
|
|
<form class="search-bar" action="search.html">
|
|
<label class="search-label">
|
|
<span class="sr-only">Search documentation of Plausible</span>
|
|
<input name="q" type="text" class="search-input" placeholder="Search Documentation (press /)" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" />
|
|
</label>
|
|
<button type="submit" class="search-button" aria-label="Submit Search">
|
|
<i class="ri-search-2-line ri-lg" aria-hidden="true" title="Submit search"></i>
|
|
</button>
|
|
<button type="button" tabindex="-1" class="search-close-button" aria-hidden="true">
|
|
<i class="ri-close-line ri-lg" title="Cancel search"></i>
|
|
</button>
|
|
</form>
|
|
<div class="autocomplete">
|
|
</div>
|
|
<button class="icon-settings display-settings">
|
|
<i class="ri-settings-3-line"></i>
|
|
<span class="sr-only">Settings</span>
|
|
</button>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<h1>
|
|
|
|
<a href="https://github.com/plausible/analytics/blob/main/lib/plausible/cldr.ex#L1" title="View Source" class="icon-action" rel="help">
|
|
<i class="ri-code-s-slash-line" aria-hidden="true"></i>
|
|
<span class="sr-only">View Source</span>
|
|
</a>
|
|
|
|
<span translate="no">Plausible.Cldr.Locale</span>
|
|
<small class="app-vsn" translate="no">(Plausible v0.0.1)</small>
|
|
|
|
</h1>
|
|
|
|
|
|
<section id="moduledoc">
|
|
<p>Backend module that provides functions
|
|
to define new locales and display human-readable
|
|
locale names for presentation purposes.</p>
|
|
</section>
|
|
|
|
|
|
<section id="summary" class="details-list">
|
|
<h1 class="section-heading">
|
|
<a class="hover-link" href="#summary">
|
|
<i class="ri-link-m" aria-hidden="true"></i>
|
|
</a>
|
|
<span class="text">Summary</span>
|
|
</h1>
|
|
<div class="summary-functions summary">
|
|
<h2>
|
|
<a href="#functions">Functions</a>
|
|
</h2>
|
|
|
|
<div class="summary-row">
|
|
<div class="summary-signature">
|
|
<a href="#fallback_locale_names/1" translate="no">fallback_locale_names(locale)</a>
|
|
|
|
</div>
|
|
|
|
<div class="summary-synopsis"><p>Returns the list of fallback locale names, starting
|
|
with the provided locale name.</p></div>
|
|
|
|
</div>
|
|
|
|
<div class="summary-row">
|
|
<div class="summary-signature">
|
|
<a href="#fallback_locales/1" translate="no">fallback_locales(locale)</a>
|
|
|
|
</div>
|
|
|
|
<div class="summary-synopsis"><p>Returns the list of fallback locales, starting
|
|
with the provided locale name.</p></div>
|
|
|
|
</div>
|
|
|
|
<div class="summary-row">
|
|
<div class="summary-signature">
|
|
<a href="#locale_for_territory/1" translate="no">locale_for_territory(territory)</a>
|
|
|
|
</div>
|
|
|
|
<div class="summary-synopsis"><p>Returns the "best fit" locale for a given territory.</p></div>
|
|
|
|
</div>
|
|
|
|
<div class="summary-row">
|
|
<div class="summary-signature">
|
|
<a href="#locale_from_host/2" translate="no">locale_from_host(host, options \\ [])</a>
|
|
|
|
</div>
|
|
|
|
<div class="summary-synopsis"><p>Returns a "best fit" locale for a host name.</p></div>
|
|
|
|
</div>
|
|
|
|
<div class="summary-row">
|
|
<div class="summary-signature">
|
|
<a href="#new/1" translate="no">new(locale_name)</a>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="summary-row">
|
|
<div class="summary-signature">
|
|
<a href="#new!/1" translate="no">new!(locale_name)</a>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="summary-row">
|
|
<div class="summary-signature">
|
|
<a href="#script_direction_from_locale/1" translate="no">script_direction_from_locale(locale)</a>
|
|
|
|
</div>
|
|
|
|
<div class="summary-synopsis"><p>Returns the script direction for a locale.</p></div>
|
|
|
|
</div>
|
|
|
|
<div class="summary-row">
|
|
<div class="summary-signature">
|
|
<a href="#territory_from_host/1" translate="no">territory_from_host(host)</a>
|
|
|
|
</div>
|
|
|
|
<div class="summary-synopsis"><p>Returns the last segment of a host that might
|
|
be a territory.</p></div>
|
|
|
|
</div>
|
|
|
|
<div class="summary-row">
|
|
<div class="summary-signature">
|
|
<a href="#territory_from_locale/1" translate="no">territory_from_locale(locale)</a>
|
|
|
|
</div>
|
|
|
|
<div class="summary-synopsis"><p>Returns the territory from a language tag or
|
|
locale name.</p></div>
|
|
|
|
</div>
|
|
|
|
<div class="summary-row">
|
|
<div class="summary-signature">
|
|
<a href="#timezone_from_locale/1" translate="no">timezone_from_locale(locale)</a>
|
|
|
|
</div>
|
|
|
|
<div class="summary-synopsis"><p>Returns the time zone from a language tag or
|
|
locale name.</p></div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</section>
|
|
|
|
|
|
<section id="functions" class="details-list">
|
|
<h1 class="section-heading">
|
|
<a class="hover-link" href="#functions">
|
|
<i class="ri-link-m" aria-hidden="true"></i>
|
|
</a>
|
|
<span class="text">Functions</span>
|
|
</h1>
|
|
<div class="functions-list">
|
|
<section class="detail" id="fallback_locale_names/1">
|
|
|
|
<div class="detail-header">
|
|
<a href="#fallback_locale_names/1" class="detail-link" title="Link to this function">
|
|
<i class="ri-link-m" aria-hidden="true"></i>
|
|
<span class="sr-only">Link to this function</span>
|
|
</a>
|
|
<h1 class="signature" translate="no">fallback_locale_names(locale)</h1>
|
|
|
|
<a href="https://github.com/plausible/analytics/blob/main/lib/plausible/cldr.ex#L1" class="icon-action" rel="help" title="View Source">
|
|
<i class="ri-code-s-slash-line" aria-hidden="true"></i>
|
|
<span class="sr-only">View Source</span>
|
|
</a>
|
|
|
|
|
|
<span class="note">(since 2.26.0)</span>
|
|
|
|
</div>
|
|
|
|
<section class="docstring">
|
|
|
|
<div class="specs">
|
|
|
|
<pre translate="no"><span class="attribute">@spec</span> fallback_locale_names(<a href="https://hexdocs.pm/ex_cldr/2.37.5/Cldr.LanguageTag.html#t:t/0">Cldr.LanguageTag.t</a>() | <a href="https://hexdocs.pm/ex_cldr/2.37.5/Cldr.Locale.html#t:locale_reference/0">Cldr.Locale.locale_reference</a>()) ::
|
|
{:ok, [<a href="https://hexdocs.pm/ex_cldr/2.37.5/Cldr.Locale.html#t:locale_name/0">Cldr.Locale.locale_name</a>(), ...]} | {:error, {<a href="https://hexdocs.pm/elixir/typespecs.html#built-in-types">module</a>(), <a href="https://hexdocs.pm/elixir/String.html#t:t/0">String.t</a>()}}</pre>
|
|
|
|
</div>
|
|
|
|
<p>Returns the list of fallback locale names, starting
|
|
with the provided locale name.</p><p>Fallbacks are a list of locate names which can
|
|
be used to resolve translation or other localization
|
|
data if such localised data does not exist for
|
|
this specific locale..</p><h2 id="fallback_locale_names/1-arguments" class="section-heading">
|
|
<a href="#fallback_locale_names/1-arguments" class="hover-link">
|
|
<i class="ri-link-m" aria-hidden="true"></i>
|
|
</a>
|
|
<span class="text">Arguments</span>
|
|
</h2>
|
|
<ul><li><code class="inline">locale_name</code> is any locale name returned by
|
|
<a href="Plausible.Cldr.html#known_locale_names/0"><code class="inline">Plausible.Cldr.known_locale_names/0</code></a></li></ul><h2 id="fallback_locale_names/1-returns" class="section-heading">
|
|
<a href="#fallback_locale_names/1-returns" class="hover-link">
|
|
<i class="ri-link-m" aria-hidden="true"></i>
|
|
</a>
|
|
<span class="text">Returns</span>
|
|
</h2>
|
|
<ul><li><p><code class="inline">{:ok, list_of_locale_names}</code> or</p></li><li><p><code class="inline">{:error, {exception, reason}}</code></p></li></ul><h2 id="fallback_locale_names/1-examples" class="section-heading">
|
|
<a href="#fallback_locale_names/1-examples" class="hover-link">
|
|
<i class="ri-link-m" aria-hidden="true"></i>
|
|
</a>
|
|
<span class="text">Examples</span>
|
|
</h2>
|
|
<pre><code class="makeup elixir" translate="no"><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr.Locale</span><span class="o">.</span><span class="n">fallback_locale_names</span><span class="p" data-group-id="8164859612-1">(</span><span class="ss">:"fr-CA"</span><span class="p" data-group-id="8164859612-1">)</span><span class="w">
|
|
</span><span class="p" data-group-id="8164859612-2">{</span><span class="ss">:ok</span><span class="p">,</span><span class="w"> </span><span class="p" data-group-id="8164859612-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="8164859612-3">]</span><span class="p" data-group-id="8164859612-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="8164859612-4">(</span><span class="ss">:nb</span><span class="p" data-group-id="8164859612-4">)</span><span class="w">
|
|
</span><span class="p" data-group-id="8164859612-5">{</span><span class="ss">:ok</span><span class="p">,</span><span class="w"> </span><span class="p" data-group-id="8164859612-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="8164859612-6">]</span><span class="p" data-group-id="8164859612-5">}</span></code></pre>
|
|
</section>
|
|
</section>
|
|
<section class="detail" id="fallback_locales/1">
|
|
|
|
<div class="detail-header">
|
|
<a href="#fallback_locales/1" class="detail-link" title="Link to this function">
|
|
<i class="ri-link-m" aria-hidden="true"></i>
|
|
<span class="sr-only">Link to this function</span>
|
|
</a>
|
|
<h1 class="signature" translate="no">fallback_locales(locale)</h1>
|
|
|
|
<a href="https://github.com/plausible/analytics/blob/main/lib/plausible/cldr.ex#L1" class="icon-action" rel="help" title="View Source">
|
|
<i class="ri-code-s-slash-line" aria-hidden="true"></i>
|
|
<span class="sr-only">View Source</span>
|
|
</a>
|
|
|
|
|
|
<span class="note">(since 2.26.0)</span>
|
|
|
|
</div>
|
|
|
|
<section class="docstring">
|
|
|
|
<div class="specs">
|
|
|
|
<pre translate="no"><span class="attribute">@spec</span> fallback_locales(<a href="https://hexdocs.pm/ex_cldr/2.37.5/Cldr.LanguageTag.html#t:t/0">Cldr.LanguageTag.t</a>() | <a href="https://hexdocs.pm/ex_cldr/2.37.5/Cldr.Locale.html#t:locale_reference/0">Cldr.Locale.locale_reference</a>()) ::
|
|
{:ok, [<a href="https://hexdocs.pm/ex_cldr/2.37.5/Cldr.LanguageTag.html#t:t/0">Cldr.LanguageTag.t</a>(), ...]} | {:error, {<a href="https://hexdocs.pm/elixir/typespecs.html#built-in-types">module</a>(), <a href="https://hexdocs.pm/elixir/String.html#t:t/0">String.t</a>()}}</pre>
|
|
|
|
</div>
|
|
|
|
<p>Returns the list of fallback locales, starting
|
|
with the provided locale name.</p><p>Fallbacks are a list of locate names which can
|
|
be used to resolve translation or other localization
|
|
data if such localised data does not exist for
|
|
this specific locale.</p><h2 id="fallback_locales/1-arguments" class="section-heading">
|
|
<a href="#fallback_locales/1-arguments" class="hover-link">
|
|
<i class="ri-link-m" aria-hidden="true"></i>
|
|
</a>
|
|
<span class="text">Arguments</span>
|
|
</h2>
|
|
<ul><li><code class="inline">locale_name</code> is any locale name returned by
|
|
<a href="Plausible.Cldr.html#known_locale_names/0"><code class="inline">Plausible.Cldr.known_locale_names/0</code></a></li></ul><h2 id="fallback_locales/1-returns" class="section-heading">
|
|
<a href="#fallback_locales/1-returns" class="hover-link">
|
|
<i class="ri-link-m" aria-hidden="true"></i>
|
|
</a>
|
|
<span class="text">Returns</span>
|
|
</h2>
|
|
<ul><li><p><code class="inline">{:ok, list_of_locales}</code> or</p></li><li><p><code class="inline">{:error, {exception, reason}}</code></p></li></ul><h2 id="fallback_locales/1-examples" class="section-heading">
|
|
<a href="#fallback_locales/1-examples" class="hover-link">
|
|
<i class="ri-link-m" aria-hidden="true"></i>
|
|
</a>
|
|
<span class="text">Examples</span>
|
|
</h2>
|
|
<pre><code class="makeup elixir" translate="no"><span class="nc">Plausible.Cldr.Locale</span><span class="o">.</span><span class="n">fallback_locales</span><span class="p" data-group-id="3160381276-1">(</span><span class="ss">:"fr-CA"</span><span class="p" data-group-id="3160381276-1">)</span><span class="w">
|
|
</span><span class="p">=></span><span class="w"> </span><span class="p" data-group-id="3160381276-2">{</span><span class="ss">:ok</span><span class="p">,</span><span class="w">
|
|
</span><span class="p" data-group-id="3160381276-3">[</span><span class="p" data-group-id="3160381276-4">#</span><span class="nc" data-group-id="3160381276-4">Cldr.LanguageTag</span><span class="p" data-group-id="3160381276-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="3160381276-5">[</span><span class="n">validated</span><span class="p" data-group-id="3160381276-5">]</span><span class="p" data-group-id="3160381276-4">></span><span class="p">,</span><span class="w"> </span><span class="p" data-group-id="3160381276-6">#</span><span class="nc" data-group-id="3160381276-6">Cldr.LanguageTag</span><span class="p" data-group-id="3160381276-6"><</span><span class="n">fr</span><span class="w"> </span><span class="p" data-group-id="3160381276-7">[</span><span class="n">validated</span><span class="p" data-group-id="3160381276-7">]</span><span class="p" data-group-id="3160381276-6">></span><span class="p">,</span><span class="w">
|
|
</span><span class="p" data-group-id="3160381276-8">#</span><span class="nc" data-group-id="3160381276-8">Cldr.LanguageTag</span><span class="p" data-group-id="3160381276-8"><</span><span class="n">und</span><span class="w"> </span><span class="p" data-group-id="3160381276-9">[</span><span class="n">validated</span><span class="p" data-group-id="3160381276-9">]</span><span class="p" data-group-id="3160381276-8">></span><span class="p" data-group-id="3160381276-3">]</span><span class="p" data-group-id="3160381276-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="3160381276-10">(</span><span class="ss">:nb</span><span class="p" data-group-id="3160381276-10">)</span><span class="p">)</span><span class="w">
|
|
</span><span class="p">=></span><span class="w"> </span><span class="p" data-group-id="3160381276-11">{</span><span class="ss">:ok</span><span class="p">,</span><span class="w">
|
|
</span><span class="p" data-group-id="3160381276-12">[</span><span class="p" data-group-id="3160381276-13">#</span><span class="nc" data-group-id="3160381276-13">Cldr.LanguageTag</span><span class="p" data-group-id="3160381276-13"><</span><span class="n">nb</span><span class="w"> </span><span class="p" data-group-id="3160381276-14">[</span><span class="n">validated</span><span class="p" data-group-id="3160381276-14">]</span><span class="p" data-group-id="3160381276-13">></span><span class="p">,</span><span class="w"> </span><span class="p" data-group-id="3160381276-15">#</span><span class="nc" data-group-id="3160381276-15">Cldr.LanguageTag</span><span class="p" data-group-id="3160381276-15"><</span><span class="n">no</span><span class="w"> </span><span class="p" data-group-id="3160381276-16">[</span><span class="n">validated</span><span class="p" data-group-id="3160381276-16">]</span><span class="p" data-group-id="3160381276-15">></span><span class="p">,</span><span class="w">
|
|
</span><span class="p" data-group-id="3160381276-17">#</span><span class="nc" data-group-id="3160381276-17">Cldr.LanguageTag</span><span class="p" data-group-id="3160381276-17"><</span><span class="n">und</span><span class="w"> </span><span class="p" data-group-id="3160381276-18">[</span><span class="n">validated</span><span class="p" data-group-id="3160381276-18">]</span><span class="p" data-group-id="3160381276-17">></span><span class="p" data-group-id="3160381276-12">]</span><span class="p" data-group-id="3160381276-11">}</span></code></pre>
|
|
</section>
|
|
</section>
|
|
<section class="detail" id="locale_for_territory/1">
|
|
|
|
<div class="detail-header">
|
|
<a href="#locale_for_territory/1" class="detail-link" title="Link to this function">
|
|
<i class="ri-link-m" aria-hidden="true"></i>
|
|
<span class="sr-only">Link to this function</span>
|
|
</a>
|
|
<h1 class="signature" translate="no">locale_for_territory(territory)</h1>
|
|
|
|
<a href="https://github.com/plausible/analytics/blob/main/lib/plausible/cldr.ex#L1" class="icon-action" rel="help" title="View Source">
|
|
<i class="ri-code-s-slash-line" aria-hidden="true"></i>
|
|
<span class="sr-only">View Source</span>
|
|
</a>
|
|
|
|
|
|
<span class="note">(since 2.26.0)</span>
|
|
|
|
</div>
|
|
|
|
<section class="docstring">
|
|
|
|
<div class="specs">
|
|
|
|
<pre translate="no"><span class="attribute">@spec</span> locale_for_territory(<a href="https://hexdocs.pm/ex_cldr/2.37.5/Cldr.Locale.html#t:territory_code/0">Cldr.Locale.territory_code</a>()) ::
|
|
{:ok, <a href="https://hexdocs.pm/ex_cldr/2.37.5/Cldr.LanguageTag.html#t:t/0">Cldr.LanguageTag.t</a>()} | {:error, {<a href="https://hexdocs.pm/elixir/typespecs.html#built-in-types">module</a>(), <a href="https://hexdocs.pm/elixir/String.html#t:t/0">String.t</a>()}}</pre>
|
|
|
|
</div>
|
|
|
|
<p>Returns the "best fit" locale for a given territory.</p><p>Using the population percentage data from CLDR, the
|
|
language most commonly spoken in the given territory
|
|
is used to form a locale name which is then validated
|
|
against the given backend.</p><p>First a territory-specific locale is validated and if
|
|
that fails, the base language only is validate.</p><p>For example, if the territory is <code class="inline">AU</code> then then the
|
|
language most spoken is "en". First, the locale "en-AU"
|
|
is validated and if that fails, "en" is validated.</p><h2 id="locale_for_territory/1-arguments" class="section-heading">
|
|
<a href="#locale_for_territory/1-arguments" class="hover-link">
|
|
<i class="ri-link-m" aria-hidden="true"></i>
|
|
</a>
|
|
<span class="text">Arguments</span>
|
|
</h2>
|
|
<ul><li><code class="inline">territory</code> is any ISO 3166 Alpha-2 territory
|
|
code that can be validated by <a href="https://hexdocs.pm/ex_cldr/2.37.5/Cldr.html#validate_territory/1"><code class="inline">Cldr.validate_territory/1</code></a></li></ul><h2 id="locale_for_territory/1-returns" class="section-heading">
|
|
<a href="#locale_for_territory/1-returns" class="hover-link">
|
|
<i class="ri-link-m" aria-hidden="true"></i>
|
|
</a>
|
|
<span class="text">Returns</span>
|
|
</h2>
|
|
<ul><li><p><code class="inline">{:ok, language_tag}</code> or</p></li><li><p><code class="inline">{:error, {exception, reason}}</code></p></li></ul><h2 id="locale_for_territory/1-examples" class="section-heading">
|
|
<a href="#locale_for_territory/1-examples" class="hover-link">
|
|
<i class="ri-link-m" aria-hidden="true"></i>
|
|
</a>
|
|
<span class="text">Examples</span>
|
|
</h2>
|
|
<p> iex> Plausible.Cldr.Locale.locale_for_territory(:AU)
|
|
Elixir.Plausible.Cldr.validate_locale(:"en-AU")</p><p> iex> Plausible.Cldr.Locale.locale_for_territory(:US)
|
|
Elixir.Plausible.Cldr.validate_locale(:"en-US")</p><p> iex> Plausible.Cldr.Locale.locale_for_territory(:ZZ)
|
|
{:error, {Cldr.UnknownTerritoryError, "The territory :ZZ is unknown"}}</p>
|
|
</section>
|
|
</section>
|
|
<section class="detail" id="locale_from_host/2">
|
|
|
|
<span id="locale_from_host/1"></span>
|
|
|
|
<div class="detail-header">
|
|
<a href="#locale_from_host/2" class="detail-link" title="Link to this function">
|
|
<i class="ri-link-m" aria-hidden="true"></i>
|
|
<span class="sr-only">Link to this function</span>
|
|
</a>
|
|
<h1 class="signature" translate="no">locale_from_host(host, options \\ [])</h1>
|
|
|
|
<a href="https://github.com/plausible/analytics/blob/main/lib/plausible/cldr.ex#L1" class="icon-action" rel="help" title="View Source">
|
|
<i class="ri-code-s-slash-line" aria-hidden="true"></i>
|
|
<span class="sr-only">View Source</span>
|
|
</a>
|
|
|
|
|
|
<span class="note">(since 2.26.0)</span>
|
|
|
|
</div>
|
|
|
|
<section class="docstring">
|
|
|
|
<div class="specs">
|
|
|
|
<pre translate="no"><span class="attribute">@spec</span> locale_from_host(<a href="https://hexdocs.pm/elixir/String.html#t:t/0">String.t</a>(), <a href="https://hexdocs.pm/elixir/Keyword.html#t:t/0">Keyword.t</a>()) ::
|
|
{:ok, <a href="https://hexdocs.pm/ex_cldr/2.37.5/Cldr.LanguageTag.html#t:t/0">Cldr.LanguageTag.t</a>()} | {:error, {<a href="https://hexdocs.pm/elixir/typespecs.html#built-in-types">module</a>(), <a href="https://hexdocs.pm/elixir/String.html#t:t/0">String.t</a>()}}</pre>
|
|
|
|
</div>
|
|
|
|
<p>Returns a "best fit" locale for a host name.</p><h2 id="locale_from_host/2-arguments" class="section-heading">
|
|
<a href="#locale_from_host/2-arguments" class="hover-link">
|
|
<i class="ri-link-m" aria-hidden="true"></i>
|
|
</a>
|
|
<span class="text">Arguments</span>
|
|
</h2>
|
|
<ul><li><p><code class="inline">host</code> is any valid host name</p></li><li><p><code class="inline">options</code> is a keyword list of options. The default
|
|
is <code class="inline">[]</code>.</p></li></ul><h2 id="locale_from_host/2-options" class="section-heading">
|
|
<a href="#locale_from_host/2-options" class="hover-link">
|
|
<i class="ri-link-m" aria-hidden="true"></i>
|
|
</a>
|
|
<span class="text">Options</span>
|
|
</h2>
|
|
<ul><li><code class="inline">:tlds</code> is a list of territory codes as upper-cased
|
|
atoms that are to be considered as top-level domains.
|
|
See <a href="https://hexdocs.pm/ex_cldr/2.37.5/Cldr.Locale.html#locale_from_host/2"><code class="inline">Cldr.Locale.locale_from_host/2</code></a> for the default
|
|
list.</li></ul><h2 id="locale_from_host/2-returns" class="section-heading">
|
|
<a href="#locale_from_host/2-returns" class="hover-link">
|
|
<i class="ri-link-m" aria-hidden="true"></i>
|
|
</a>
|
|
<span class="text">Returns</span>
|
|
</h2>
|
|
<ul><li><p><code class="inline">{:ok, langauge_tag}</code> or</p></li><li><p><code class="inline">{:error, {exception, reason}}</code></p></li></ul><h2 id="locale_from_host/2-notes" class="section-heading">
|
|
<a href="#locale_from_host/2-notes" class="hover-link">
|
|
<i class="ri-link-m" aria-hidden="true"></i>
|
|
</a>
|
|
<span class="text">Notes</span>
|
|
</h2>
|
|
<p>Certain top-level domains have become associated with content
|
|
underlated to the territory for who the domain is registered.
|
|
Therefore Google (and perhaps others) do not associate these
|
|
TLDs as belonging to the territory but rather are considered
|
|
generic top-level domain names.</p><h2 id="locale_from_host/2-examples" class="section-heading">
|
|
<a href="#locale_from_host/2-examples" class="hover-link">
|
|
<i class="ri-link-m" aria-hidden="true"></i>
|
|
</a>
|
|
<span class="text">Examples</span>
|
|
</h2>
|
|
<pre><code class="makeup elixir" translate="no"><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr.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="1034557770-1">(</span><span class="ss">:"en-AU"</span><span class="p" data-group-id="1034557770-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="1034557770-2">(</span><span class="s">"a.b.com.tv"</span><span class="p" data-group-id="1034557770-2">)</span><span class="w">
|
|
</span><span class="p" data-group-id="1034557770-3">{</span><span class="ss">:error</span><span class="p">,</span><span class="w">
|
|
</span><span class="p" data-group-id="1034557770-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="1034557770-4">}</span><span class="p" data-group-id="1034557770-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="1034557770-5">(</span><span class="s">"a.b.com"</span><span class="p" data-group-id="1034557770-5">)</span><span class="w">
|
|
</span><span class="p" data-group-id="1034557770-6">{</span><span class="ss">:error</span><span class="p">,</span><span class="w">
|
|
</span><span class="p" data-group-id="1034557770-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="1034557770-7">}</span><span class="p" data-group-id="1034557770-6">}</span></code></pre>
|
|
</section>
|
|
</section>
|
|
<section class="detail" id="new/1">
|
|
|
|
<div class="detail-header">
|
|
<a href="#new/1" class="detail-link" title="Link to this function">
|
|
<i class="ri-link-m" aria-hidden="true"></i>
|
|
<span class="sr-only">Link to this function</span>
|
|
</a>
|
|
<h1 class="signature" translate="no">new(locale_name)</h1>
|
|
|
|
<a href="https://github.com/plausible/analytics/blob/main/lib/plausible/cldr.ex#L1" class="icon-action" rel="help" title="View Source">
|
|
<i class="ri-code-s-slash-line" aria-hidden="true"></i>
|
|
<span class="sr-only">View Source</span>
|
|
</a>
|
|
|
|
|
|
</div>
|
|
|
|
<section class="docstring">
|
|
|
|
|
|
</section>
|
|
</section>
|
|
<section class="detail" id="new!/1">
|
|
|
|
<div class="detail-header">
|
|
<a href="#new!/1" class="detail-link" title="Link to this function">
|
|
<i class="ri-link-m" aria-hidden="true"></i>
|
|
<span class="sr-only">Link to this function</span>
|
|
</a>
|
|
<h1 class="signature" translate="no">new!(locale_name)</h1>
|
|
|
|
<a href="https://github.com/plausible/analytics/blob/main/lib/plausible/cldr.ex#L1" class="icon-action" rel="help" title="View Source">
|
|
<i class="ri-code-s-slash-line" aria-hidden="true"></i>
|
|
<span class="sr-only">View Source</span>
|
|
</a>
|
|
|
|
|
|
</div>
|
|
|
|
<section class="docstring">
|
|
|
|
|
|
</section>
|
|
</section>
|
|
<section class="detail" id="script_direction_from_locale/1">
|
|
|
|
<div class="detail-header">
|
|
<a href="#script_direction_from_locale/1" class="detail-link" title="Link to this function">
|
|
<i class="ri-link-m" aria-hidden="true"></i>
|
|
<span class="sr-only">Link to this function</span>
|
|
</a>
|
|
<h1 class="signature" translate="no">script_direction_from_locale(locale)</h1>
|
|
|
|
<a href="https://github.com/plausible/analytics/blob/main/lib/plausible/cldr.ex#L1" class="icon-action" rel="help" title="View Source">
|
|
<i class="ri-code-s-slash-line" aria-hidden="true"></i>
|
|
<span class="sr-only">View Source</span>
|
|
</a>
|
|
|
|
|
|
<span class="note">(since 2.37.0)</span>
|
|
|
|
</div>
|
|
|
|
<section class="docstring">
|
|
|
|
<p>Returns the script direction for a locale.</p><h2 id="script_direction_from_locale/1-arguments" class="section-heading">
|
|
<a href="#script_direction_from_locale/1-arguments" class="hover-link">
|
|
<i class="ri-link-m" aria-hidden="true"></i>
|
|
</a>
|
|
<span class="text">Arguments</span>
|
|
</h2>
|
|
<ul><li><code class="inline">language_tag</code> is any language tag returned by <a href="https://hexdocs.pm/ex_cldr/2.37.5/Cldr.Locale.html#new/2"><code class="inline">Cldr.Locale.new/2</code></a>
|
|
or any <code class="inline">locale_name</code> returned by <a href="https://hexdocs.pm/ex_cldr/2.37.5/Cldr.html#known_locale_names/1"><code class="inline">Cldr.known_locale_names/1</code></a>.</li></ul><h2 id="script_direction_from_locale/1-returns" class="section-heading">
|
|
<a href="#script_direction_from_locale/1-returns" class="hover-link">
|
|
<i class="ri-link-m" aria-hidden="true"></i>
|
|
</a>
|
|
<span class="text">Returns</span>
|
|
</h2>
|
|
<ul><li>The script direction which is either <code class="inline">:ltr</code> (for left-to-right
|
|
scripts) or <code class="inline">:rtl</code> (for right-to-left scripts).</li></ul><h2 id="script_direction_from_locale/1-examples" class="section-heading">
|
|
<a href="#script_direction_from_locale/1-examples" class="hover-link">
|
|
<i class="ri-link-m" aria-hidden="true"></i>
|
|
</a>
|
|
<span class="text">Examples</span>
|
|
</h2>
|
|
<pre><code class="makeup elixir" translate="no"><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr.Locale</span><span class="o">.</span><span class="n">script_direction_from_locale</span><span class="w"> </span><span class="s">"en-US"</span><span class="w">
|
|
</span><span class="ss">:ltr</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">script_direction_from_locale</span><span class="w"> </span><span class="ss">:ar</span><span class="w">
|
|
</span><span class="ss">:rtl</span></code></pre>
|
|
</section>
|
|
</section>
|
|
<section class="detail" id="territory_from_host/1">
|
|
|
|
<div class="detail-header">
|
|
<a href="#territory_from_host/1" class="detail-link" title="Link to this function">
|
|
<i class="ri-link-m" aria-hidden="true"></i>
|
|
<span class="sr-only">Link to this function</span>
|
|
</a>
|
|
<h1 class="signature" translate="no">territory_from_host(host)</h1>
|
|
|
|
<a href="https://github.com/plausible/analytics/blob/main/lib/plausible/cldr.ex#L1" class="icon-action" rel="help" title="View Source">
|
|
<i class="ri-code-s-slash-line" aria-hidden="true"></i>
|
|
<span class="sr-only">View Source</span>
|
|
</a>
|
|
|
|
|
|
<span class="note">(since 2.26.0)</span>
|
|
|
|
</div>
|
|
|
|
<section class="docstring">
|
|
|
|
<div class="specs">
|
|
|
|
<pre translate="no"><span class="attribute">@spec</span> territory_from_host(<a href="https://hexdocs.pm/elixir/String.html#t:t/0">String.t</a>()) ::
|
|
{:ok, <a href="https://hexdocs.pm/ex_cldr/2.37.5/Cldr.Locale.html#t:territory_code/0">Cldr.Locale.territory_code</a>()} | {:error, {<a href="https://hexdocs.pm/elixir/typespecs.html#built-in-types">module</a>(), <a href="https://hexdocs.pm/elixir/String.html#t:t/0">String.t</a>()}}</pre>
|
|
|
|
</div>
|
|
|
|
<p>Returns the last segment of a host that might
|
|
be a territory.</p><h2 id="territory_from_host/1-arguments" class="section-heading">
|
|
<a href="#territory_from_host/1-arguments" class="hover-link">
|
|
<i class="ri-link-m" aria-hidden="true"></i>
|
|
</a>
|
|
<span class="text">Arguments</span>
|
|
</h2>
|
|
<ul><li><code class="inline">host</code> is any valid host name</li></ul><h2 id="territory_from_host/1-returns" class="section-heading">
|
|
<a href="#territory_from_host/1-returns" class="hover-link">
|
|
<i class="ri-link-m" aria-hidden="true"></i>
|
|
</a>
|
|
<span class="text">Returns</span>
|
|
</h2>
|
|
<ul><li><p><code class="inline">{:ok, territory}</code> or</p></li><li><p><code class="inline">{:error, {exception, reason}}</code></p></li></ul><h2 id="territory_from_host/1-examples" class="section-heading">
|
|
<a href="#territory_from_host/1-examples" class="hover-link">
|
|
<i class="ri-link-m" aria-hidden="true"></i>
|
|
</a>
|
|
<span class="text">Examples</span>
|
|
</h2>
|
|
<pre><code class="makeup elixir" translate="no"><span class="gp unselectable">iex> </span><span class="nc">Cldr.Locale</span><span class="o">.</span><span class="n">territory_from_host</span><span class="p" data-group-id="6918842638-1">(</span><span class="s">"a.b.com.au"</span><span class="p" data-group-id="6918842638-1">)</span><span class="w">
|
|
</span><span class="p" data-group-id="6918842638-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="6918842638-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="6918842638-3">(</span><span class="s">"a.b.com"</span><span class="p" data-group-id="6918842638-3">)</span><span class="w">
|
|
</span><span class="p" data-group-id="6918842638-4">{</span><span class="ss">:error</span><span class="p">,</span><span class="w">
|
|
</span><span class="p" data-group-id="6918842638-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="6918842638-5">}</span><span class="p" data-group-id="6918842638-4">}</span></code></pre>
|
|
</section>
|
|
</section>
|
|
<section class="detail" id="territory_from_locale/1">
|
|
|
|
<div class="detail-header">
|
|
<a href="#territory_from_locale/1" class="detail-link" title="Link to this function">
|
|
<i class="ri-link-m" aria-hidden="true"></i>
|
|
<span class="sr-only">Link to this function</span>
|
|
</a>
|
|
<h1 class="signature" translate="no">territory_from_locale(locale)</h1>
|
|
|
|
<a href="https://github.com/plausible/analytics/blob/main/lib/plausible/cldr.ex#L1" class="icon-action" rel="help" title="View Source">
|
|
<i class="ri-code-s-slash-line" aria-hidden="true"></i>
|
|
<span class="sr-only">View Source</span>
|
|
</a>
|
|
|
|
|
|
<span class="note">(since 2.18.2)</span>
|
|
|
|
</div>
|
|
|
|
<section class="docstring">
|
|
|
|
<div class="specs">
|
|
|
|
<pre translate="no"><span class="attribute">@spec</span> territory_from_locale(<a href="https://hexdocs.pm/ex_cldr/2.37.5/Cldr.LanguageTag.html#t:t/0">Cldr.LanguageTag.t</a>() | <a href="https://hexdocs.pm/ex_cldr/2.37.5/Cldr.Locale.html#t:locale_name/0">Cldr.Locale.locale_name</a>()) ::
|
|
<a href="https://hexdocs.pm/ex_cldr/2.37.5/Cldr.Locale.html#t:territory_code/0">Cldr.Locale.territory_code</a>()</pre>
|
|
|
|
</div>
|
|
|
|
<p>Returns the territory from a language tag or
|
|
locale name.</p><h2 id="territory_from_locale/1-arguments" class="section-heading">
|
|
<a href="#territory_from_locale/1-arguments" class="hover-link">
|
|
<i class="ri-link-m" aria-hidden="true"></i>
|
|
</a>
|
|
<span class="text">Arguments</span>
|
|
</h2>
|
|
<ul><li><code class="inline">locale</code> is any language tag returned by
|
|
<a href="#new/1"><code class="inline">Plausible.Cldr.Locale.new/1</code></a>
|
|
or a locale name in the list returned by
|
|
<a href="Plausible.Cldr.html#known_locale_names/0"><code class="inline">Plausible.Cldr.known_locale_names/0</code></a></li></ul><h2 id="territory_from_locale/1-returns" class="section-heading">
|
|
<a href="#territory_from_locale/1-returns" class="hover-link">
|
|
<i class="ri-link-m" aria-hidden="true"></i>
|
|
</a>
|
|
<span class="text">Returns</span>
|
|
</h2>
|
|
<ul><li>A territory code as an atom</li></ul><h2 id="territory_from_locale/1-examples" class="section-heading">
|
|
<a href="#territory_from_locale/1-examples" class="hover-link">
|
|
<i class="ri-link-m" aria-hidden="true"></i>
|
|
</a>
|
|
<span class="text">Examples</span>
|
|
</h2>
|
|
<pre><code class="makeup elixir" translate="no"><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr.Locale</span><span class="o">.</span><span class="n">territory_from_locale</span><span class="w"> </span><span class="s">"en-US"</span><span class="w">
|
|
</span><span class="ss">:US</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">territory_from_locale</span><span class="w"> </span><span class="s">"en-US-u-rg-GBzzzz"</span><span class="w">
|
|
</span><span class="ss">:GB</span></code></pre>
|
|
</section>
|
|
</section>
|
|
<section class="detail" id="timezone_from_locale/1">
|
|
|
|
<div class="detail-header">
|
|
<a href="#timezone_from_locale/1" class="detail-link" title="Link to this function">
|
|
<i class="ri-link-m" aria-hidden="true"></i>
|
|
<span class="sr-only">Link to this function</span>
|
|
</a>
|
|
<h1 class="signature" translate="no">timezone_from_locale(locale)</h1>
|
|
|
|
<a href="https://github.com/plausible/analytics/blob/main/lib/plausible/cldr.ex#L1" class="icon-action" rel="help" title="View Source">
|
|
<i class="ri-code-s-slash-line" aria-hidden="true"></i>
|
|
<span class="sr-only">View Source</span>
|
|
</a>
|
|
|
|
|
|
<span class="note">(since 2.19.0)</span>
|
|
|
|
</div>
|
|
|
|
<section class="docstring">
|
|
|
|
<div class="specs">
|
|
|
|
<pre translate="no"><span class="attribute">@spec</span> timezone_from_locale(<a href="https://hexdocs.pm/ex_cldr/2.37.5/Cldr.LanguageTag.html#t:t/0">Cldr.LanguageTag.t</a>() | <a href="https://hexdocs.pm/ex_cldr/2.37.5/Cldr.Locale.html#t:locale_name/0">Cldr.Locale.locale_name</a>()) ::
|
|
<a href="https://hexdocs.pm/elixir/String.html#t:t/0">String.t</a>() | {:error, {<a href="https://hexdocs.pm/elixir/typespecs.html#built-in-types">module</a>(), <a href="https://hexdocs.pm/elixir/String.html#t:t/0">String.t</a>()}}</pre>
|
|
|
|
</div>
|
|
|
|
<p>Returns the time zone from a language tag or
|
|
locale name.</p><h2 id="timezone_from_locale/1-arguments" class="section-heading">
|
|
<a href="#timezone_from_locale/1-arguments" class="hover-link">
|
|
<i class="ri-link-m" aria-hidden="true"></i>
|
|
</a>
|
|
<span class="text">Arguments</span>
|
|
</h2>
|
|
<ul><li><code class="inline">locale</code> is any language tag returned by
|
|
<a href="#new/1"><code class="inline">Plausible.Cldr.Locale.new/1</code></a>
|
|
or a locale name in the list returned by
|
|
<a href="Plausible.Cldr.html#known_locale_names/0"><code class="inline">Plausible.Cldr.known_locale_names/0</code></a></li></ul><h2 id="timezone_from_locale/1-returns" class="section-heading">
|
|
<a href="#timezone_from_locale/1-returns" class="hover-link">
|
|
<i class="ri-link-m" aria-hidden="true"></i>
|
|
</a>
|
|
<span class="text">Returns</span>
|
|
</h2>
|
|
<ul><li><p>A time zone ID as a string or</p></li><li><p><code class="inline">:error</code> if no time zone can be determined</p></li></ul><h2 id="timezone_from_locale/1-examples" class="section-heading">
|
|
<a href="#timezone_from_locale/1-examples" class="hover-link">
|
|
<i class="ri-link-m" aria-hidden="true"></i>
|
|
</a>
|
|
<span class="text">Examples</span>
|
|
</h2>
|
|
<pre><code class="makeup elixir" translate="no"><span class="gp unselectable">iex> </span><span class="nc">Plausible.Cldr.Locale</span><span class="o">.</span><span class="n">timezone_from_locale</span><span class="w"> </span><span class="s">"en-US-u-tz-ausyd"</span><span class="w">
|
|
</span><span class="s">"Australia/Sydney"</span></code></pre>
|
|
</section>
|
|
</section>
|
|
|
|
</div>
|
|
</section>
|
|
|
|
<footer class="footer">
|
|
<p>
|
|
|
|
<span class="line">
|
|
<button class="a-main footer-button display-quick-switch" title="Search HexDocs packages">
|
|
Search HexDocs
|
|
</button>
|
|
|
|
<a href="Plausible.epub" title="ePub version">
|
|
Download ePub version
|
|
</a>
|
|
|
|
</span>
|
|
</p>
|
|
|
|
<p class="built-using">
|
|
Built using
|
|
<a href="https://github.com/elixir-lang/ex_doc" title="ExDoc" target="_blank" rel="help noopener" translate="no">ExDoc</a> (v0.31.1) for the
|
|
|
|
<a href="https://elixir-lang.org" title="Elixir" target="_blank" translate="no">Elixir programming language</a>
|
|
|
|
</p>
|
|
</footer>
|
|
</div>
|
|
</div>
|
|
</main>
|
|
</div>
|
|
|
|
<script src="https://cdn.jsdelivr.net/npm/mermaid/dist/mermaid.min.js"></script>
|
|
<script>mermaid.initialize({startOnLoad: true})</script>
|
|
|
|
</body>
|
|
</html>
|