2023-07-12 11:28:07 +03:00
<!DOCTYPE html>
< html lang = "en" >
< head >
< meta charset = "utf-8" >
< meta http-equiv = "x-ua-compatible" content = "ie=edge" >
< meta name = "viewport" content = "width=device-width, initial-scale=1.0" >
2024-01-16 10:41:49 +03:00
< meta name = "generator" content = "ExDoc v0.31.1" >
2023-07-12 11:28:07 +03:00
< meta name = "project" content = "Plausible v0.0.1" >
2024-01-11 10:50:44 +03:00
2023-07-12 11:28:07 +03:00
< title > Plausible.Cldr — Plausible v0.0.1< / title >
2024-01-16 10:41:49 +03:00
< link rel = "stylesheet" href = "dist/html-elixir-FM2CSD74.css" / >
2023-07-12 11:28:07 +03:00
< script src = "dist/handlebars.runtime-NWIB6V2M.js" > < / script >
2024-01-11 10:50:44 +03:00
< script src = "dist/handlebars.templates-43PMFBC7.js" > < / script >
2024-02-01 10:15:38 +03:00
< script src = "dist/sidebar_items-C0AEE8E5.js" > < / script >
2023-07-12 11:28:07 +03:00
< script src = "docs_config.js" > < / script >
2024-01-16 10:41:49 +03:00
< script async src = "dist/html-L4O5OK2K.js" > < / script >
2023-07-12 11:28:07 +03:00
< / head >
< body data-type = "modules" class = "page-module" >
< script >
try {
var settings = JSON.parse(localStorage.getItem('ex_doc:settings') || '{}');
if (settings.theme === 'dark' ||
((settings.theme === 'system' || settings.theme == null) & &
window.matchMedia('(prefers-color-scheme: dark)').matches)
) {
document.body.classList.add('dark')
}
} catch (error) { }
< / script >
< div class = "main" >
2024-01-16 10:41:49 +03:00
< button id = "sidebar-menu" class = "sidebar-button sidebar-toggle" aria-label = "toggle sidebar" aria-controls = "sidebar" >
2023-07-12 11:28:07 +03:00
< i class = "ri-menu-line ri-lg" title = "Collapse/expand sidebar" > < / i >
< / button >
2024-01-16 10:41:49 +03:00
< div class = "background-layer" > < / div >
2024-01-11 10:50:44 +03:00
< nav id = "sidebar" class = "sidebar" >
2023-07-12 11:28:07 +03:00
< div class = "sidebar-header" >
2024-01-11 10:50:44 +03:00
< div class = "sidebar-projectInfo" >
2023-07-12 11:28:07 +03:00
2024-01-11 10:50:44 +03:00
< a href = "readme.html" class = "sidebar-projectImage" >
< img src = "assets/logo.png" alt = "Plausible" / >
< / a >
2023-07-12 11:28:07 +03:00
2024-01-11 10:50:44 +03:00
< div >
< a href = "readme.html" class = "sidebar-projectName" translate = "no" >
2023-07-12 11:28:07 +03:00
Plausible
2024-01-11 10:50:44 +03:00
< / a >
< div class = "sidebar-projectVersion" translate = "no" >
v0.0.1
< / div >
2023-07-12 11:28:07 +03:00
< / div >
< / div >
2024-01-11 10:50:44 +03:00
< ul id = "sidebar-listNav" class = "sidebar-listNav" role = "tablist" >
< li >
< button id = "extras-list-tab-button" role = "tab" data-type = "extras" aria-controls = "extras-tab-panel" aria-selected = "true" tabindex = "0" >
Pages
< / button >
< / li >
< li >
< button id = "modules-list-tab-button" role = "tab" data-type = "modules" aria-controls = "modules-tab-panel" aria-selected = "false" tabindex = "-1" >
Modules
< / button >
< / li >
< li >
< button id = "tasks-list-tab-button" role = "tab" data-type = "tasks" aria-controls = "tasks-tab-panel" aria-selected = "false" tabindex = "-1" >
< span translate = "no" > Mix< / span > Tasks
< / button >
< / li >
2023-07-12 11:28:07 +03:00
2024-01-11 10:50:44 +03:00
< / ul >
< / div >
2023-07-12 11:28:07 +03:00
2024-01-11 10:50:44 +03:00
< div id = "extras-tab-panel" class = "sidebar-tabpanel" role = "tabpanel" aria-labelledby = "extras-list-tab-button" >
< ul id = "extras-full-list" class = "full-list" > < / ul >
< / div >
2023-07-12 11:28:07 +03:00
2024-01-11 10:50:44 +03:00
< div id = "modules-tab-panel" class = "sidebar-tabpanel" role = "tabpanel" aria-labelledby = "modules-list-tab-button" hidden >
< ul id = "modules-full-list" class = "full-list" > < / ul >
< / div >
2023-07-12 11:28:07 +03:00
2024-01-11 10:50:44 +03:00
< div id = "tasks-tab-panel" class = "sidebar-tabpanel" role = "tabpanel" aria-labelledby = "tasks-list-tab-button" hidden >
< ul id = "tasks-full-list" class = "full-list" > < / ul >
< / div >
2023-07-12 11:28:07 +03:00
2024-01-11 10:50:44 +03:00
< / nav >
< main class = "content" >
2023-07-12 11:28:07 +03:00
< output role = "status" id = "toast" > < / output >
< div class = "content-outer" >
< div id = "content" class = "content-inner" >
2024-01-11 10:50:44 +03:00
< div class = "top-search" >
< div class = "search-settings" >
< form class = "search-bar" action = "search.html" >
< label class = "search-label" >
< span class = "sr-only" > Search documentation of Plausible< / span >
< input name = "q" type = "text" class = "search-input" placeholder = "Search Documentation (press /)" autocomplete = "off" autocorrect = "off" autocapitalize = "off" spellcheck = "false" / >
< / label >
< button type = "submit" class = "search-button" aria-label = "Submit Search" >
< i class = "ri-search-2-line ri-lg" aria-hidden = "true" title = "Submit search" > < / i >
< / button >
< button type = "button" tabindex = "-1" class = "search-close-button" aria-hidden = "true" >
< i class = "ri-close-line ri-lg" title = "Cancel search" > < / i >
< / button >
< / form >
2024-01-16 10:41:49 +03:00
< div class = "autocomplete" >
< / div >
2024-01-11 10:50:44 +03:00
< button class = "icon-settings display-settings" >
< i class = "ri-settings-3-line" > < / i >
< span class = "sr-only" > Settings< / span >
< / button >
< / div >
2024-01-16 10:41:49 +03:00
2024-01-11 10:50:44 +03:00
< / div >
2023-07-12 11:28:07 +03:00
< h1 >
< a href = "https://github.com/plausible/analytics/blob/main/lib/plausible/cldr.ex#L1" title = "View Source" class = "icon-action" rel = "help" >
< i class = "ri-code-s-slash-line" aria-hidden = "true" > < / i >
< span class = "sr-only" > View Source< / span >
< / a >
< span translate = "no" > Plausible.Cldr< / span >
< small class = "app-vsn" translate = "no" > (Plausible v0.0.1)< / small >
< / h1 >
< section id = "moduledoc" >
< p > Provides the core functions to retrieve and manage
the CLDR data that supports formatting and localisation.< / p > < p > It provides the core functions to access formatted
CLDR data, set and retrieve a current locale and validate
certain core data types such as locales, currencies and
territories.< / 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 >
2024-01-11 10:50:44 +03:00
< span class = "text" > Summary< / span >
2023-07-12 11:28:07 +03:00
< / h1 >
< div class = "summary-functions summary" >
< h2 >
< a href = "#functions" > Functions< / a >
< / h2 >
< div class = "summary-row" >
< div class = "summary-signature" >
< a href = "#available_locale_name?/1" translate = "no" > available_locale_name?(locale_name)< / a >
< / div >
2024-01-11 10:50:44 +03:00
< div class = "summary-synopsis" > < p > See < a href = "https://hexdocs.pm/ex_cldr/2.37.5/Cldr.html#available_locale_name?/1" > < code class = "inline" > Cldr.available_locale_name?/1< / code > < / a > .< / p > < / div >
2023-07-12 11:28:07 +03:00
< / div >
< div class = "summary-row" >
< div class = "summary-signature" >
< a href = "#default_locale/0" translate = "no" > default_locale()< / a >
< / div >
< div class = "summary-synopsis" > < p > Returns the default < code class = "inline" > locale< / code > .< / p > < / div >
< / div >
< div class = "summary-row" >
< div class = "summary-signature" >
< a href = "#default_territory/0" translate = "no" > default_territory()< / a >
< / div >
< div class = "summary-synopsis" > < p > Returns the default territory when a locale
does not specify one and none can be inferred.< / p > < / div >
< / div >
< div class = "summary-row" >
< div class = "summary-signature" >
< a href = "#ellipsis/2" translate = "no" > ellipsis(string, options \\ [])< / a >
< / div >
< div class = "summary-synopsis" > < p > Add locale-specific ellipsis to a string.< / p > < / div >
< / div >
< div class = "summary-row" >
< div class = "summary-signature" >
< a href = "#get_locale/0" translate = "no" > get_locale()< / a >
< / div >
2024-01-11 10:50:44 +03:00
< div class = "summary-synopsis" > < p > Return the current locale to be used for < a href = "https://hexdocs.pm/ex_cldr/2.37.5/Cldr.html" > < code class = "inline" > Cldr< / code > < / a > functions that
2023-07-12 11:28:07 +03:00
take an optional locale parameter for which a locale is not supplied.< / p > < / div >
< / div >
< div class = "summary-row" >
< div class = "summary-signature" >
< a href = "#known_calendars/0" translate = "no" > known_calendars()< / a >
< / div >
2024-01-11 10:50:44 +03:00
< div class = "summary-synopsis" > < p > See < a href = "https://hexdocs.pm/ex_cldr/2.37.5/Cldr.html#known_calendars/0" > < code class = "inline" > Cldr.known_calendars/0< / code > < / a > .< / p > < / div >
2023-07-12 11:28:07 +03:00
< / div >
< div class = "summary-row" >
< div class = "summary-signature" >
< a href = "#known_currencies/0" translate = "no" > known_currencies()< / a >
< / div >
2024-01-11 10:50:44 +03:00
< div class = "summary-synopsis" > < p > See < a href = "https://hexdocs.pm/ex_cldr/2.37.5/Cldr.html#known_currencies/0" > < code class = "inline" > Cldr.known_currencies/0< / code > < / a > .< / p > < / div >
2023-07-12 11:28:07 +03:00
< / div >
< div class = "summary-row" >
< div class = "summary-signature" >
< a href = "#known_gettext_locale_name/1" translate = "no" > known_gettext_locale_name(locale_name)< / a >
< / div >
< div class = "summary-synopsis" > < p > Returns either the Gettext < code class = "inline" > locale_name< / code > in Cldr format or
< code class = "inline" > false< / code > based upon whether the locale name is configured in
2024-01-11 10:50:44 +03:00
< a href = "https://hexdocs.pm/gettext/0.24.0/Gettext.html" > < code class = "inline" > Gettext< / code > < / a > .< / p > < / div >
2023-07-12 11:28:07 +03:00
< / div >
< div class = "summary-row" >
< div class = "summary-signature" >
< a href = "#known_gettext_locale_name?/1" translate = "no" > known_gettext_locale_name?(locale_name)< / a >
< / div >
< div class = "summary-synopsis" > < p > Returns a boolean indicating if the specified locale
name is configured and available in Gettext.< / p > < / div >
< / div >
< div class = "summary-row" >
< div class = "summary-signature" >
< a href = "#known_gettext_locale_names/0" translate = "no" > known_gettext_locale_names()< / a >
< / div >
< div class = "summary-synopsis" > < p > Returns a list of Gettext locale names but in CLDR format with
underscore replaced by hyphen in order to facilitate comparisons
2024-01-11 10:50:44 +03:00
with < a href = "https://hexdocs.pm/ex_cldr/2.37.5/Cldr.html" > < code class = "inline" > Cldr< / code > < / a > locale names.< / p > < / div >
2023-07-12 11:28:07 +03:00
< / div >
< div class = "summary-row" >
< div class = "summary-signature" >
< a href = "#known_locale_name/1" translate = "no" > known_locale_name(locale_name)< / a >
< / div >
< div class = "summary-synopsis" > < p > Returns either the < code class = "inline" > locale_name< / code > or < code class = "inline" > false< / code > based upon
2024-01-11 10:50:44 +03:00
whether the locale name is configured in < a href = "https://hexdocs.pm/ex_cldr/2.37.5/Cldr.html" > < code class = "inline" > Cldr< / code > < / a > .< / p > < / div >
2023-07-12 11:28:07 +03:00
< / div >
< div class = "summary-row" >
< div class = "summary-signature" >
< a href = "#known_locale_name?/1" translate = "no" > known_locale_name?(locale_name)< / a >
< / div >
< div class = "summary-synopsis" > < p > Returns a boolean indicating if the specified locale
name is configured and available in Cldr.< / p > < / div >
< / div >
< div class = "summary-row" >
< div class = "summary-signature" >
< a href = "#known_locale_names/0" translate = "no" > known_locale_names()< / a >
< / div >
< div class = "summary-synopsis" > < p > Returns a list of the known locale names.< / p > < / div >
< / div >
< div class = "summary-row" >
< div class = "summary-signature" >
< a href = "#known_number_system_types/0" translate = "no" > known_number_system_types()< / a >
< / div >
2024-01-11 10:50:44 +03:00
< div class = "summary-synopsis" > < p > Returns a list of atoms representing the number systems types known to < a href = "https://hexdocs.pm/ex_cldr/2.37.5/Cldr.html" > < code class = "inline" > Cldr< / code > < / a > .< / p > < / div >
2023-07-12 11:28:07 +03:00
< / div >
< div class = "summary-row" >
< div class = "summary-signature" >
< a href = "#known_number_systems/0" translate = "no" > known_number_systems()< / a >
< / div >
2024-01-11 10:50:44 +03:00
< div class = "summary-synopsis" > < p > See < a href = "https://hexdocs.pm/ex_cldr/2.37.5/Cldr.html#known_number_systems/0" > < code class = "inline" > Cldr.known_number_systems/0< / code > < / a > .< / p > < / div >
2023-07-12 11:28:07 +03:00
< / div >
< div class = "summary-row" >
< div class = "summary-signature" >
< a href = "#known_rbnf_locale_name/1" translate = "no" > known_rbnf_locale_name(locale_name)< / a >
< / div >
< div class = "summary-synopsis" > < p > Returns either the RBNF < code class = "inline" > locale_name< / code > or < code class = "inline" > false< / code > based upon
2024-01-11 10:50:44 +03:00
whether the locale name is configured in < a href = "https://hexdocs.pm/ex_cldr/2.37.5/Cldr.html" > < code class = "inline" > Cldr< / code > < / a >
2023-07-12 11:28:07 +03:00
and has RBNF rules defined.< / p > < / div >
< / div >
< div class = "summary-row" >
< div class = "summary-signature" >
< a href = "#known_rbnf_locale_name?/1" translate = "no" > known_rbnf_locale_name?(locale_name)< / a >
< / div >
< div class = "summary-synopsis" > < p > Returns a boolean indicating if the specified locale
name is configured and available in Cldr and supports
rules based number formats (RBNF).< / p > < / div >
< / div >
< div class = "summary-row" >
< div class = "summary-signature" >
< a href = "#known_rbnf_locale_names/0" translate = "no" > known_rbnf_locale_names()< / a >
< / div >
< div class = "summary-synopsis" > < p > Returns a list of locale names which have rules-based number
formats (RBNF).< / p > < / div >
< / div >
< div class = "summary-row" >
< div class = "summary-signature" >
< a href = "#known_territories/0" translate = "no" > known_territories()< / a >
< / div >
2024-01-11 10:50:44 +03:00
< div class = "summary-synopsis" > < p > See < a href = "https://hexdocs.pm/ex_cldr/2.37.5/Cldr.html#known_territories/0" > < code class = "inline" > Cldr.known_territories/0< / code > < / a > .< / p > < / div >
2023-07-12 11:28:07 +03:00
< / div >
< div class = "summary-row" >
< div class = "summary-signature" >
< a href = "#normalize_lenient_parse/3" translate = "no" > normalize_lenient_parse(string, scope, locale \\ get_locale())< / a >
< / div >
< div class = "summary-synopsis" > < p > Normalizes a string by applying transliteration
of common symbols in numbers, currencies and dates< / p > < / div >
< / div >
2024-01-11 10:50:44 +03:00
< div class = "summary-row" >
< div class = "summary-signature" >
< a href = "#put_gettext_locale/1" translate = "no" > put_gettext_locale(locale)< / a >
< / div >
< div class = "summary-synopsis" > < p > Set the current process's Gettext locale from a
< code class = "inline" > t:Cldr.LanguageTag< / code > .< / p > < / div >
< / div >
2023-07-12 11:28:07 +03:00
< div class = "summary-row" >
< div class = "summary-signature" >
< a href = "#put_locale/1" translate = "no" > put_locale(locale_name)< / a >
< / div >
2024-01-11 10:50:44 +03:00
< div class = "summary-synopsis" > < p > Set the current locale to be used for < a href = "https://hexdocs.pm/ex_cldr/2.37.5/Cldr.html" > < code class = "inline" > Cldr< / code > < / a > functions that
2023-07-12 11:28:07 +03:00
take an optional locale parameter for which a locale is not supplied.< / p > < / div >
< / div >
< div class = "summary-row" >
< div class = "summary-signature" >
< a href = "#quote/2" translate = "no" > quote(string, options \\ [])< / a >
< / div >
< div class = "summary-synopsis" > < p > Add locale-specific quotation marks around a string.< / p > < / div >
< / div >
< div class = "summary-row" >
< div class = "summary-signature" >
< a href = "#unknown_locale_names/0" translate = "no" > unknown_locale_names()< / a >
< / div >
< div class = "summary-synopsis" > < p > Returns a list of the locales names that are configured,
but not known in CLDR.< / p > < / div >
< / div >
< div class = "summary-row" >
< div class = "summary-signature" >
< a href = "#validate_calendar/1" translate = "no" > validate_calendar(calendar)< / a >
< / div >
2024-01-11 10:50:44 +03:00
< div class = "summary-synopsis" > < p > See < a href = "https://hexdocs.pm/ex_cldr/2.37.5/Cldr.html#validate_calendar/1" > < code class = "inline" > Cldr.validate_calendar/1< / code > < / a > .< / p > < / div >
2023-07-12 11:28:07 +03:00
< / div >
< div class = "summary-row" >
< div class = "summary-signature" >
< a href = "#validate_currency/1" translate = "no" > validate_currency(currency)< / a >
< / div >
2024-01-11 10:50:44 +03:00
< div class = "summary-synopsis" > < p > See < a href = "https://hexdocs.pm/ex_cldr/2.37.5/Cldr.html#validate_currency/1" > < code class = "inline" > Cldr.validate_currency/1< / code > < / a > .< / p > < / div >
2023-07-12 11:28:07 +03:00
< / div >
< div class = "summary-row" >
< div class = "summary-signature" >
< a href = "#validate_locale/1" translate = "no" > validate_locale(locale)< / a >
< / div >
< div class = "summary-synopsis" > < p > Normalise and validate a locale name.< / p > < / div >
< / div >
< div class = "summary-row" >
< div class = "summary-signature" >
< a href = "#validate_number_system/1" translate = "no" > validate_number_system(number_system)< / a >
< / div >
2024-01-11 10:50:44 +03:00
< div class = "summary-synopsis" > < p > See < a href = "https://hexdocs.pm/ex_cldr/2.37.5/Cldr.html#validate_number_system/1" > < code class = "inline" > Cldr.validate_number_system/1< / code > < / a > .< / p > < / div >
2023-07-12 11:28:07 +03:00
< / div >
< div class = "summary-row" >
< div class = "summary-signature" >
< a href = "#validate_number_system_type/1" translate = "no" > validate_number_system_type(number_system_type)< / a >
< / div >
< div class = "summary-synopsis" > < p > Normalise and validate a number system type.< / p > < / div >
< / div >
< div class = "summary-row" >
< div class = "summary-signature" >
< a href = "#validate_territory/1" translate = "no" > validate_territory(territory)< / a >
< / div >
2024-01-11 10:50:44 +03:00
< div class = "summary-synopsis" > < p > See < a href = "https://hexdocs.pm/ex_cldr/2.37.5/Cldr.html#validate_territory/1" > < code class = "inline" > Cldr.validate_territory/1< / code > < / a > .< / p > < / div >
2023-07-12 11:28:07 +03:00
< / div >
< div class = "summary-row" >
< div class = "summary-signature" >
< a href = "#with_locale/2" translate = "no" > with_locale(locale, fun)< / a >
< / div >
< div class = "summary-synopsis" > < p > Execute a function with a locale ensuring that the
current locale is restored after the function.< / p > < / div >
< / div >
< / div >
< / section >
< section id = "functions" class = "details-list" >
< h1 class = "section-heading" >
< a class = "hover-link" href = "#functions" >
< i class = "ri-link-m" aria-hidden = "true" > < / i >
2023-07-25 10:58:48 +03:00
< / a >
2024-01-11 10:50:44 +03:00
< span class = "text" > Functions< / span >
2023-07-12 11:28:07 +03:00
< / h1 >
< div class = "functions-list" >
< section class = "detail" id = "available_locale_name?/1" >
< div class = "detail-header" >
< a href = "#available_locale_name?/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" > available_locale_name?(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" >
2024-01-11 10:50:44 +03:00
< p > See < a href = "https://hexdocs.pm/ex_cldr/2.37.5/Cldr.html#available_locale_name?/1" > < code class = "inline" > Cldr.available_locale_name?/1< / code > < / a > .< / p >
2023-07-12 11:28:07 +03:00
< / section >
< / section >
< section class = "detail" id = "default_locale/0" >
< div class = "detail-header" >
< a href = "#default_locale/0" class = "detail-link" title = "Link to this function" >
< i class = "ri-link-m" aria-hidden = "true" > < / i >
< span class = "sr-only" > Link to this function< / span >
< / a >
< h1 class = "signature" translate = "no" > default_locale()< / h1 >
< a href = "https://github.com/plausible/analytics/blob/main/lib/plausible/cldr.ex#L1" class = "icon-action" rel = "help" title = "View Source" >
< i class = "ri-code-s-slash-line" aria-hidden = "true" > < / i >
< span class = "sr-only" > View Source< / span >
< / a >
< / div >
< section class = "docstring" >
< div class = "specs" >
2024-01-11 10:50:44 +03:00
< pre translate = "no" > < span class = "attribute" > @spec< / span > default_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/elixir/typespecs.html#built-in-types" > no_return< / a > ()< / pre >
2023-07-12 11:28:07 +03:00
< / div >
< p > Returns the default < code class = "inline" > locale< / code > .< / p > < h2 id = "default_locale/0-example" class = "section-heading" >
2024-01-11 10:50:44 +03:00
< a href = "#default_locale/0-example" class = "hover-link" >
2023-07-25 10:58:48 +03:00
< i class = "ri-link-m" aria-hidden = "true" > < / i >
2023-07-12 11:28:07 +03:00
< / a >
2024-01-11 10:50:44 +03:00
< span class = "text" > Example< / span >
2023-07-12 11:28:07 +03:00
< / h2 >
2024-02-01 10:15:38 +03:00
< 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 = "9617298703-1" > (< / span > < span class = "p" data-group-id = "9617298703-1" > )< / span > < span class = "w" >
< / span > < span class = "p" data-group-id = "9617298703-2" > %< / span > < span class = "nc" data-group-id = "9617298703-2" > Cldr.LanguageTag< / span > < span class = "p" data-group-id = "9617298703-2" > {< / span > < span class = "w" >
2023-07-12 11:28:07 +03:00
< / 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" >
2024-02-01 10:15:38 +03:00
< / span > < span class = "ss" > language_subtags< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "p" data-group-id = "9617298703-3" > [< / span > < span class = "p" data-group-id = "9617298703-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 = "9617298703-4" > %{< / span > < span class = "p" data-group-id = "9617298703-4" > }< / span > < span class = "p" > ,< / span > < span class = "w" >
2023-07-12 11:28:07 +03:00
< / 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" >
2024-02-01 10:15:38 +03:00
< / span > < span class = "ss" > locale< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "p" data-group-id = "9617298703-5" > %{< / span > < span class = "p" data-group-id = "9617298703-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 = "9617298703-6" > [< / span > < span class = "p" data-group-id = "9617298703-6" > ]< / span > < span class = "p" > ,< / span > < span class = "w" >
2023-07-12 11:28:07 +03:00
< / 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" >
2024-02-01 10:15:38 +03:00
< / span > < span class = "ss" > transform< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "p" data-group-id = "9617298703-7" > %{< / span > < span class = "p" data-group-id = "9617298703-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 = "9617298703-8" > [< / span > < span class = "p" data-group-id = "9617298703-8" > ]< / span > < span class = "w" >
< / span > < span class = "p" data-group-id = "9617298703-2" > }< / span > < / code > < / pre >
2023-07-12 11:28:07 +03:00
< / section >
< / section >
< section class = "detail" id = "default_territory/0" >
< div class = "detail-header" >
< a href = "#default_territory/0" class = "detail-link" title = "Link to this function" >
< i class = "ri-link-m" aria-hidden = "true" > < / i >
< span class = "sr-only" > Link to this function< / span >
< / a >
< h1 class = "signature" translate = "no" > default_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 >
< / div >
< section class = "docstring" >
< div class = "specs" >
2024-01-11 10:50:44 +03:00
< pre translate = "no" > < span class = "attribute" > @spec< / span > default_territory() :: < a href = "https://hexdocs.pm/ex_cldr/2.37.5/Cldr.Locale.html#t:territory_code/0" > Cldr.Locale.territory_code< / a > ()< / pre >
2023-07-12 11:28:07 +03:00
< / div >
< p > Returns the default territory when a locale
does not specify one and none can be inferred.< / p > < h2 id = "default_territory/0-example" class = "section-heading" >
2024-01-11 10:50:44 +03:00
< a href = "#default_territory/0-example" class = "hover-link" >
2023-07-25 10:58:48 +03:00
< i class = "ri-link-m" aria-hidden = "true" > < / i >
2023-07-12 11:28:07 +03:00
< / a >
2024-01-11 10:50:44 +03:00
< span class = "text" > Example< / span >
2023-07-12 11:28:07 +03:00
< / h2 >
2024-02-01 10:15:38 +03:00
< 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 = "4113114122-1" > (< / span > < span class = "p" data-group-id = "4113114122-1" > )< / span > < span class = "w" >
2023-07-12 11:28:07 +03:00
< / span > < span class = "ss" > :" 001" < / span > < / code > < / pre >
< / section >
< / section >
< section class = "detail" id = "ellipsis/2" >
< span id = "ellipsis/1" > < / span >
< div class = "detail-header" >
< a href = "#ellipsis/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" > ellipsis(string, 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 >
< / div >
< section class = "docstring" >
< div class = "specs" >
< pre translate = "no" > < span class = "attribute" > @spec< / span > ellipsis(< a href = "https://hexdocs.pm/elixir/String.html#t:t/0" > String.t< / a > () | [< 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 > ()) :: < a href = "https://hexdocs.pm/elixir/String.html#t:t/0" > String.t< / a > ()< / pre >
< / div >
< p > Add locale-specific ellipsis to a string.< / p > < h2 id = "ellipsis/2-arguments" class = "section-heading" >
2024-01-11 10:50:44 +03:00
< a href = "#ellipsis/2-arguments" class = "hover-link" >
2023-07-25 10:58:48 +03:00
< i class = "ri-link-m" aria-hidden = "true" > < / i >
2023-07-12 11:28:07 +03:00
< / a >
2024-01-11 10:50:44 +03:00
< span class = "text" > Arguments< / span >
2023-07-12 11:28:07 +03:00
< / h2 >
< ul > < li > < p > < code class = "inline" > string< / code > is any < code class = "inline" > String.t< / code > or a 2-element list
of < code class = "inline" > String.t< / code > between which the ellipsis is inserted.< / p > < / li > < li > < p > < code class = "inline" > backend< / code > is any module that includes < code class = "inline" > use Cldr< / code > and therefore
2024-01-11 10:50:44 +03:00
is a < a href = "https://hexdocs.pm/ex_cldr/2.37.5/Cldr.html" > < code class = "inline" > Cldr< / code > < / a > backend module. The default is < a href = "https://hexdocs.pm/ex_cldr/2.37.5/Cldr.html#default_backend!/0" > < code class = "inline" > Cldr.default_backend!/0< / code > < / a > .
Note that < a href = "https://hexdocs.pm/ex_cldr/2.37.5/Cldr.html#default_backend!/0" > < code class = "inline" > Cldr.default_backend!/0< / code > < / a > will raise an exception if
2023-07-12 11:28:07 +03:00
no < code class = "inline" > :default_backend< / code > is configured under the < code class = "inline" > :ex_cldr< / code > key in
< code class = "inline" > config.exs< / code > .< / p > < / li > < li > < p > < code class = "inline" > options< / code > is a keyword list of options< / p > < / li > < / ul > < h2 id = "ellipsis/2-options" class = "section-heading" >
2024-01-11 10:50:44 +03:00
< a href = "#ellipsis/2-options" class = "hover-link" >
2023-07-25 10:58:48 +03:00
< i class = "ri-link-m" aria-hidden = "true" > < / i >
2023-07-12 11:28:07 +03:00
< / a >
2024-01-11 10:50:44 +03:00
< span class = "text" > Options< / span >
2023-07-12 11:28:07 +03:00
< / h2 >
2024-01-11 10:50:44 +03:00
< ul > < li > < p > < code class = "inline" > :locale< / code > is any valid locale name returned by < a href = "https://hexdocs.pm/ex_cldr/2.37.5/Cldr.html#known_locale_names/1" > < code class = "inline" > Cldr.known_locale_names/1< / code > < / a > .
The default is < a href = "https://hexdocs.pm/ex_cldr/2.37.5/Cldr.html#get_locale/0" > < code class = "inline" > Cldr.get_locale/0< / code > < / a > .< / p > < / li > < li > < p > < code class = "inline" > :location< / code > determines where to place the ellipsis. The options are
2023-07-12 11:28:07 +03:00
< code class = "inline" > :after< / code > (the default for a single string argument), < code class = "inline" > :between< / code >
(the default and only valid location for an argument that is a list
of two strings) and < code class = "inline" > :before< / code > .< / p > < / li > < li > < p > < code class = "inline" > :format< / code > formats based upon whether the ellipsis
is inserted between words or sentences. The valid options are
< code class = "inline" > :word< / code > or < code class = "inline" > :sentence< / code > . The default is < code class = "inline" > :sentence< / code > .< / p > < / li > < / ul > < h2 id = "ellipsis/2-examples" class = "section-heading" >
2024-01-11 10:50:44 +03:00
< a href = "#ellipsis/2-examples" class = "hover-link" >
2023-07-25 10:58:48 +03:00
< i class = "ri-link-m" aria-hidden = "true" > < / i >
2023-07-12 11:28:07 +03:00
< / a >
2024-01-11 10:50:44 +03:00
< span class = "text" > Examples< / span >
2023-07-12 11:28:07 +03:00
< / h2 >
2024-02-01 10:15:38 +03:00
< 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 = "6619279220-1" > (< / span > < span class = "s" > " And furthermore" < / span > < span class = "p" data-group-id = "6619279220-1" > )< / span > < span class = "w" >
2023-07-12 11:28:07 +03:00
< / span > < span class = "s" > " And furthermore…" < / span > < span class = "w" >
2024-02-01 10:15:38 +03:00
< / 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 = "6619279220-2" > (< / span > < span class = "p" data-group-id = "6619279220-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 = "6619279220-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 = "6619279220-2" > )< / span > < span class = "w" >
2023-07-12 11:28:07 +03:00
< / span > < span class = "s" > " And furthermore…there is much to be done" < / span > < span class = "w" >
2024-02-01 10:15:38 +03:00
< / 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 = "6619279220-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 = "6619279220-4" > )< / span > < span class = "w" >
2023-07-12 11:28:07 +03:00
< / span > < span class = "s" > " And furthermore …" < / span > < span class = "w" >
2024-02-01 10:15:38 +03:00
< / 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 = "6619279220-5" > (< / span > < span class = "p" data-group-id = "6619279220-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 = "6619279220-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 = "6619279220-5" > )< / span > < span class = "w" >
2023-07-12 11:28:07 +03:00
< / span > < span class = "s" > " And furthermore … there is much to be done" < / span > < / code > < / pre >
< / section >
< / section >
< section class = "detail" id = "get_locale/0" >
< div class = "detail-header" >
< a href = "#get_locale/0" class = "detail-link" title = "Link to this function" >
< i class = "ri-link-m" aria-hidden = "true" > < / i >
< span class = "sr-only" > Link to this function< / span >
< / a >
< h1 class = "signature" translate = "no" > get_locale()< / h1 >
< a href = "https://github.com/plausible/analytics/blob/main/lib/plausible/cldr.ex#L1" class = "icon-action" rel = "help" title = "View Source" >
< i class = "ri-code-s-slash-line" aria-hidden = "true" > < / i >
< span class = "sr-only" > View Source< / span >
< / a >
< / div >
< section class = "docstring" >
< div class = "specs" >
2024-01-11 10:50:44 +03:00
< pre translate = "no" > < span class = "attribute" > @spec< / span > get_locale() :: < a href = "https://hexdocs.pm/ex_cldr/2.37.5/Cldr.LanguageTag.html#t:t/0" > Cldr.LanguageTag.t< / a > ()< / pre >
2023-07-12 11:28:07 +03:00
< / div >
2024-01-11 10:50:44 +03:00
< p > Return the current locale to be used for < a href = "https://hexdocs.pm/ex_cldr/2.37.5/Cldr.html" > < code class = "inline" > Cldr< / code > < / a > functions that
2023-07-12 11:28:07 +03:00
take an optional locale parameter for which a locale is not supplied.< / p > < h2 id = "get_locale/0-example" class = "section-heading" >
2024-01-11 10:50:44 +03:00
< a href = "#get_locale/0-example" class = "hover-link" >
2023-07-25 10:58:48 +03:00
< i class = "ri-link-m" aria-hidden = "true" > < / i >
2023-07-12 11:28:07 +03:00
< / a >
2024-01-11 10:50:44 +03:00
< span class = "text" > Example< / span >
2023-07-12 11:28:07 +03:00
< / h2 >
2024-02-01 10:15:38 +03:00
< 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 = "9650251374-1" > (< / span > < span class = "s" > " pl" < / span > < span class = "p" data-group-id = "9650251374-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 = "9650251374-2" > (< / span > < span class = "p" data-group-id = "9650251374-2" > )< / span > < span class = "w" >
< / span > < span class = "p" data-group-id = "9650251374-3" > %< / span > < span class = "nc" data-group-id = "9650251374-3" > Cldr.LanguageTag< / span > < span class = "p" data-group-id = "9650251374-3" > {< / span > < span class = "w" >
2023-07-12 11:28:07 +03:00
< / 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" >
2024-02-01 10:15:38 +03:00
< / span > < span class = "ss" > extensions< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "p" data-group-id = "9650251374-4" > %{< / span > < span class = "p" data-group-id = "9650251374-4" > }< / span > < span class = "p" > ,< / span > < span class = "w" >
2023-07-12 11:28:07 +03:00
< / 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" >
2024-02-01 10:15:38 +03:00
< / span > < span class = "ss" > locale< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "p" data-group-id = "9650251374-5" > %{< / span > < span class = "p" data-group-id = "9650251374-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 = "9650251374-6" > [< / span > < span class = "p" data-group-id = "9650251374-6" > ]< / span > < span class = "p" > ,< / span > < span class = "w" >
2023-07-12 11:28:07 +03:00
< / 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" >
2024-02-01 10:15:38 +03:00
< / span > < span class = "ss" > transform< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "p" data-group-id = "9650251374-7" > %{< / span > < span class = "p" data-group-id = "9650251374-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 = "9650251374-8" > [< / span > < span class = "p" data-group-id = "9650251374-8" > ]< / span > < span class = "w" >
< / span > < span class = "p" data-group-id = "9650251374-3" > }< / span > < / code > < / pre >
2023-07-12 11:28:07 +03:00
< / section >
< / section >
< section class = "detail" id = "known_calendars/0" >
< div class = "detail-header" >
< a href = "#known_calendars/0" class = "detail-link" title = "Link to this function" >
< i class = "ri-link-m" aria-hidden = "true" > < / i >
< span class = "sr-only" > Link to this function< / span >
< / a >
< h1 class = "signature" translate = "no" > known_calendars()< / 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" >
2024-01-11 10:50:44 +03:00
< p > See < a href = "https://hexdocs.pm/ex_cldr/2.37.5/Cldr.html#known_calendars/0" > < code class = "inline" > Cldr.known_calendars/0< / code > < / a > .< / p >
2023-07-12 11:28:07 +03:00
< / section >
< / section >
< section class = "detail" id = "known_currencies/0" >
< div class = "detail-header" >
< a href = "#known_currencies/0" class = "detail-link" title = "Link to this function" >
< i class = "ri-link-m" aria-hidden = "true" > < / i >
< span class = "sr-only" > Link to this function< / span >
< / a >
< h1 class = "signature" translate = "no" > known_currencies()< / 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" >
2024-01-11 10:50:44 +03:00
< p > See < a href = "https://hexdocs.pm/ex_cldr/2.37.5/Cldr.html#known_currencies/0" > < code class = "inline" > Cldr.known_currencies/0< / code > < / a > .< / p >
2023-07-12 11:28:07 +03:00
< / section >
< / section >
< section class = "detail" id = "known_gettext_locale_name/1" >
< div class = "detail-header" >
< a href = "#known_gettext_locale_name/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" > known_gettext_locale_name(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" >
< div class = "specs" >
< pre translate = "no" > < span class = "attribute" > @spec< / span > known_gettext_locale_name(< a href = "https://hexdocs.pm/elixir/String.html#t:t/0" > String.t< / a > ()) :: < a href = "https://hexdocs.pm/elixir/String.html#t:t/0" > String.t< / a > () | false< / pre >
< / div >
< p > Returns either the Gettext < code class = "inline" > locale_name< / code > in Cldr format or
< code class = "inline" > false< / code > based upon whether the locale name is configured in
2024-01-11 10:50:44 +03:00
< a href = "https://hexdocs.pm/gettext/0.24.0/Gettext.html" > < code class = "inline" > Gettext< / code > < / a > .< / p > < h2 id = "known_gettext_locale_name/1-arguments" class = "section-heading" >
< a href = "#known_gettext_locale_name/1-arguments" class = "hover-link" >
2023-07-25 10:58:48 +03:00
< i class = "ri-link-m" aria-hidden = "true" > < / i >
2023-07-12 11:28:07 +03:00
< / a >
2024-01-11 10:50:44 +03:00
< span class = "text" > Arguments< / span >
2023-07-12 11:28:07 +03:00
< / h2 >
< ul > < li > < code class = "inline" > locale< / code > is any valid locale name returned by
< a href = "#known_gettext_locale_names/0" > < code class = "inline" > Plausible.Cldr.known_gettext_locale_names/0< / code > < / a > < / li > < / ul > < h2 id = "known_gettext_locale_name/1-examples" class = "section-heading" >
2024-01-11 10:50:44 +03:00
< a href = "#known_gettext_locale_name/1-examples" class = "hover-link" >
2023-07-25 10:58:48 +03:00
< i class = "ri-link-m" aria-hidden = "true" > < / i >
2023-07-12 11:28:07 +03:00
< / a >
2024-01-11 10:50:44 +03:00
< span class = "text" > Examples< / span >
2023-07-12 11:28:07 +03:00
< / h2 >
2024-02-01 10:15:38 +03:00
< 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 = "3194036968-1" > (< / span > < span class = "s" > " en" < / span > < span class = "p" data-group-id = "3194036968-1" > )< / span > < span class = "w" >
2023-07-12 11:28:07 +03:00
< / span > < span class = "s" > " en" < / span > < span class = "w" >
2024-02-01 10:15:38 +03:00
< / 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 = "3194036968-2" > (< / span > < span class = "s" > " en-SA" < / span > < span class = "p" data-group-id = "3194036968-2" > )< / span > < span class = "w" >
2023-07-12 11:28:07 +03:00
< / span > < span class = "no" > false< / span > < / code > < / pre >
< / section >
< / section >
< section class = "detail" id = "known_gettext_locale_name?/1" >
< div class = "detail-header" >
< a href = "#known_gettext_locale_name?/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" > known_gettext_locale_name?(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" >
< div class = "specs" >
< pre translate = "no" > < span class = "attribute" > @spec< / span > known_gettext_locale_name?(< a href = "https://hexdocs.pm/elixir/String.html#t:t/0" > String.t< / a > ()) :: < a href = "https://hexdocs.pm/elixir/typespecs.html#built-in-types" > boolean< / a > ()< / pre >
< / div >
< p > Returns a boolean indicating if the specified locale
name is configured and available in Gettext.< / p > < h2 id = "known_gettext_locale_name?/1-arguments" class = "section-heading" >
2024-01-11 10:50:44 +03:00
< a href = "#known_gettext_locale_name?/1-arguments" class = "hover-link" >
2023-07-25 10:58:48 +03:00
< i class = "ri-link-m" aria-hidden = "true" > < / i >
2023-07-12 11:28:07 +03:00
< / a >
2024-01-11 10:50:44 +03:00
< span class = "text" > Arguments< / span >
2023-07-12 11:28:07 +03:00
< / h2 >
< ul > < li > < code class = "inline" > locale< / code > is any valid locale name returned by
< a href = "#known_locale_names/0" > < code class = "inline" > Plausible.Cldr.known_locale_names/0< / code > < / a > < / li > < / ul > < h2 id = "known_gettext_locale_name?/1-examples" class = "section-heading" >
2024-01-11 10:50:44 +03:00
< a href = "#known_gettext_locale_name?/1-examples" class = "hover-link" >
2023-07-25 10:58:48 +03:00
< i class = "ri-link-m" aria-hidden = "true" > < / i >
2023-07-12 11:28:07 +03:00
< / a >
2024-01-11 10:50:44 +03:00
< span class = "text" > Examples< / span >
2023-07-12 11:28:07 +03:00
< / h2 >
2024-02-01 10:15:38 +03:00
< 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 = "7412495035-1" > (< / span > < span class = "s" > " en" < / span > < span class = "p" data-group-id = "7412495035-1" > )< / span > < span class = "w" >
2023-07-12 11:28:07 +03:00
< / span > < span class = "no" > true< / span > < span class = "w" >
2024-02-01 10:15:38 +03:00
< / 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 = "7412495035-2" > (< / span > < span class = "s" > " !!" < / span > < span class = "p" data-group-id = "7412495035-2" > )< / span > < span class = "w" >
2023-07-12 11:28:07 +03:00
< / span > < span class = "no" > false< / span > < / code > < / pre >
< / section >
< / section >
< section class = "detail" id = "known_gettext_locale_names/0" >
< div class = "detail-header" >
< a href = "#known_gettext_locale_names/0" class = "detail-link" title = "Link to this function" >
< i class = "ri-link-m" aria-hidden = "true" > < / i >
< span class = "sr-only" > Link to this function< / span >
< / a >
< h1 class = "signature" translate = "no" > known_gettext_locale_names()< / h1 >
< a href = "https://github.com/plausible/analytics/blob/main/lib/plausible/cldr.ex#L1" class = "icon-action" rel = "help" title = "View Source" >
< i class = "ri-code-s-slash-line" aria-hidden = "true" > < / i >
< span class = "sr-only" > View Source< / span >
< / a >
< / div >
< section class = "docstring" >
< div class = "specs" >
< pre translate = "no" > < span class = "attribute" > @spec< / span > known_gettext_locale_names() :: [< a href = "https://hexdocs.pm/elixir/String.html#t:t/0" > String.t< / a > ()]< / pre >
< / div >
< p > Returns a list of Gettext locale names but in CLDR format with
underscore replaced by hyphen in order to facilitate comparisons
2024-01-11 10:50:44 +03:00
with < a href = "https://hexdocs.pm/ex_cldr/2.37.5/Cldr.html" > < code class = "inline" > Cldr< / code > < / a > locale names.< / p >
2023-07-12 11:28:07 +03:00
< / section >
< / section >
< section class = "detail" id = "known_locale_name/1" >
< div class = "detail-header" >
< a href = "#known_locale_name/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" > known_locale_name(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" >
< div class = "specs" >
2024-01-11 10:50:44 +03:00
< pre translate = "no" > < span class = "attribute" > @spec< / span > known_locale_name(< 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 > () | false< / pre >
2023-07-12 11:28:07 +03:00
< / div >
< p > Returns either the < code class = "inline" > locale_name< / code > or < code class = "inline" > false< / code > based upon
2024-01-11 10:50:44 +03:00
whether the locale name is configured in < a href = "https://hexdocs.pm/ex_cldr/2.37.5/Cldr.html" > < code class = "inline" > Cldr< / code > < / a > .< / p > < p > This is helpful when building a list of < code class = "inline" > or< / code > expressions
2023-07-12 11:28:07 +03:00
to return the first known locale name from a list.< / p > < h2 id = "known_locale_name/1-arguments" class = "section-heading" >
2024-01-11 10:50:44 +03:00
< a href = "#known_locale_name/1-arguments" class = "hover-link" >
2023-07-25 10:58:48 +03:00
< i class = "ri-link-m" aria-hidden = "true" > < / i >
2023-07-12 11:28:07 +03:00
< / a >
2024-01-11 10:50:44 +03:00
< span class = "text" > Arguments< / span >
2023-07-12 11:28:07 +03:00
< / h2 >
< ul > < li > < code class = "inline" > locale< / code > is any valid locale name returned by
< a href = "#known_locale_names/0" > < code class = "inline" > Plausible.Cldr.known_locale_names/0< / code > < / a > < / li > < / ul > < h2 id = "known_locale_name/1-examples" class = "section-heading" >
2024-01-11 10:50:44 +03:00
< a href = "#known_locale_name/1-examples" class = "hover-link" >
2023-07-25 10:58:48 +03:00
< i class = "ri-link-m" aria-hidden = "true" > < / i >
2023-07-12 11:28:07 +03:00
< / a >
2024-01-11 10:50:44 +03:00
< span class = "text" > Examples< / span >
2023-07-12 11:28:07 +03:00
< / h2 >
2024-02-01 10:15:38 +03:00
< 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 = "2257734871-1" > (< / span > < span class = "ss" > :" en-AU" < / span > < span class = "p" data-group-id = "2257734871-1" > )< / span > < span class = "w" >
2023-07-12 11:28:07 +03:00
< / span > < span class = "ss" > :" en-AU" < / span > < span class = "w" >
2024-02-01 10:15:38 +03:00
< / 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 = "2257734871-2" > (< / span > < span class = "ss" > :" en-SA" < / span > < span class = "p" data-group-id = "2257734871-2" > )< / span > < span class = "w" >
2023-07-12 11:28:07 +03:00
< / span > < span class = "no" > false< / span > < / code > < / pre >
< / section >
< / section >
< section class = "detail" id = "known_locale_name?/1" >
< div class = "detail-header" >
< a href = "#known_locale_name?/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" > known_locale_name?(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" >
< div class = "specs" >
2024-01-11 10:50:44 +03:00
< pre translate = "no" > < span class = "attribute" > @spec< / span > known_locale_name?(< 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/typespecs.html#built-in-types" > boolean< / a > ()< / pre >
2023-07-12 11:28:07 +03:00
< / div >
< p > Returns a boolean indicating if the specified locale
name is configured and available in Cldr.< / p > < h2 id = "known_locale_name?/1-arguments" class = "section-heading" >
2024-01-11 10:50:44 +03:00
< a href = "#known_locale_name?/1-arguments" class = "hover-link" >
2023-07-25 10:58:48 +03:00
< i class = "ri-link-m" aria-hidden = "true" > < / i >
2023-07-12 11:28:07 +03:00
< / a >
2024-01-11 10:50:44 +03:00
< span class = "text" > Arguments< / span >
2023-07-12 11:28:07 +03:00
< / h2 >
< ul > < li > < code class = "inline" > locale< / code > is any valid locale name returned by < a href = "#known_locale_names/0" > < code class = "inline" > Plausible.Cldr.known_locale_names/0< / code > < / a > < / li > < / ul > < h2 id = "known_locale_name?/1-examples" class = "section-heading" >
2024-01-11 10:50:44 +03:00
< a href = "#known_locale_name?/1-examples" class = "hover-link" >
2023-07-25 10:58:48 +03:00
< i class = "ri-link-m" aria-hidden = "true" > < / i >
2023-07-12 11:28:07 +03:00
< / a >
2024-01-11 10:50:44 +03:00
< span class = "text" > Examples< / span >
2023-07-12 11:28:07 +03:00
< / h2 >
2024-02-01 10:15:38 +03:00
< 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 = "2457432518-1" > (< / span > < span class = "ss" > :en< / span > < span class = "p" data-group-id = "2457432518-1" > )< / span > < span class = "w" >
2023-07-12 11:28:07 +03:00
< / span > < span class = "no" > true< / span > < span class = "w" >
2024-02-01 10:15:38 +03:00
< / 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 = "2457432518-2" > (< / span > < span class = "ss" > :" !!" < / span > < span class = "p" data-group-id = "2457432518-2" > )< / span > < span class = "w" >
2023-07-12 11:28:07 +03:00
< / span > < span class = "no" > false< / span > < / code > < / pre >
< / section >
< / section >
< section class = "detail" id = "known_locale_names/0" >
< div class = "detail-header" >
< a href = "#known_locale_names/0" class = "detail-link" title = "Link to this function" >
< i class = "ri-link-m" aria-hidden = "true" > < / i >
< span class = "sr-only" > Link to this function< / span >
< / a >
< h1 class = "signature" translate = "no" > known_locale_names()< / h1 >
< a href = "https://github.com/plausible/analytics/blob/main/lib/plausible/cldr.ex#L1" class = "icon-action" rel = "help" title = "View Source" >
< i class = "ri-code-s-slash-line" aria-hidden = "true" > < / i >
< span class = "sr-only" > View Source< / span >
< / a >
< / div >
< section class = "docstring" >
< p > Returns a list of the known locale names.< / p > < p > Known locales are those locales which
are the subset of all CLDR locales that
have been configured for use either
2024-01-11 10:50:44 +03:00
in this module or in < a href = "https://hexdocs.pm/gettext/0.24.0/Gettext.html" > < code class = "inline" > Gettext< / code > < / a > .< / p >
2023-07-12 11:28:07 +03:00
< / section >
< / section >
< section class = "detail" id = "known_number_system_types/0" >
< div class = "detail-header" >
< a href = "#known_number_system_types/0" class = "detail-link" title = "Link to this function" >
< i class = "ri-link-m" aria-hidden = "true" > < / i >
< span class = "sr-only" > Link to this function< / span >
< / a >
< h1 class = "signature" translate = "no" > known_number_system_types()< / 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" >
2024-01-11 10:50:44 +03:00
< p > Returns a list of atoms representing the number systems types known to < a href = "https://hexdocs.pm/ex_cldr/2.37.5/Cldr.html" > < code class = "inline" > Cldr< / code > < / a > .< / p > < h2 id = "known_number_system_types/0-example" class = "section-heading" >
< a href = "#known_number_system_types/0-example" class = "hover-link" >
2023-07-25 10:58:48 +03:00
< i class = "ri-link-m" aria-hidden = "true" > < / i >
2023-07-12 11:28:07 +03:00
< / a >
2024-01-11 10:50:44 +03:00
< span class = "text" > Example< / span >
2023-07-12 11:28:07 +03:00
< / h2 >
2024-02-01 10:15:38 +03:00
< 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 = "2745668122-1" > (< / span > < span class = "p" data-group-id = "2745668122-1" > )< / span > < span class = "w" >
< / span > < span class = "p" data-group-id = "2745668122-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 = "2745668122-2" > ]< / span > < / code > < / pre >
2023-07-12 11:28:07 +03:00
< / section >
< / section >
< section class = "detail" id = "known_number_systems/0" >
< div class = "detail-header" >
< a href = "#known_number_systems/0" class = "detail-link" title = "Link to this function" >
< i class = "ri-link-m" aria-hidden = "true" > < / i >
< span class = "sr-only" > Link to this function< / span >
< / a >
< h1 class = "signature" translate = "no" > known_number_systems()< / 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" >
2024-01-11 10:50:44 +03:00
< p > See < a href = "https://hexdocs.pm/ex_cldr/2.37.5/Cldr.html#known_number_systems/0" > < code class = "inline" > Cldr.known_number_systems/0< / code > < / a > .< / p >
2023-07-12 11:28:07 +03:00
< / section >
< / section >
< section class = "detail" id = "known_rbnf_locale_name/1" >
< div class = "detail-header" >
< a href = "#known_rbnf_locale_name/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" > known_rbnf_locale_name(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" >
< div class = "specs" >
2024-01-11 10:50:44 +03:00
< pre translate = "no" > < span class = "attribute" > @spec< / span > known_rbnf_locale_name(< 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 > () | false< / pre >
2023-07-12 11:28:07 +03:00
< / div >
< p > Returns either the RBNF < code class = "inline" > locale_name< / code > or < code class = "inline" > false< / code > based upon
2024-01-11 10:50:44 +03:00
whether the locale name is configured in < a href = "https://hexdocs.pm/ex_cldr/2.37.5/Cldr.html" > < code class = "inline" > Cldr< / code > < / a >
2023-07-12 11:28:07 +03:00
and has RBNF rules defined.< / p > < h2 id = "known_rbnf_locale_name/1-arguments" class = "section-heading" >
2024-01-11 10:50:44 +03:00
< a href = "#known_rbnf_locale_name/1-arguments" class = "hover-link" >
2023-07-25 10:58:48 +03:00
< i class = "ri-link-m" aria-hidden = "true" > < / i >
2023-07-12 11:28:07 +03:00
< / a >
2024-01-11 10:50:44 +03:00
< span class = "text" > Arguments< / span >
2023-07-12 11:28:07 +03:00
< / h2 >
< ul > < li > < code class = "inline" > locale< / code > is any valid locale name returned by
< a href = "#known_locale_names/0" > < code class = "inline" > Plausible.Cldr.known_locale_names/0< / code > < / a > < / li > < / ul > < h2 id = "known_rbnf_locale_name/1-examples" class = "section-heading" >
2024-01-11 10:50:44 +03:00
< a href = "#known_rbnf_locale_name/1-examples" class = "hover-link" >
2023-07-25 10:58:48 +03:00
< i class = "ri-link-m" aria-hidden = "true" > < / i >
2023-07-12 11:28:07 +03:00
< / a >
2024-01-11 10:50:44 +03:00
< span class = "text" > Examples< / span >
2023-07-12 11:28:07 +03:00
< / h2 >
2024-02-01 10:15:38 +03:00
< 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 = "3187101836-1" > (< / span > < span class = "ss" > :en< / span > < span class = "p" data-group-id = "3187101836-1" > )< / span > < span class = "w" >
2023-07-12 11:28:07 +03:00
< / span > < span class = "ss" > :en< / span > < span class = "w" >
2024-02-01 10:15:38 +03:00
< / 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 = "3187101836-2" > (< / span > < span class = "ss" > :" en-SA" < / span > < span class = "p" data-group-id = "3187101836-2" > )< / span > < span class = "w" >
2023-07-12 11:28:07 +03:00
< / span > < span class = "no" > false< / span > < / code > < / pre >
< / section >
< / section >
< section class = "detail" id = "known_rbnf_locale_name?/1" >
< div class = "detail-header" >
< a href = "#known_rbnf_locale_name?/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" > known_rbnf_locale_name?(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" >
< div class = "specs" >
2024-01-11 10:50:44 +03:00
< pre translate = "no" > < span class = "attribute" > @spec< / span > known_rbnf_locale_name?(< 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/typespecs.html#built-in-types" > boolean< / a > ()< / pre >
2023-07-12 11:28:07 +03:00
< / div >
< p > Returns a boolean indicating if the specified locale
name is configured and available in Cldr and supports
rules based number formats (RBNF).< / p > < h2 id = "known_rbnf_locale_name?/1-arguments" class = "section-heading" >
2024-01-11 10:50:44 +03:00
< a href = "#known_rbnf_locale_name?/1-arguments" class = "hover-link" >
2023-07-25 10:58:48 +03:00
< i class = "ri-link-m" aria-hidden = "true" > < / i >
2023-07-12 11:28:07 +03:00
< / a >
2024-01-11 10:50:44 +03:00
< span class = "text" > Arguments< / span >
2023-07-12 11:28:07 +03:00
< / h2 >
< ul > < li > < code class = "inline" > locale< / code > is any valid locale name returned by < a href = "#known_locale_names/0" > < code class = "inline" > Plausible.Cldr.known_locale_names/0< / code > < / a > < / li > < / ul > < h2 id = "known_rbnf_locale_name?/1-examples" class = "section-heading" >
2024-01-11 10:50:44 +03:00
< a href = "#known_rbnf_locale_name?/1-examples" class = "hover-link" >
2023-07-25 10:58:48 +03:00
< i class = "ri-link-m" aria-hidden = "true" > < / i >
2023-07-12 11:28:07 +03:00
< / a >
2024-01-11 10:50:44 +03:00
< span class = "text" > Examples< / span >
2023-07-12 11:28:07 +03:00
< / h2 >
2024-02-01 10:15:38 +03:00
< 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 = "6028259561-1" > (< / span > < span class = "ss" > :en< / span > < span class = "p" data-group-id = "6028259561-1" > )< / span > < span class = "w" >
2023-07-12 11:28:07 +03:00
< / span > < span class = "no" > true< / span > < span class = "w" >
2024-02-01 10:15:38 +03:00
< / 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 = "6028259561-2" > (< / span > < span class = "ss" > :" !!" < / span > < span class = "p" data-group-id = "6028259561-2" > )< / span > < span class = "w" >
2023-07-12 11:28:07 +03:00
< / span > < span class = "no" > false< / span > < / code > < / pre >
< / section >
< / section >
< section class = "detail" id = "known_rbnf_locale_names/0" >
< div class = "detail-header" >
< a href = "#known_rbnf_locale_names/0" class = "detail-link" title = "Link to this function" >
< i class = "ri-link-m" aria-hidden = "true" > < / i >
< span class = "sr-only" > Link to this function< / span >
< / a >
< h1 class = "signature" translate = "no" > known_rbnf_locale_names()< / h1 >
< a href = "https://github.com/plausible/analytics/blob/main/lib/plausible/cldr.ex#L1" class = "icon-action" rel = "help" title = "View Source" >
< i class = "ri-code-s-slash-line" aria-hidden = "true" > < / i >
< span class = "sr-only" > View Source< / span >
< / a >
< / div >
< section class = "docstring" >
< div class = "specs" >
2024-01-11 10:50:44 +03:00
< pre translate = "no" > < span class = "attribute" > @spec< / span > known_rbnf_locale_names() :: [< a href = "https://hexdocs.pm/ex_cldr/2.37.5/Cldr.Locale.html#t:locale_name/0" > Cldr.Locale.locale_name< / a > ()]< / pre >
2023-07-12 11:28:07 +03:00
< / div >
< p > Returns a list of locale names which have rules-based number
formats (RBNF).< / p >
< / section >
< / section >
< section class = "detail" id = "known_territories/0" >
< div class = "detail-header" >
< a href = "#known_territories/0" class = "detail-link" title = "Link to this function" >
< i class = "ri-link-m" aria-hidden = "true" > < / i >
< span class = "sr-only" > Link to this function< / span >
< / a >
< h1 class = "signature" translate = "no" > known_territories()< / 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" >
2024-01-11 10:50:44 +03:00
< p > See < a href = "https://hexdocs.pm/ex_cldr/2.37.5/Cldr.html#known_territories/0" > < code class = "inline" > Cldr.known_territories/0< / code > < / a > .< / p >
2023-07-12 11:28:07 +03:00
< / section >
< / section >
< section class = "detail" id = "normalize_lenient_parse/3" >
< span id = "normalize_lenient_parse/2" > < / span >
< div class = "detail-header" >
< a href = "#normalize_lenient_parse/3" 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" > normalize_lenient_parse(string, scope, locale \\ get_locale())< / h1 >
< a href = "https://github.com/plausible/analytics/blob/main/lib/plausible/cldr.ex#L1" class = "icon-action" rel = "help" title = "View Source" >
< i class = "ri-code-s-slash-line" aria-hidden = "true" > < / i >
< span class = "sr-only" > View Source< / span >
< / a >
< / div >
< section class = "docstring" >
< p > Normalizes a string by applying transliteration
of common symbols in numbers, currencies and dates< / p >
< / section >
< / section >
2024-01-11 10:50:44 +03:00
< section class = "detail" id = "put_gettext_locale/1" >
< div class = "detail-header" >
< a href = "#put_gettext_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" > put_gettext_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.38.0)< / span >
< / div >
< section class = "docstring" >
< div class = "specs" >
< pre translate = "no" > < span class = "attribute" > @spec< / span > put_gettext_locale(< a href = "https://hexdocs.pm/ex_cldr/2.37.5/Cldr.LanguageTag.html#t:t/0" > Cldr.LanguageTag.t< / a > ()) ::
{:ok, < a href = "https://hexdocs.pm/elixir/typespecs.html#built-in-types" > binary< / a > () | nil} | {: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 > Set the current process's Gettext locale from a
< code class = "inline" > t:Cldr.LanguageTag< / code > .< / p > < h2 id = "put_gettext_locale/1-arguments" class = "section-heading" >
< a href = "#put_gettext_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 a < a href = "https://hexdocs.pm/ex_cldr/2.37.5/Cldr.LanguageTag.html" > < code class = "inline" > Cldr.LanguageTag< / code > < / a > struct returned by < a href = "https://hexdocs.pm/ex_cldr/2.37.5/Cldr.Locale.html#new!/2" > < code class = "inline" > Cldr.Locale.new!/2< / code > < / a > .< / li > < / ul > < h2 id = "put_gettext_locale/1-returns" class = "section-heading" >
< a href = "#put_gettext_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 > < code class = "inline" > {:ok, gettext_locale_name}< / code > or< / p > < / li > < li > < p > < code class = "inline" > {:error, {exception, reason}}< / code > < / p > < / li > < / ul > < h2 id = "put_gettext_locale/1-behaviour" class = "section-heading" >
< a href = "#put_gettext_locale/1-behaviour" class = "hover-link" >
< i class = "ri-link-m" aria-hidden = "true" > < / i >
< / a >
< span class = "text" > Behaviour< / span >
< / h2 >
< ol > < li > < p > If the < code class = "inline" > locale.gettext_locale_name< / code > is < code class = "inline" > nil< / code > then an error
is returned.< / p > < / li > < li > < p > The < code class = "inline" > gettext< / code > locale for the < code class = "inline" > gettext_backend< / code > configured for the
CLDR backend defined by the < code class = "inline" > t:Cldr.LanguageTag< / code > is set.< / p > < / li > < / ol > < h2 id = "put_gettext_locale/1-examples" class = "section-heading" >
< a href = "#put_gettext_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 = "kn" > import< / span > < span class = "w" > < / span > < span class = "nc" > Cldr.LanguageTag.Sigil< / span > < span class = "w" >
2024-02-01 10:15:38 +03:00
< / 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 = "3409179966-1" > (< / span > < span class = "sx" > ~l" en" < / span > < span class = "p" data-group-id = "3409179966-1" > )< / span > < span class = "w" >
< / span > < span class = "p" data-group-id = "3409179966-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 = "3409179966-2" > }< / span > < span class = "w" >
2024-01-11 10:50:44 +03:00
< / 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" >
2024-02-01 10:15:38 +03:00
< / 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 = "3409179966-3" > (< / span > < span class = "sx" > ~l" de" < / span > < span class = "p" data-group-id = "3409179966-3" > )< / span > < span class = "w" >
< / span > < span class = "p" data-group-id = "3409179966-4" > {< / span > < span class = "ss" > :error< / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "p" data-group-id = "3409179966-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 = "3409179966-5" > }< / span > < span class = "p" data-group-id = "3409179966-4" > }< / span > < / code > < / pre >
2024-01-11 10:50:44 +03:00
< / section >
< / section >
2023-07-12 11:28:07 +03:00
< section class = "detail" id = "put_locale/1" >
< div class = "detail-header" >
< a href = "#put_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" > put_locale(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" >
< div class = "specs" >
2024-01-11 10:50:44 +03:00
< pre translate = "no" > < span class = "attribute" > @spec< / span > put_locale(< 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 >
2023-07-12 11:28:07 +03:00
< / div >
2024-01-11 10:50:44 +03:00
< p > Set the current locale to be used for < a href = "https://hexdocs.pm/ex_cldr/2.37.5/Cldr.html" > < code class = "inline" > Cldr< / code > < / a > functions that
2023-07-12 11:28:07 +03:00
take an optional locale parameter for which a locale is not supplied.< / p > < h2 id = "put_locale/1-arguments" class = "section-heading" >
2024-01-11 10:50:44 +03:00
< a href = "#put_locale/1-arguments" class = "hover-link" >
2023-07-25 10:58:48 +03:00
< i class = "ri-link-m" aria-hidden = "true" > < / i >
2023-07-12 11:28:07 +03:00
< / a >
2024-01-11 10:50:44 +03:00
< span class = "text" > Arguments< / span >
2023-07-12 11:28:07 +03:00
< / h2 >
< ul > < li > < code class = "inline" > locale< / code > is any valid locale name returned by < a href = "#known_locale_names/0" > < code class = "inline" > Plausible.Cldr.known_locale_names/0< / code > < / a >
or a < code class = "inline" > t:Cldr.LanguageTag< / code > struct returned by < a href = "Plausible.Cldr.Locale.html#new!/1" > < code class = "inline" > Plausible.Cldr.Locale.new!/1< / code > < / a > < / li > < / ul > < p > See < a href = "https://tools.ietf.org/html/rfc5646" > rfc5646< / a > for the specification
of a language tag.< / p > < h2 id = "put_locale/1-examples" class = "section-heading" >
2024-01-11 10:50:44 +03:00
< a href = "#put_locale/1-examples" class = "hover-link" >
2023-07-25 10:58:48 +03:00
< i class = "ri-link-m" aria-hidden = "true" > < / i >
2023-07-12 11:28:07 +03:00
< / a >
2024-01-11 10:50:44 +03:00
< span class = "text" > Examples< / span >
2023-07-12 11:28:07 +03:00
< / h2 >
2024-02-01 10:15:38 +03:00
< 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 = "4074469440-1" > (< / span > < span class = "s" > " en" < / span > < span class = "p" data-group-id = "4074469440-1" > )< / span > < span class = "w" >
< / span > < span class = "p" data-group-id = "4074469440-2" > {< / span > < span class = "ss" > :ok< / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "p" data-group-id = "4074469440-3" > %< / span > < span class = "nc" data-group-id = "4074469440-3" > Cldr.LanguageTag< / span > < span class = "p" data-group-id = "4074469440-3" > {< / span > < span class = "w" >
2023-07-12 11:28:07 +03:00
< / 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" >
2024-02-01 10:15:38 +03:00
< / span > < span class = "ss" > language_subtags< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "p" data-group-id = "4074469440-4" > [< / span > < span class = "p" data-group-id = "4074469440-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 = "4074469440-5" > %{< / span > < span class = "p" data-group-id = "4074469440-5" > }< / span > < span class = "p" > ,< / span > < span class = "w" >
2023-07-12 11:28:07 +03:00
< / 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" >
2024-02-01 10:15:38 +03:00
< / span > < span class = "ss" > locale< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "p" data-group-id = "4074469440-6" > %{< / span > < span class = "p" data-group-id = "4074469440-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 = "4074469440-7" > [< / span > < span class = "p" data-group-id = "4074469440-7" > ]< / span > < span class = "p" > ,< / span > < span class = "w" >
2023-07-12 11:28:07 +03:00
< / 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" >
2024-02-01 10:15:38 +03:00
< / span > < span class = "ss" > transform< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "p" data-group-id = "4074469440-8" > %{< / span > < span class = "p" data-group-id = "4074469440-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 = "4074469440-9" > [< / span > < span class = "p" data-group-id = "4074469440-9" > ]< / span > < span class = "w" >
< / span > < span class = "p" data-group-id = "4074469440-3" > }< / span > < span class = "p" data-group-id = "4074469440-2" > }< / span > < span class = "w" >
2023-07-12 11:28:07 +03:00
2024-02-01 10:15:38 +03:00
< / 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 = "4074469440-10" > (< / span > < span class = "s" > " invalid-locale!" < / span > < span class = "p" data-group-id = "4074469440-10" > )< / span > < span class = "w" >
< / span > < span class = "p" data-group-id = "4074469440-11" > {< / span > < span class = "ss" > :error< / span > < span class = "p" > ,< / span > < span class = "w" > < / span > < span class = "p" data-group-id = "4074469440-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 = "4074469440-12" > }< / span > < span class = "p" data-group-id = "4074469440-11" > }< / span > < / code > < / pre >
2023-07-12 11:28:07 +03:00
< / section >
< / section >
< section class = "detail" id = "quote/2" >
< span id = "quote/1" > < / span >
< div class = "detail-header" >
< a href = "#quote/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" > quote(string, 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 >
< / div >
< section class = "docstring" >
< div class = "specs" >
< pre translate = "no" > < span class = "attribute" > @spec< / span > quote(< 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 > ()) :: < a href = "https://hexdocs.pm/elixir/String.html#t:t/0" > String.t< / a > ()< / pre >
< / div >
< p > Add locale-specific quotation marks around a string.< / p > < h2 id = "quote/2-arguments" class = "section-heading" >
2024-01-11 10:50:44 +03:00
< a href = "#quote/2-arguments" class = "hover-link" >
2023-07-25 10:58:48 +03:00
< i class = "ri-link-m" aria-hidden = "true" > < / i >
2023-07-12 11:28:07 +03:00
< / a >
2024-01-11 10:50:44 +03:00
< span class = "text" > Arguments< / span >
2023-07-12 11:28:07 +03:00
< / h2 >
< ul > < li > < p > < code class = "inline" > string< / code > is any valid Elixir string< / p > < / li > < li > < p > < code class = "inline" > options< / code > is a keyword list of options< / p > < / li > < / ul > < h2 id = "quote/2-options" class = "section-heading" >
2024-01-11 10:50:44 +03:00
< a href = "#quote/2-options" class = "hover-link" >
2023-07-25 10:58:48 +03:00
< i class = "ri-link-m" aria-hidden = "true" > < / i >
2023-07-12 11:28:07 +03:00
< / a >
2024-01-11 10:50:44 +03:00
< span class = "text" > Options< / span >
2023-07-12 11:28:07 +03:00
< / h2 >
2024-01-11 10:50:44 +03:00
< ul > < li > < code class = "inline" > locale< / code > is any valid locale name 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 > .
The default is < a href = "https://hexdocs.pm/ex_cldr/2.37.5/Cldr.html#get_locale/0" > < code class = "inline" > Cldr.get_locale/0< / code > < / a > < / li > < / ul > < h2 id = "quote/2-examples" class = "section-heading" >
< a href = "#quote/2-examples" class = "hover-link" >
2023-07-25 10:58:48 +03:00
< i class = "ri-link-m" aria-hidden = "true" > < / i >
2023-07-12 11:28:07 +03:00
< / a >
2024-01-11 10:50:44 +03:00
< span class = "text" > Examples< / span >
2023-07-12 11:28:07 +03:00
< / h2 >
2024-02-01 10:15:38 +03:00
< 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 = "6807063286-1" > (< / span > < span class = "s" > " Quoted String" < / span > < span class = "p" data-group-id = "6807063286-1" > )< / span > < span class = "w" >
2023-07-12 11:28:07 +03:00
< / span > < span class = "s" > " “Quoted String”" < / span > < span class = "w" >
2024-02-01 10:15:38 +03:00
< / 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 = "6807063286-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 = "6807063286-2" > )< / span > < span class = "w" >
2023-07-12 11:28:07 +03:00
< / span > < span class = "s" > " 「Quoted String」" < / span > < / code > < / pre >
< / section >
< / section >
< section class = "detail" id = "unknown_locale_names/0" >
< div class = "detail-header" >
< a href = "#unknown_locale_names/0" class = "detail-link" title = "Link to this function" >
< i class = "ri-link-m" aria-hidden = "true" > < / i >
< span class = "sr-only" > Link to this function< / span >
< / a >
< h1 class = "signature" translate = "no" > unknown_locale_names()< / h1 >
< a href = "https://github.com/plausible/analytics/blob/main/lib/plausible/cldr.ex#L1" class = "icon-action" rel = "help" title = "View Source" >
< i class = "ri-code-s-slash-line" aria-hidden = "true" > < / i >
< span class = "sr-only" > View Source< / span >
< / a >
< / div >
< section class = "docstring" >
< div class = "specs" >
2024-01-11 10:50:44 +03:00
< pre translate = "no" > < span class = "attribute" > @spec< / span > unknown_locale_names() :: [< a href = "https://hexdocs.pm/ex_cldr/2.37.5/Cldr.Locale.html#t:locale_name/0" > Cldr.Locale.locale_name< / a > ()]< / pre >
2023-07-12 11:28:07 +03:00
< / div >
< p > Returns a list of the locales names that are configured,
but not known in CLDR.< / p > < p > Since there is a compile-time exception raised if there are
any unknown locales this function should always
return an empty list.< / p >
< / section >
< / section >
< section class = "detail" id = "validate_calendar/1" >
< div class = "detail-header" >
< a href = "#validate_calendar/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" > validate_calendar(calendar)< / 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" >
2024-01-11 10:50:44 +03:00
< p > See < a href = "https://hexdocs.pm/ex_cldr/2.37.5/Cldr.html#validate_calendar/1" > < code class = "inline" > Cldr.validate_calendar/1< / code > < / a > .< / p >
2023-07-12 11:28:07 +03:00
< / section >
< / section >
< section class = "detail" id = "validate_currency/1" >
< div class = "detail-header" >
< a href = "#validate_currency/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" > validate_currency(currency)< / 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" >
2024-01-11 10:50:44 +03:00
< p > See < a href = "https://hexdocs.pm/ex_cldr/2.37.5/Cldr.html#validate_currency/1" > < code class = "inline" > Cldr.validate_currency/1< / code > < / a > .< / p >
2023-07-12 11:28:07 +03:00
< / section >
< / section >
< section class = "detail" id = "validate_locale/1" >
< div class = "detail-header" >
< a href = "#validate_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" > validate_locale(locale)< / h1 >
< a href = "https://github.com/plausible/analytics/blob/main/lib/plausible/cldr.ex#L1" class = "icon-action" rel = "help" title = "View Source" >
< i class = "ri-code-s-slash-line" aria-hidden = "true" > < / i >
< span class = "sr-only" > View Source< / span >
< / a >
< / div >
< section class = "docstring" >
< div class = "specs" >
2024-01-11 10:50:44 +03:00
< pre translate = "no" > < span class = "attribute" > @spec< / span > validate_locale(< a href = "https://hexdocs.pm/ex_cldr/2.37.5/Cldr.Locale.html#t:locale_name/0" > Cldr.Locale.locale_name< / a > () | < a href = "https://hexdocs.pm/ex_cldr/2.37.5/Cldr.LanguageTag.html#t:t/0" > Cldr.LanguageTag.t< / a > () | < 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.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 >
2023-07-12 11:28:07 +03:00
< / div >
< p > Normalise and validate a locale name.< / p > < h2 id = "validate_locale/1-arguments" class = "section-heading" >
2024-01-11 10:50:44 +03:00
< a href = "#validate_locale/1-arguments" class = "hover-link" >
2023-07-25 10:58:48 +03:00
< i class = "ri-link-m" aria-hidden = "true" > < / i >
2023-07-12 11:28:07 +03:00
< / a >
2024-01-11 10:50:44 +03:00
< span class = "text" > Arguments< / span >
2023-07-12 11:28:07 +03:00
< / h2 >
< ul > < li > < code class = "inline" > locale< / code > is any valid locale name returned by < a href = "#known_locale_names/0" > < code class = "inline" > Plausible.Cldr.known_locale_names/0< / code > < / a >
2024-01-11 10:50:44 +03:00
or a < a href = "https://hexdocs.pm/ex_cldr/2.37.5/Cldr.LanguageTag.html" > < code class = "inline" > Cldr.LanguageTag< / code > < / a > struct returned by < a href = "Plausible.Cldr.Locale.html#new!/1" > < code class = "inline" > Plausible.Cldr.Locale.new!/1< / code > < / a > < / li > < / ul > < h2 id = "validate_locale/1-returns" class = "section-heading" >
< a href = "#validate_locale/1-returns" class = "hover-link" >
2023-07-25 10:58:48 +03:00
< i class = "ri-link-m" aria-hidden = "true" > < / i >
2023-07-12 11:28:07 +03:00
< / a >
2024-01-11 10:50:44 +03:00
< span class = "text" > Returns< / span >
2023-07-12 11:28:07 +03:00
< / h2 >
< ul > < li > < p > < code class = "inline" > {:ok, language_tag}< / code > < / p > < / li > < li > < p > < code class = "inline" > {:error, reason}< / code > < / p > < / li > < / ul > < h2 id = "validate_locale/1-notes" class = "section-heading" >
2024-01-11 10:50:44 +03:00
< a href = "#validate_locale/1-notes" class = "hover-link" >
2023-07-25 10:58:48 +03:00
< i class = "ri-link-m" aria-hidden = "true" > < / i >
2023-07-12 11:28:07 +03:00
< / a >
2024-01-11 10:50:44 +03:00
< span class = "text" > Notes< / span >
2023-07-12 11:28:07 +03:00
< / h2 >
< p > See < a href = "https://tools.ietf.org/html/rfc5646" > rfc5646< / a > for the specification
of a language tag.< / p > < h2 id = "validate_locale/1-examples" class = "section-heading" >
2024-01-11 10:50:44 +03:00
< a href = "#validate_locale/1-examples" class = "hover-link" >
2023-07-25 10:58:48 +03:00
< i class = "ri-link-m" aria-hidden = "true" > < / i >
2023-07-12 11:28:07 +03:00
< / a >
2024-01-11 10:50:44 +03:00
< span class = "text" > Examples< / span >
2023-07-12 11:28:07 +03:00
< / h2 >
2024-02-01 10:15:38 +03:00
< 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 = "1239979443-1" > (< / span > < span class = "ss" > :en< / span > < span class = "p" data-group-id = "1239979443-1" > )< / span > < span class = "w" >
< / span > < span class = "p" data-group-id = "1239979443-2" > {< / span > < span class = "ss" > :ok< / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "p" data-group-id = "1239979443-3" > %< / span > < span class = "nc" data-group-id = "1239979443-3" > Cldr.LanguageTag< / span > < span class = "p" data-group-id = "1239979443-3" > {< / span > < span class = "w" >
2023-07-12 11:28:07 +03:00
< / 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" >
2024-02-01 10:15:38 +03:00
< / span > < span class = "ss" > extensions< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "p" data-group-id = "1239979443-4" > %{< / span > < span class = "p" data-group-id = "1239979443-4" > }< / span > < span class = "p" > ,< / span > < span class = "w" >
2023-07-12 11:28:07 +03:00
< / 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" >
2024-02-01 10:15:38 +03:00
< / span > < span class = "ss" > locale< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "p" data-group-id = "1239979443-5" > %{< / span > < span class = "p" data-group-id = "1239979443-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 = "1239979443-6" > [< / span > < span class = "p" data-group-id = "1239979443-6" > ]< / span > < span class = "p" > ,< / span > < span class = "w" >
2023-07-12 11:28:07 +03:00
< / 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" >
2024-02-01 10:15:38 +03:00
< / span > < span class = "ss" > transform< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "p" data-group-id = "1239979443-7" > %{< / span > < span class = "p" data-group-id = "1239979443-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 = "1239979443-8" > [< / span > < span class = "p" data-group-id = "1239979443-8" > ]< / span > < span class = "w" >
< / span > < span class = "p" data-group-id = "1239979443-3" > }< / span > < span class = "p" data-group-id = "1239979443-2" > }< / span > < span class = "w" >
2023-07-12 11:28:07 +03:00
2024-02-01 10:15:38 +03:00
< / 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 = "1239979443-9" > (< / span > < span class = "p" data-group-id = "1239979443-9" > )< / span > < span class = "w" >
< / span > < span class = "p" data-group-id = "1239979443-10" > {< / span > < span class = "ss" > :ok< / span > < span class = "p" > ,< / span > < span class = "w" >
< / span > < span class = "p" data-group-id = "1239979443-11" > %< / span > < span class = "nc" data-group-id = "1239979443-11" > Cldr.LanguageTag< / span > < span class = "p" data-group-id = "1239979443-11" > {< / span > < span class = "w" >
2023-07-12 11:28:07 +03:00
< / 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" >
2024-02-01 10:15:38 +03:00
< / span > < span class = "ss" > extensions< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "p" data-group-id = "1239979443-12" > %{< / span > < span class = "p" data-group-id = "1239979443-12" > }< / span > < span class = "p" > ,< / span > < span class = "w" >
2023-07-12 11:28:07 +03:00
< / 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" >
2024-02-01 10:15:38 +03:00
< / span > < span class = "ss" > locale< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "p" data-group-id = "1239979443-13" > %{< / span > < span class = "p" data-group-id = "1239979443-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 = "1239979443-14" > [< / span > < span class = "p" data-group-id = "1239979443-14" > ]< / span > < span class = "p" > ,< / span > < span class = "w" >
2023-07-12 11:28:07 +03:00
< / 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" >
2024-02-01 10:15:38 +03:00
< / span > < span class = "ss" > transform< / span > < span class = "p" > :< / span > < span class = "w" > < / span > < span class = "p" data-group-id = "1239979443-15" > %{< / span > < span class = "p" data-group-id = "1239979443-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 = "1239979443-16" > [< / span > < span class = "p" data-group-id = "1239979443-16" > ]< / span > < span class = "w" >
< / span > < span class = "p" data-group-id = "1239979443-11" > }< / span > < span class = "p" data-group-id = "1239979443-10" > }< / span > < span class = "w" >
2023-07-12 11:28:07 +03:00
2024-02-01 10:15:38 +03:00
< / 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 = "1239979443-17" > (< / span > < span class = "s" > " zzz" < / span > < span class = "p" data-group-id = "1239979443-17" > )< / span > < span class = "w" >
< / span > < span class = "p" data-group-id = "1239979443-18" > {< / span > < span class = "ss" > :error< / span > < span class = "p" > ,< / span > < span class = "w" > < / span > < span class = "p" data-group-id = "1239979443-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 = "1239979443-19" > }< / span > < span class = "p" data-group-id = "1239979443-18" > }< / span > < / code > < / pre >
2023-07-12 11:28:07 +03:00
< / section >
< / section >
< section class = "detail" id = "validate_number_system/1" >
< div class = "detail-header" >
< a href = "#validate_number_system/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" > validate_number_system(number_system)< / h1 >
< a href = "https://github.com/plausible/analytics/blob/main/lib/plausible/cldr.ex#L1" class = "icon-action" rel = "help" title = "View Source" >
< i class = "ri-code-s-slash-line" aria-hidden = "true" > < / i >
< span class = "sr-only" > View Source< / span >
< / a >
< / div >
< section class = "docstring" >
2024-01-11 10:50:44 +03:00
< p > See < a href = "https://hexdocs.pm/ex_cldr/2.37.5/Cldr.html#validate_number_system/1" > < code class = "inline" > Cldr.validate_number_system/1< / code > < / a > .< / p >
2023-07-12 11:28:07 +03:00
< / section >
< / section >
< section class = "detail" id = "validate_number_system_type/1" >
< div class = "detail-header" >
< a href = "#validate_number_system_type/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" > validate_number_system_type(number_system_type)< / h1 >
< a href = "https://github.com/plausible/analytics/blob/main/lib/plausible/cldr.ex#L1" class = "icon-action" rel = "help" title = "View Source" >
< i class = "ri-code-s-slash-line" aria-hidden = "true" > < / i >
< span class = "sr-only" > View Source< / span >
< / a >
< / div >
< section class = "docstring" >
< div class = "specs" >
< pre translate = "no" > < span class = "attribute" > @spec< / span > validate_number_system_type(< a href = "https://hexdocs.pm/elixir/String.html#t:t/0" > String.t< / a > () | < a href = "https://hexdocs.pm/elixir/typespecs.html#basic-types" > atom< / a > ()) ::
{:ok, < a href = "https://hexdocs.pm/elixir/typespecs.html#basic-types" > atom< / a > ()} | {:error, {< a href = "https://hexdocs.pm/elixir/typespecs.html#built-in-types" > module< / a > (), < a href = "https://hexdocs.pm/elixir/String.html#t:t/0" > String.t< / a > ()}}< / pre >
< / div >
< p > Normalise and validate a number system type.< / p > < h2 id = "validate_number_system_type/1-arguments" class = "section-heading" >
2024-01-11 10:50:44 +03:00
< a href = "#validate_number_system_type/1-arguments" class = "hover-link" >
2023-07-25 10:58:48 +03:00
< i class = "ri-link-m" aria-hidden = "true" > < / i >
2023-07-12 11:28:07 +03:00
< / a >
2024-01-11 10:50:44 +03:00
< span class = "text" > Arguments< / span >
2023-07-12 11:28:07 +03:00
< / h2 >
< ul > < li > < code class = "inline" > number_system_type< / code > is any number system type returned by
2024-01-11 10:50:44 +03:00
< a href = "https://hexdocs.pm/ex_cldr/2.37.5/Cldr.html#known_number_system_types/1" > < code class = "inline" > Cldr.known_number_system_types/1< / code > < / a > < / li > < / ul > < h2 id = "validate_number_system_type/1-returns" class = "section-heading" >
< a href = "#validate_number_system_type/1-returns" class = "hover-link" >
2023-07-25 10:58:48 +03:00
< i class = "ri-link-m" aria-hidden = "true" > < / i >
2023-07-12 11:28:07 +03:00
< / a >
2024-01-11 10:50:44 +03:00
< span class = "text" > Returns< / span >
2023-07-12 11:28:07 +03:00
< / h2 >
< ul > < li > < p > < code class = "inline" > {:ok, normalized_number_system_type}< / code > or< / p > < / li > < li > < p > < code class = "inline" > {:error, {exception, message}}< / code > < / p > < / li > < / ul > < h2 id = "validate_number_system_type/1-examples" class = "section-heading" >
2024-01-11 10:50:44 +03:00
< a href = "#validate_number_system_type/1-examples" class = "hover-link" >
2023-07-25 10:58:48 +03:00
< i class = "ri-link-m" aria-hidden = "true" > < / i >
2023-07-12 11:28:07 +03:00
< / a >
2024-01-11 10:50:44 +03:00
< span class = "text" > Examples< / span >
2023-07-12 11:28:07 +03:00
< / h2 >
2024-02-01 10:15:38 +03:00
< 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 = "0394859566-1" > (< / span > < span class = "ss" > :default< / span > < span class = "p" data-group-id = "0394859566-1" > )< / span > < span class = "w" >
< / span > < span class = "p" data-group-id = "0394859566-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 = "0394859566-2" > }< / span > < span class = "w" >
2023-07-12 11:28:07 +03:00
2024-02-01 10:15:38 +03:00
< / 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 = "0394859566-3" > (< / span > < span class = "ss" > :traditional< / span > < span class = "p" data-group-id = "0394859566-3" > )< / span > < span class = "w" >
< / span > < span class = "p" data-group-id = "0394859566-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 = "0394859566-4" > }< / span > < span class = "w" >
2023-07-12 11:28:07 +03:00
2024-02-01 10:15:38 +03:00
< / 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 = "0394859566-5" > (< / span > < span class = "ss" > :latn< / span > < span class = "p" data-group-id = "0394859566-5" > )< / span > < span class = "w" >
< / span > < span class = "p" data-group-id = "0394859566-6" > {< / span > < span class = "w" >
2023-07-12 11:28:07 +03:00
< / span > < span class = "ss" > :error< / span > < span class = "p" > ,< / span > < span class = "w" >
2024-02-01 10:15:38 +03:00
< / span > < span class = "p" data-group-id = "0394859566-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 = "0394859566-7" > }< / span > < span class = "w" >
< / span > < span class = "p" data-group-id = "0394859566-6" > }< / span > < span class = "w" >
2023-07-12 11:28:07 +03:00
2024-02-01 10:15:38 +03:00
< / 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 = "0394859566-8" > (< / span > < span class = "s" > " bork" < / span > < span class = "p" data-group-id = "0394859566-8" > )< / span > < span class = "w" >
< / span > < span class = "p" data-group-id = "0394859566-9" > {< / span > < span class = "w" >
2023-07-12 11:28:07 +03:00
< / span > < span class = "ss" > :error< / span > < span class = "p" > ,< / span > < span class = "w" >
2024-02-01 10:15:38 +03:00
< / span > < span class = "p" data-group-id = "0394859566-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 = "0394859566-10" > }< / span > < span class = "w" >
< / span > < span class = "p" data-group-id = "0394859566-9" > }< / span > < / code > < / pre >
2023-07-12 11:28:07 +03:00
< / section >
< / section >
< section class = "detail" id = "validate_territory/1" >
< div class = "detail-header" >
< a href = "#validate_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" > validate_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 >
< / div >
< section class = "docstring" >
2024-01-11 10:50:44 +03:00
< p > See < a href = "https://hexdocs.pm/ex_cldr/2.37.5/Cldr.html#validate_territory/1" > < code class = "inline" > Cldr.validate_territory/1< / code > < / a > .< / p >
2023-07-12 11:28:07 +03:00
< / section >
< / section >
< section class = "detail" id = "with_locale/2" >
< div class = "detail-header" >
< a href = "#with_locale/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" > with_locale(locale, fun)< / 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.32.0)< / span >
< / div >
< section class = "docstring" >
< div class = "specs" >
2024-01-11 10:50:44 +03:00
< pre translate = "no" > < span class = "attribute" > @spec< / span > with_locale(< a href = "https://hexdocs.pm/ex_cldr/2.37.5/Cldr.Locale.html#t:locale_reference/0" > Cldr.Locale.locale_reference< / a > (), (... -> < a href = "https://hexdocs.pm/elixir/typespecs.html#basic-types" > any< / a > ())) :: < a href = "https://hexdocs.pm/elixir/typespecs.html#basic-types" > any< / a > ()< / pre >
2023-07-12 11:28:07 +03:00
< / div >
< p > Execute a function with a locale ensuring that the
current locale is restored after the function.< / p > < h2 id = "with_locale/2-arguments" class = "section-heading" >
2024-01-11 10:50:44 +03:00
< a href = "#with_locale/2-arguments" class = "hover-link" >
2023-07-25 10:58:48 +03:00
< i class = "ri-link-m" aria-hidden = "true" > < / i >
2023-07-12 11:28:07 +03:00
< / a >
2024-01-11 10:50:44 +03:00
< span class = "text" > Arguments< / span >
2023-07-12 11:28:07 +03:00
< / h2 >
2024-01-11 10:50:44 +03:00
< ul > < li > < p > < code class = "inline" > locale< / code > is any valid locale name returned by < a href = "https://hexdocs.pm/ex_cldr/2.37.5/Cldr.html#known_locale_names/1" > < code class = "inline" > Cldr.known_locale_names/1< / code > < / a > .< / p > < / li > < li > < p > < code class = "inline" > fun< / code > is any 0-arity function or function capture.< / p > < / li > < / ul > < h2 id = "with_locale/2-returns" class = "section-heading" >
< a href = "#with_locale/2-returns" class = "hover-link" >
2023-07-25 10:58:48 +03:00
< i class = "ri-link-m" aria-hidden = "true" > < / i >
2023-07-12 11:28:07 +03:00
< / a >
2024-01-11 10:50:44 +03:00
< span class = "text" > Returns< / span >
2023-07-12 11:28:07 +03:00
< / h2 >
< ul > < li > < p > The value returned by the function < code class = "inline" > fun/0< / code > or< / p > < / li > < li > < p > < code class = "inline" > {:error, {exception, reason}}< / code > if the locale is invalid or< / p > < / li > < li > < p > raises an exception if the current locale cannot be
identified.< / p > < / li > < / ul >
< / section >
< / section >
< / div >
< / section >
< footer class = "footer" >
< p >
< span class = "line" >
< button class = "a-main footer-button display-quick-switch" title = "Search HexDocs packages" >
Search HexDocs
< / button >
< a href = "Plausible.epub" title = "ePub version" >
Download ePub version
< / a >
< / span >
< / p >
< p class = "built-using" >
Built using
2024-01-16 10:41:49 +03:00
< a href = "https://github.com/elixir-lang/ex_doc" title = "ExDoc" target = "_blank" rel = "help noopener" translate = "no" > ExDoc< / a > (v0.31.1) for the
2023-07-12 11:28:07 +03:00
< a href = "https://elixir-lang.org" title = "Elixir" target = "_blank" translate = "no" > Elixir programming language< / a >
< / p >
< / footer >
< / div >
< / div >
2024-01-11 10:50:44 +03:00
< / main >
2023-07-12 11:28:07 +03:00
< / div >
< script src = "https://cdn.jsdelivr.net/npm/mermaid/dist/mermaid.min.js" > < / script >
< script > mermaid . initialize ( { startOnLoad : true } ) < / script >
< / body >
< / html >