+ + + + + + View Source + + + ActivityPub.Federator.HTTP.RateLimit + (bonfire_umbrella v0.9.8-cooperation-beta.15) + +
+ + +Rate limit middleware for Tesla using Hammer
+Based on TeslaExtra.RateLimit
and TeslaExtra.RetryAfter
From f24e8d919a7162b361a77f36fbd46bac6285e0e3 Mon Sep 17 00:00:00 2001
From: mayel Rate limit middleware for Tesla using Hammer
+Based on Takes into account the Retry-After header returned by the server when the rate limit is exceeded. Based on Perform a DELETE request. See Perform a DELETE request. See Perform a DELETE request. See Perform a DELETE request. See Perform a GET request. See Perform a GET request. See Perform a GET request. See Perform a GET request. See Perform a HEAD request. See Perform a HEAD request. See Perform a HEAD request. See Perform a HEAD request. See Perform a OPTIONS request. See Perform a OPTIONS request. See Perform a OPTIONS request. See Perform a OPTIONS request. See Perform a PATCH request. See Perform a PATCH request. See Perform a PATCH request. See Perform a PATCH request. See Perform a POST request. See Perform a POST request. See Perform a POST request. See Perform a POST request. See Perform a PUT request. See Perform a PUT request. See Perform a PUT request. See Perform a PUT request. See Perform a TRACE request. See Perform a TRACE request. See Perform a TRACE request. See Perform a TRACE request. See ACLs represent fully populated access control rules that can be reused.
-Can be reused to secure multiple objects, thus exists independently of any object. The table doesn't have any fields of its own: The table doesn't have any fields of its own: Recursively merges two data structures ( Takes a tuple, an index and a fallback value and returns either the tuple value at that index (if not nil or false) or the fallback. If the tuple doesn't contain such an index, it raises Takes any element, an index and a fallback value. If the element is a Tuple it returns either the tuple value at that index, otherwise it returns the fallback. If the tuple doesn't contain such an index, it raises Merges two Merges two Recursively merges two data structures ( Deep merges a list of maps into a single map. Takes a tuple, an index and a fallback value and returns either the tuple value at that index (if not nil or false) or the fallback. If the tuple doesn't contain such an index, it raises Appends a value to a list, but only if the value is not nil or an empty list. Takes any element, an index and a fallback value. If the element is a Tuple it returns either the tuple value at that index, otherwise it returns the fallback. If the tuple doesn't contain such an index, it raises Merges two Merges two Anonymous functions are reported as -func/arity-anonfn-count-,
+ Anonymous functions are reported as -func/arity-anonfn-count-,
where func is the name of the enclosing function. Convert to
"anonymous fn in func/arity" The format of an Each language-range MAY be given an associated quality value which represents an
+ language-range = ( ( 1*8ALPHA *( "-" 1*8ALPHA ) ) | "*" ) Each language-range MAY be given an associated quality value which represents an
estimate of the user's preference for the languages specified by that range. The
quality value defaults to "q=1". For example, would mean: "I prefer Danish, but will accept British English and other types of English." MyApp.Cldr.Currency.currencies_for_locale("en")
=> {:ok,
- %{ MyApp.Cldr.Currency.currencies_for_locale!("en")
- => %{ } Cldr backend module that formats lists. If we have a list of days like Note that return value is not guaranteed to be a valid
+ Note that return value is not guaranteed to be a valid
number system for the given locale as demonstrated in the third example. To configure these transliteration pairs, add the to the Where each tuple in the list configures one transliteration map. In this example, two maps are
+ Where each tuple in the list configures one transliteration map. In this example, two maps are
configured: from A list of configurable number systems is returned by If a transliteration is requested between two number pairs that have not been configured for
precompilation, a warning is logged. Wrapping elements is particularly useful when formatting a number with a
currency symbol and the requirement is to have different HTML formatting
-applied to the symbol than the number. For example: It is also possible and recommended to use the It is also possible and recommended to use the When formatting a number the format is parsed into format elements that might include
+ When formatting a number the format is parsed into format elements that might include
a currency symbol, a literal string, inserted text between a currency symbol and the
currency amount, a percent sign, the number itself and several other elements. In
some cases it is helpful to be apply specific formatting to each element.
@@ -1162,80 +1162,80 @@ An error tuple Functions to implement the number system rule-based-number-format rules of CLDR. These rules are defined only on the "und" locale and represent specialised
number formatting. The standard public API for RBNF is via the The functions on this module are defined at compile time based upon the RBNF rules
-defined in the Unicode CLDR data repository. Available rules are identified by: A rule can then be invoked on an available rule_set. For example This particular call is equivalent to the call through the public API of: A rule can then be invoked on an available rule_set. For example This particular call is equivalent to the call through the public API of: Functions to implement the ordinal rule-based-number-format rules of CLDR. As CLDR notes, the data is incomplete or non-existent for many languages. It
is considered complete for English however. The standard public API for RBNF is via the The functions on this module are defined at compile time based upon the RBNF rules
-defined in the Unicode CLDR data repository. Available rules are identified by: A rule can then be invoked on an available rule_set. For example This call is equivalent to the call through the public API of: A rule can then be invoked on an available rule_set. For example This call is equivalent to the call through the public API of: Functions to implement the spellout rule-based-number-format rules of CLDR. As CLDR notes, the data is incomplete or non-existent for many languages. It
is considered complete for English however. The standard public API for RBNF is via the The functions on this module are defined at compile time based upon the RBNF rules
-defined in the Unicode CLDR data repository. Available rules are identified by: A rule can then be invoked on an available rule_set. For example: This call is equivalent to the call through the public API of: A rule can then be invoked on an available rule_set. For example: This call is equivalent to the call through the public API of: Returns either the Gettext Returns either the Gettext Returns a list of the known locale names. Known locales are those locales which
are the subset of all CLDR locales that
have been configured for use either
-in this module or in Callback implementation for Callback implementation for Callback implementation for Callback implementation for Callback implementation for Callback implementation for Callback implementation for Callback implementation for Callback implementation for Callback implementation for Callback implementation for Callback implementation for Callback implementation for Callback implementation for Callback implementation for Callback implementation for Callback implementation for Callback implementation for Callback implementation for Callback implementation for Callback implementation for Callback implementation for Callback implementation for Callback implementation for Callback implementation for Callback implementation for Callback implementation for Callback implementation for Callback implementation for Callback implementation for Callback implementation for Callback implementation for Callback implementation for Callback implementation for Callback implementation for Callback implementation for Callback implementation for Callback implementation for Callback implementation for Callback implementation for Callback implementation for Callback implementation for Callback implementation for Callback implementation for Callback implementation for Callback implementation for Callback implementation for Callback implementation for Callback implementation for Callback implementation for Callback implementation for Callback implementation for Callback implementation for Callback implementation for Callback implementation for Callback implementation for Callback implementation for Callback implementation for Callback implementation for Callback implementation for Callback implementation for Callback implementation for Callback implementation for Callback implementation for Callback implementation for Callback implementation for Callback implementation for Callback implementation for Callback implementation for Callback implementation for Callback implementation for Callback implementation for Callback implementation for Callback implementation for Callback implementation for Callback implementation for Callback implementation for Callback implementation for Callback implementation for Callback implementation for Callback implementation for Callback implementation for Callback implementation for Callback implementation for Callback implementation for Callback implementation for Callback implementation for Callback implementation for Callback implementation for Callback implementation for Callback implementation for Callback implementation for Callback implementation for Callback implementation for Callback implementation for Callback implementation for Callback implementation for Callback implementation for Callback implementation for Callback implementation for Callback implementation for Callback implementation for Callback implementation for Callback implementation for Callback implementation for Callback implementation for Callback implementation for Callback implementation for Callback implementation for Callback implementation for Callback implementation for Callback implementation for Callback implementation for Callback implementation for Callback implementation for Callback implementation for Callback implementation for Callback implementation for Callback implementation for Callback implementation for Callback implementation for Callback implementation for Callback implementation for Callback implementation for Callback implementation for Callback implementation for Callback implementation for Callback implementation for Callback implementation for Callback implementation for Callback implementation for Callback implementation for Callback implementation for Callback implementation for Callback implementation for Callback implementation for Callback implementation for Callback implementation for Callback implementation for Callback implementation for Callback implementation for Callback implementation for Callback implementation for Callback implementation for Callback implementation for Callback implementation for Callback implementation for Callback implementation for Callback implementation for Callback implementation for Callback implementation for Callback implementation for Callback implementation for Callback implementation for Callback implementation for Callback implementation for Callback implementation for Callback implementation for Callback implementation for Callback implementation for A convenience function for SQL-based repositories that forces all connections in the
-pool to disconnect within the given interval. See
determine_inbox(user, is_public, type, num_recipients)
-
+
View Source
@@ -259,7 +259,7 @@ determine_inbox(user, is_public, type, num_
gather_webfinger_links(actor)
-
+
View Source
@@ -303,7 +303,7 @@ is_representable?(activity)
maybe_federate_to_search_index(recipients, activity)
-
+
View Source
diff --git a/ActivityPub.Federator.Adapter.html b/ActivityPub.Federator.Adapter.html
index bf80fa362f2..61ad29fc271 100644
--- a/ActivityPub.Federator.Adapter.html
+++ b/ActivityPub.Federator.Adapter.html
@@ -13,7 +13,7 @@
-
+
diff --git a/ActivityPub.Federator.Fetcher.html b/ActivityPub.Federator.Fetcher.html
index b60ddca619b..4edd72342ce 100644
--- a/ActivityPub.Federator.Fetcher.html
+++ b/ActivityPub.Federator.Fetcher.html
@@ -13,7 +13,7 @@
-
+
diff --git a/ActivityPub.Federator.HTTP.Connection.html b/ActivityPub.Federator.HTTP.Connection.html
index c56197d3757..cf71b620b87 100644
--- a/ActivityPub.Federator.HTTP.Connection.html
+++ b/ActivityPub.Federator.HTTP.Connection.html
@@ -13,7 +13,7 @@
-
+
diff --git a/ActivityPub.Federator.HTTP.RateLimit.html b/ActivityPub.Federator.HTTP.RateLimit.html
new file mode 100644
index 00000000000..284073c6f22
--- /dev/null
+++ b/ActivityPub.Federator.HTTP.RateLimit.html
@@ -0,0 +1,176 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ View Source
+
+
+ ActivityPub.Federator.HTTP.RateLimit
+ (bonfire_umbrella v0.9.8-cooperation-beta.15)
+
+
+
+
+ TeslaExtra.RateLimit
and TeslaExtra.RetryAfter
+
+
+
+
+
+ View Source
+
+
+ ActivityPub.Federator.HTTP.RetryAfter
+ (bonfire_umbrella v0.9.8-cooperation-beta.15)
+
+
+
+
+ TeslaExtra.RetryAfter
delete(client, url, opts)
-request/1
or request/2
for options definition.
+delete("/users")
-delete("/users", query: [scope: "admin"])
-delete(client, "/users")
-delete(client, "/users", query: [scope: "admin"])
-delete(client, "/users", body: %{name: "Jon"})
request/1
or request/2
for options definition.delete("/users")
+delete("/users", query: [scope: "admin"])
+delete(client, "/users")
+delete(client, "/users", query: [scope: "admin"])
+delete(client, "/users", body: %{name: "Jon"})
delete!(client, url, opts)
-request!/1
or request!/2
for options definition.
+delete!("/users")
-delete!("/users", query: [scope: "admin"])
-delete!(client, "/users")
-delete!(client, "/users", query: [scope: "admin"])
-delete!(client, "/users", body: %{name: "Jon"})
request!/1
or request!/2
for options definition.delete!("/users")
+delete!("/users", query: [scope: "admin"])
+delete!(client, "/users")
+delete!(client, "/users", query: [scope: "admin"])
+delete!(client, "/users", body: %{name: "Jon"})
get(client, url, opts)
-request/1
or request/2
for options definition.
+get("/users")
-get("/users", query: [scope: "admin"])
-get(client, "/users")
-get(client, "/users", query: [scope: "admin"])
-get(client, "/users", body: %{name: "Jon"})
request/1
or request/2
for options definition.get("/users")
+get("/users", query: [scope: "admin"])
+get(client, "/users")
+get(client, "/users", query: [scope: "admin"])
+get(client, "/users", body: %{name: "Jon"})
get!(client, url, opts)
-request!/1
or request!/2
for options definition.
+get!("/users")
-get!("/users", query: [scope: "admin"])
-get!(client, "/users")
-get!(client, "/users", query: [scope: "admin"])
-get!(client, "/users", body: %{name: "Jon"})
request!/1
or request!/2
for options definition.get!("/users")
+get!("/users", query: [scope: "admin"])
+get!(client, "/users")
+get!(client, "/users", query: [scope: "admin"])
+get!(client, "/users", body: %{name: "Jon"})
head(client, url, opts)
-request/1
or request/2
for options definition.
+head("/users")
-head("/users", query: [scope: "admin"])
-head(client, "/users")
-head(client, "/users", query: [scope: "admin"])
-head(client, "/users", body: %{name: "Jon"})
request/1
or request/2
for options definition.head("/users")
+head("/users", query: [scope: "admin"])
+head(client, "/users")
+head(client, "/users", query: [scope: "admin"])
+head(client, "/users", body: %{name: "Jon"})
head!(client, url, opts)
-request!/1
or request!/2
for options definition.
+head!("/users")
-head!("/users", query: [scope: "admin"])
-head!(client, "/users")
-head!(client, "/users", query: [scope: "admin"])
-head!(client, "/users", body: %{name: "Jon"})
request!/1
or request!/2
for options definition.head!("/users")
+head!("/users", query: [scope: "admin"])
+head!(client, "/users")
+head!(client, "/users", query: [scope: "admin"])
+head!(client, "/users", body: %{name: "Jon"})
options(client, url, opts)
-request/1
or request/2
for options definition.
+options("/users")
-options("/users", query: [scope: "admin"])
-options(client, "/users")
-options(client, "/users", query: [scope: "admin"])
-options(client, "/users", body: %{name: "Jon"})
request/1
or request/2
for options definition.options("/users")
+options("/users", query: [scope: "admin"])
+options(client, "/users")
+options(client, "/users", query: [scope: "admin"])
+options(client, "/users", body: %{name: "Jon"})
options!(client, url, opts)
-request!/1
or request!/2
for options definition.
+options!("/users")
-options!("/users", query: [scope: "admin"])
-options!(client, "/users")
-options!(client, "/users", query: [scope: "admin"])
-options!(client, "/users", body: %{name: "Jon"})
request!/1
or request!/2
for options definition.options!("/users")
+options!("/users", query: [scope: "admin"])
+options!(client, "/users")
+options!(client, "/users", query: [scope: "admin"])
+options!(client, "/users", body: %{name: "Jon"})
patch(client, url, body, opts)
-request/1
or request/2
for options definition.
+patch("/users", %{name: "Jon"})
-patch("/users", %{name: "Jon"}, query: [scope: "admin"])
-patch(client, "/users", %{name: "Jon"})
-patch(client, "/users", %{name: "Jon"}, query: [scope: "admin"])
request/1
or request/2
for options definition.patch("/users", %{name: "Jon"})
+patch("/users", %{name: "Jon"}, query: [scope: "admin"])
+patch(client, "/users", %{name: "Jon"})
+patch(client, "/users", %{name: "Jon"}, query: [scope: "admin"])
patch!(client, url, body, opts)
-request!/1
or request!/2
for options definition.
+patch!("/users", %{name: "Jon"})
-patch!("/users", %{name: "Jon"}, query: [scope: "admin"])
-patch!(client, "/users", %{name: "Jon"})
-patch!(client, "/users", %{name: "Jon"}, query: [scope: "admin"])
request!/1
or request!/2
for options definition.patch!("/users", %{name: "Jon"})
+patch!("/users", %{name: "Jon"}, query: [scope: "admin"])
+patch!(client, "/users", %{name: "Jon"})
+patch!(client, "/users", %{name: "Jon"}, query: [scope: "admin"])
post(client, url, body, opts)
-request/1
or request/2
for options definition.
+post("/users", %{name: "Jon"})
-post("/users", %{name: "Jon"}, query: [scope: "admin"])
-post(client, "/users", %{name: "Jon"})
-post(client, "/users", %{name: "Jon"}, query: [scope: "admin"])
request/1
or request/2
for options definition.post("/users", %{name: "Jon"})
+post("/users", %{name: "Jon"}, query: [scope: "admin"])
+post(client, "/users", %{name: "Jon"})
+post(client, "/users", %{name: "Jon"}, query: [scope: "admin"])
post!(client, url, body, opts)
-request!/1
or request!/2
for options definition.
+post!("/users", %{name: "Jon"})
-post!("/users", %{name: "Jon"}, query: [scope: "admin"])
-post!(client, "/users", %{name: "Jon"})
-post!(client, "/users", %{name: "Jon"}, query: [scope: "admin"])
request!/1
or request!/2
for options definition.post!("/users", %{name: "Jon"})
+post!("/users", %{name: "Jon"}, query: [scope: "admin"])
+post!(client, "/users", %{name: "Jon"})
+post!(client, "/users", %{name: "Jon"}, query: [scope: "admin"])
put(client, url, body, opts)
-request/1
or request/2
for options definition.
+put("/users", %{name: "Jon"})
-put("/users", %{name: "Jon"}, query: [scope: "admin"])
-put(client, "/users", %{name: "Jon"})
-put(client, "/users", %{name: "Jon"}, query: [scope: "admin"])
request/1
or request/2
for options definition.put("/users", %{name: "Jon"})
+put("/users", %{name: "Jon"}, query: [scope: "admin"])
+put(client, "/users", %{name: "Jon"})
+put(client, "/users", %{name: "Jon"}, query: [scope: "admin"])
put!(client, url, body, opts)
-request!/1
or request!/2
for options definition.
+put!("/users", %{name: "Jon"})
-put!("/users", %{name: "Jon"}, query: [scope: "admin"])
-put!(client, "/users", %{name: "Jon"})
-put!(client, "/users", %{name: "Jon"}, query: [scope: "admin"])
request!/1
or request!/2
for options definition.put!("/users", %{name: "Jon"})
+put!("/users", %{name: "Jon"}, query: [scope: "admin"])
+put!(client, "/users", %{name: "Jon"})
+put!(client, "/users", %{name: "Jon"}, query: [scope: "admin"])
request(client \\ %Tesla.Client{}, options)
Examples
-
ExampleApi.request(method: :get, url: "/users/path")
+
+ExampleApi.get("/users/1")
+ExampleApi.post(client, "/users", %{name: "Jon"})ExampleApi.request(method: :get, url: "/users/path")
# use shortcut methods
-ExampleApi.get("/users/1")
-ExampleApi.post(client, "/users", %{name: "Jon"})
trace(client, url, opts)
-request/1
or request/2
for options definition.
+trace("/users")
-trace("/users", query: [scope: "admin"])
-trace(client, "/users")
-trace(client, "/users", query: [scope: "admin"])
-trace(client, "/users", body: %{name: "Jon"})
request/1
or request/2
for options definition.trace("/users")
+trace("/users", query: [scope: "admin"])
+trace(client, "/users")
+trace(client, "/users", query: [scope: "admin"])
+trace(client, "/users", body: %{name: "Jon"})
trace!(client, url, opts)
-request!/1
or request!/2
for options definition.
+trace!("/users")
-trace!("/users", query: [scope: "admin"])
-trace!(client, "/users")
-trace!(client, "/users", query: [scope: "admin"])
-trace!(client, "/users", body: %{name: "Jon"})
request!/1
or request!/2
for options definition.trace!("/users")
+trace!("/users", query: [scope: "admin"])
+trace!(client, "/users")
+trace!(client, "/users", query: [scope: "admin"])
+trace!(client, "/users", body: %{name: "Jon"})
delete(url, body \\ "", headers \\ [], options \\ [])
-
+
View Source
@@ -311,7 +311,7 @@ delete(url, body \\ "", headers \
get(url, headers \\ [], options \\ [])
-
+
View Source
@@ -369,7 +369,7 @@ http_request(method, url, body \\ "&qu
post(url, body, headers \\ [], options \\ [])
-
+
View Source
@@ -395,7 +395,7 @@ post(url, body, headers \\ [], options \\ [
put(url, body, headers \\ [], options \\ [])
-
+
View Source
diff --git a/ActivityPub.Federator.Publisher.html b/ActivityPub.Federator.Publisher.html
index 1b601993981..e3c96436976 100644
--- a/ActivityPub.Federator.Publisher.html
+++ b/ActivityPub.Federator.Publisher.html
@@ -13,7 +13,7 @@
-
+
diff --git a/ActivityPub.Federator.Transformer.html b/ActivityPub.Federator.Transformer.html
index 900edb0bc0f..294cd70f839 100644
--- a/ActivityPub.Federator.Transformer.html
+++ b/ActivityPub.Federator.Transformer.html
@@ -13,7 +13,7 @@
-
+
diff --git a/ActivityPub.Federator.WebFinger.html b/ActivityPub.Federator.WebFinger.html
index de1987dfd0b..4bc36a24451 100644
--- a/ActivityPub.Federator.WebFinger.html
+++ b/ActivityPub.Federator.WebFinger.html
@@ -13,7 +13,7 @@
-
+
diff --git a/ActivityPub.Federator.Worker.html b/ActivityPub.Federator.Worker.html
index 2ffb2419edc..6a1eb2113f9 100644
--- a/ActivityPub.Federator.Worker.html
+++ b/ActivityPub.Federator.Worker.html
@@ -13,7 +13,7 @@
-
+
diff --git a/ActivityPub.Federator.Workers.PublisherWorker.html b/ActivityPub.Federator.Workers.PublisherWorker.html
index 20cde07c9d9..fe36be72b7c 100644
--- a/ActivityPub.Federator.Workers.PublisherWorker.html
+++ b/ActivityPub.Federator.Workers.PublisherWorker.html
@@ -13,7 +13,7 @@
-
+
diff --git a/ActivityPub.Federator.Workers.ReceiverWorker.html b/ActivityPub.Federator.Workers.ReceiverWorker.html
index b6ac556e1fc..d0a20c0e430 100644
--- a/ActivityPub.Federator.Workers.ReceiverWorker.html
+++ b/ActivityPub.Federator.Workers.ReceiverWorker.html
@@ -13,7 +13,7 @@
-
+
diff --git a/ActivityPub.Federator.Workers.RemoteFetcherWorker.html b/ActivityPub.Federator.Workers.RemoteFetcherWorker.html
index f873eb6b707..8befa14ac20 100644
--- a/ActivityPub.Federator.Workers.RemoteFetcherWorker.html
+++ b/ActivityPub.Federator.Workers.RemoteFetcherWorker.html
@@ -13,7 +13,7 @@
-
+
diff --git a/ActivityPub.Federator.html b/ActivityPub.Federator.html
index 0f5ebf75cad..4c23529f396 100644
--- a/ActivityPub.Federator.html
+++ b/ActivityPub.Federator.html
@@ -13,7 +13,7 @@
-
+
diff --git a/ActivityPub.Fixtures.html b/ActivityPub.Fixtures.html
index 678cdd1dbb8..54f906a759a 100644
--- a/ActivityPub.Fixtures.html
+++ b/ActivityPub.Fixtures.html
@@ -13,7 +13,7 @@
-
+
diff --git a/ActivityPub.Instances.Instance.html b/ActivityPub.Instances.Instance.html
index 303373a5bc0..50cb8513a6b 100644
--- a/ActivityPub.Instances.Instance.html
+++ b/ActivityPub.Instances.Instance.html
@@ -13,7 +13,7 @@
-
+
diff --git a/ActivityPub.Instances.html b/ActivityPub.Instances.html
index 9b6a640cb3a..0140de1cae5 100644
--- a/ActivityPub.Instances.html
+++ b/ActivityPub.Instances.html
@@ -13,7 +13,7 @@
-
+
diff --git a/ActivityPub.MRF.SimplePolicy.html b/ActivityPub.MRF.SimplePolicy.html
index c18659489bc..a35f18d08cd 100644
--- a/ActivityPub.MRF.SimplePolicy.html
+++ b/ActivityPub.MRF.SimplePolicy.html
@@ -13,7 +13,7 @@
-
+
diff --git a/ActivityPub.MRF.html b/ActivityPub.MRF.html
index 9dd026eedcd..b8e5aa0bc06 100644
--- a/ActivityPub.MRF.html
+++ b/ActivityPub.MRF.html
@@ -13,7 +13,7 @@
-
+
diff --git a/ActivityPub.Object.html b/ActivityPub.Object.html
index 096f2154aee..f120a833e82 100644
--- a/ActivityPub.Object.html
+++ b/ActivityPub.Object.html
@@ -13,7 +13,7 @@
-
+
diff --git a/ActivityPub.Pruner.PruneDatabaseWorker.html b/ActivityPub.Pruner.PruneDatabaseWorker.html
index 7c146dcc31c..14a22d5cae6 100644
--- a/ActivityPub.Pruner.PruneDatabaseWorker.html
+++ b/ActivityPub.Pruner.PruneDatabaseWorker.html
@@ -13,7 +13,7 @@
-
+
diff --git a/ActivityPub.Pruner.html b/ActivityPub.Pruner.html
index b1021080b4b..988bc7cb6db 100644
--- a/ActivityPub.Pruner.html
+++ b/ActivityPub.Pruner.html
@@ -13,7 +13,7 @@
-
+
diff --git a/ActivityPub.Queries.html b/ActivityPub.Queries.html
index 587c20ec218..29e403e7f2f 100644
--- a/ActivityPub.Queries.html
+++ b/ActivityPub.Queries.html
@@ -13,7 +13,7 @@
-
+
@@ -321,7 +321,7 @@ query()
@type query() :: Ecto.Queryable.t() | ActivityPub.Object.t()
+ @type query() :: Ecto.Queryable.t() | ActivityPub.Object.t()
actor(conn, map)
-
+
View Source
@@ -277,7 +277,7 @@ actor(conn, map)
ap_route_helper(uuid)
-
+
View Source
@@ -299,7 +299,7 @@ ap_route_helper(uuid)
followers(conn, map)
-
+
View Source
@@ -321,7 +321,7 @@ followers(conn, map)
following(conn, map)
-
+
View Source
@@ -343,7 +343,7 @@ following(conn, map)
inbox(conn, params)
-
+
View Source
@@ -365,7 +365,7 @@ inbox(conn, params)
inbox_info(conn, params)
-
+
View Source
@@ -391,7 +391,7 @@ inbox_info(conn, params)
json_object_with_cache(conn \\ nil, id, opts \\ [])
-
+
View Source
@@ -413,7 +413,7 @@ json_object_with_cache(conn \\ nil, id, opt
noop(conn, params)
-
+
View Source
@@ -435,7 +435,7 @@ noop(conn, params)
object(conn, map)
-
+
View Source
@@ -457,7 +457,7 @@ object(conn, map)
outbox(conn, map)
-
+
View Source
diff --git a/ActivityPub.Web.ActorView.html b/ActivityPub.Web.ActorView.html
index dd94a8fad6d..b2eeb5fa401 100644
--- a/ActivityPub.Web.ActorView.html
+++ b/ActivityPub.Web.ActorView.html
@@ -13,7 +13,7 @@
-
+
diff --git a/ActivityPub.Web.Endpoint.html b/ActivityPub.Web.Endpoint.html
index 66a72a4aedf..34737fbcbc6 100644
--- a/ActivityPub.Web.Endpoint.html
+++ b/ActivityPub.Web.Endpoint.html
@@ -13,7 +13,7 @@
-
+
diff --git a/ActivityPub.Web.ErrorHelpers.html b/ActivityPub.Web.ErrorHelpers.html
index 63482ef30bc..e8f0bd7a1f9 100644
--- a/ActivityPub.Web.ErrorHelpers.html
+++ b/ActivityPub.Web.ErrorHelpers.html
@@ -13,7 +13,7 @@
-
+
diff --git a/ActivityPub.Web.ErrorView.html b/ActivityPub.Web.ErrorView.html
index 45f644397b0..526de7a0fd9 100644
--- a/ActivityPub.Web.ErrorView.html
+++ b/ActivityPub.Web.ErrorView.html
@@ -13,7 +13,7 @@
-
+
diff --git a/ActivityPub.Web.LayoutView.html b/ActivityPub.Web.LayoutView.html
index 4e8705e3d77..83b2ce1279e 100644
--- a/ActivityPub.Web.LayoutView.html
+++ b/ActivityPub.Web.LayoutView.html
@@ -13,7 +13,7 @@
-
+
diff --git a/ActivityPub.Web.ObjectView.html b/ActivityPub.Web.ObjectView.html
index aac3dabbdc6..ca875d7f01b 100644
--- a/ActivityPub.Web.ObjectView.html
+++ b/ActivityPub.Web.ObjectView.html
@@ -13,7 +13,7 @@
-
+
diff --git a/ActivityPub.Web.Plugs.DigestPlug.html b/ActivityPub.Web.Plugs.DigestPlug.html
index 2ad79180ad0..299ae1212b3 100644
--- a/ActivityPub.Web.Plugs.DigestPlug.html
+++ b/ActivityPub.Web.Plugs.DigestPlug.html
@@ -13,7 +13,7 @@
-
+
diff --git a/ActivityPub.Web.Plugs.EnsureHTTPSignaturePlug.html b/ActivityPub.Web.Plugs.EnsureHTTPSignaturePlug.html
index 739b51250ab..f6d86d06439 100644
--- a/ActivityPub.Web.Plugs.EnsureHTTPSignaturePlug.html
+++ b/ActivityPub.Web.Plugs.EnsureHTTPSignaturePlug.html
@@ -13,7 +13,7 @@
-
+
diff --git a/ActivityPub.Web.Plugs.EnsurePublicOrAuthenticatedPlug.html b/ActivityPub.Web.Plugs.EnsurePublicOrAuthenticatedPlug.html
index 6652584baf1..35a18ddb87a 100644
--- a/ActivityPub.Web.Plugs.EnsurePublicOrAuthenticatedPlug.html
+++ b/ActivityPub.Web.Plugs.EnsurePublicOrAuthenticatedPlug.html
@@ -13,7 +13,7 @@
-
+
diff --git a/ActivityPub.Web.Plugs.HTTPSignaturePlug.html b/ActivityPub.Web.Plugs.HTTPSignaturePlug.html
index 14fbc33d3b4..507c38267fe 100644
--- a/ActivityPub.Web.Plugs.HTTPSignaturePlug.html
+++ b/ActivityPub.Web.Plugs.HTTPSignaturePlug.html
@@ -13,7 +13,7 @@
-
+
diff --git a/ActivityPub.Web.Plugs.MappedSignatureToIdentityPlug.html b/ActivityPub.Web.Plugs.MappedSignatureToIdentityPlug.html
index 840b22cfec6..61263819b97 100644
--- a/ActivityPub.Web.Plugs.MappedSignatureToIdentityPlug.html
+++ b/ActivityPub.Web.Plugs.MappedSignatureToIdentityPlug.html
@@ -13,7 +13,7 @@
-
+
diff --git a/ActivityPub.Web.RedirectController.html b/ActivityPub.Web.RedirectController.html
index 117a03e814b..18b003c1daf 100644
--- a/ActivityPub.Web.RedirectController.html
+++ b/ActivityPub.Web.RedirectController.html
@@ -13,7 +13,7 @@
-
+
@@ -195,7 +195,7 @@
actor(conn, map)
-
+
View Source
@@ -217,7 +217,7 @@ actor(conn, map)
object(conn, map)
-
+
View Source
@@ -239,7 +239,7 @@ object(conn, map)
remote_interaction(conn, params)
-
+
View Source
diff --git a/ActivityPub.Web.Router.html b/ActivityPub.Web.Router.html
index 05698b75177..1a9cab89714 100644
--- a/ActivityPub.Web.Router.html
+++ b/ActivityPub.Web.Router.html
@@ -13,7 +13,7 @@
-
+
diff --git a/ActivityPub.Web.Telemetry.html b/ActivityPub.Web.Telemetry.html
index 41f875f252c..7666b84c1f3 100644
--- a/ActivityPub.Web.Telemetry.html
+++ b/ActivityPub.Web.Telemetry.html
@@ -13,7 +13,7 @@
-
+
diff --git a/ActivityPub.Web.UserSocket.html b/ActivityPub.Web.UserSocket.html
index 3c41b65aefb..7bb238344c1 100644
--- a/ActivityPub.Web.UserSocket.html
+++ b/ActivityPub.Web.UserSocket.html
@@ -13,7 +13,7 @@
-
+
diff --git a/ActivityPub.Web.WebFingerController.html b/ActivityPub.Web.WebFingerController.html
index 197da1bafec..0e222a84f49 100644
--- a/ActivityPub.Web.WebFingerController.html
+++ b/ActivityPub.Web.WebFingerController.html
@@ -13,7 +13,7 @@
-
+
@@ -179,7 +179,7 @@
webfinger(conn, map)
-
+
View Source
diff --git a/ActivityPub.Web.html b/ActivityPub.Web.html
index 3fa0cb0f40e..3183aab2710 100644
--- a/ActivityPub.Web.html
+++ b/ActivityPub.Web.html
@@ -13,7 +13,7 @@
-
+
@@ -193,6 +193,14 @@
+
__using__(which)
-
+
View Source
@@ -255,7 +263,7 @@ __using__(which)
base_url()
-
+
View Source
@@ -277,7 +285,7 @@ base_url()
channel()
-
+
View Source
@@ -299,7 +307,29 @@ channel()
controller()
-
+
+
+ View Source
+
+
+
+ rate_limit_reached(conn, opts)
+
+
View Source
@@ -321,7 +351,7 @@ controller()
router()
-
+
View Source
@@ -343,7 +373,7 @@ router()
view()
-
+
View Source
diff --git a/ActivityPub.html b/ActivityPub.html
index 89ad0740f25..407f17c5eb0 100644
--- a/ActivityPub.html
+++ b/ActivityPub.html
@@ -13,7 +13,7 @@
-
+
diff --git a/AnimalAvatarGenerator.html b/AnimalAvatarGenerator.html
index 24266cd53f7..58ab393b40d 100644
--- a/AnimalAvatarGenerator.html
+++ b/AnimalAvatarGenerator.html
@@ -13,7 +13,7 @@
-
+
diff --git a/Arrows.html b/Arrows.html
index ac018a53ac8..88b8e0f15b4 100644
--- a/Arrows.html
+++ b/Arrows.html
@@ -13,7 +13,7 @@
-
+
diff --git a/Bonfire.Boundaries.Acls.html b/Bonfire.Boundaries.Acls.html
index 72a29c49aef..f21829b5053 100644
--- a/Bonfire.Boundaries.Acls.html
+++ b/Bonfire.Boundaries.Acls.html
@@ -13,7 +13,7 @@
-
+
@@ -138,8 +138,8 @@
+Can be reused to secure multiple objects, thus exists independently of any object.has_many(:grants, Grant)
-has_many(:controlled, Controlled)
has_many(:grants, Grant)
+has_many(:controlled, Controlled)
custom_acl()
global_circles()
insert()
-
+
View Source
diff --git a/Bonfire.Boundaries.Grants.html b/Bonfire.Boundaries.Grants.html
index 23e6f244f8f..bce5af6771e 100644
--- a/Bonfire.Boundaries.Grants.html
+++ b/Bonfire.Boundaries.Grants.html
@@ -13,7 +13,7 @@
-
+
diff --git a/Bonfire.Boundaries.Integration.html b/Bonfire.Boundaries.Integration.html
index 9173d0eb2f2..8227a3a226e 100644
--- a/Bonfire.Boundaries.Integration.html
+++ b/Bonfire.Boundaries.Integration.html
@@ -13,7 +13,7 @@
-
+
diff --git a/Bonfire.Boundaries.LiveHandler.html b/Bonfire.Boundaries.LiveHandler.html
index f1b8e6cb8d1..612c06ac2aa 100644
--- a/Bonfire.Boundaries.LiveHandler.html
+++ b/Bonfire.Boundaries.LiveHandler.html
@@ -13,7 +13,7 @@
-
+
diff --git a/Bonfire.Boundaries.Queries.html b/Bonfire.Boundaries.Queries.html
index 52e243726d1..f6b255e3c01 100644
--- a/Bonfire.Boundaries.Queries.html
+++ b/Bonfire.Boundaries.Queries.html
@@ -13,7 +13,7 @@
-
+
diff --git a/Bonfire.Boundaries.Roles.html b/Bonfire.Boundaries.Roles.html
index ed379dc0df7..01ac1b60e66 100644
--- a/Bonfire.Boundaries.Roles.html
+++ b/Bonfire.Boundaries.Roles.html
@@ -13,7 +13,7 @@
-
+
@@ -283,7 +283,7 @@
cannot_role_from_verb(verbs, verb_field \\ :verb, all_role_verbs \\ role_verbs(:all), role_for_all \\ :read, verbs_field \\ :cannot_verbs)
-
+
View Source
@@ -305,7 +305,7 @@ cannot_role_from_verb(verbs, verb_field \\
create(attrs, opts)
-
+
View Source
@@ -327,7 +327,7 @@ create(attrs, opts)
create(name, usage, opts)
-
+
View Source
@@ -349,7 +349,7 @@ create(name, usage, opts)
edit_verb_permission(role_name, verb, value, opts)
-
+
View Source
@@ -395,7 +395,7 @@ get(role_name, opts \\ [])
preset_boundary_role_from_acl(summary)
-
+
View Source
@@ -417,7 +417,7 @@ preset_boundary_role_from_acl(summary)
reset_instance_roles()
-
+
View Source
@@ -469,7 +469,7 @@ role_from_grants(grants, opts)
role_from_verb(verbs, verb_field \\ :verb, all_role_verbs \\ role_verbs(:all), role_for_all \\ :administer, verbs_field \\ :can_verbs)
-
+
View Source
@@ -541,7 +541,7 @@ roles_for_dropdown(usage \\ nil, opts)
split_tuples_can_cannot(tuples)
-
+
View Source
@@ -565,7 +565,7 @@ split_tuples_can_cannot(tuples)
verbs_for_role(role, opts \\ [])
-
+
View Source
diff --git a/Bonfire.Boundaries.RuntimeConfig.html b/Bonfire.Boundaries.RuntimeConfig.html
index ec52f39c031..2d6c9b2c1b1 100644
--- a/Bonfire.Boundaries.RuntimeConfig.html
+++ b/Bonfire.Boundaries.RuntimeConfig.html
@@ -13,7 +13,7 @@
-
+
diff --git a/Bonfire.Boundaries.Summary.html b/Bonfire.Boundaries.Summary.html
index 44aa04f83fd..62fa5a91d91 100644
--- a/Bonfire.Boundaries.Summary.html
+++ b/Bonfire.Boundaries.Summary.html
@@ -13,7 +13,7 @@
-
+
diff --git a/Bonfire.Boundaries.Users.html b/Bonfire.Boundaries.Users.html
index 9f89a2a99e0..aefea8094a8 100644
--- a/Bonfire.Boundaries.Users.html
+++ b/Bonfire.Boundaries.Users.html
@@ -13,7 +13,7 @@
-
+
diff --git a/Bonfire.Boundaries.Verbs.html b/Bonfire.Boundaries.Verbs.html
index 14a4d54cc27..b1114ea7ee3 100644
--- a/Bonfire.Boundaries.Verbs.html
+++ b/Bonfire.Boundaries.Verbs.html
@@ -13,7 +13,7 @@
-
+
diff --git a/Bonfire.Boundaries.Web.AclLive.LiveViewNativeWeb.html b/Bonfire.Boundaries.Web.AclLive.LiveViewNativeWeb.html
index 3a44e43b323..484da8dce93 100644
--- a/Bonfire.Boundaries.Web.AclLive.LiveViewNativeWeb.html
+++ b/Bonfire.Boundaries.Web.AclLive.LiveViewNativeWeb.html
@@ -13,7 +13,7 @@
-
+
diff --git a/Bonfire.Boundaries.Web.AclModalLive.LiveViewNativeWeb.html b/Bonfire.Boundaries.Web.AclModalLive.LiveViewNativeWeb.html
index e0440dce99f..0f2857038ef 100644
--- a/Bonfire.Boundaries.Web.AclModalLive.LiveViewNativeWeb.html
+++ b/Bonfire.Boundaries.Web.AclModalLive.LiveViewNativeWeb.html
@@ -13,7 +13,7 @@
-
+
diff --git a/Bonfire.Boundaries.Web.AddToCircleLive.LiveViewNativeWeb.html b/Bonfire.Boundaries.Web.AddToCircleLive.LiveViewNativeWeb.html
index 2293eee6a01..abb7d400306 100644
--- a/Bonfire.Boundaries.Web.AddToCircleLive.LiveViewNativeWeb.html
+++ b/Bonfire.Boundaries.Web.AddToCircleLive.LiveViewNativeWeb.html
@@ -13,7 +13,7 @@
-
+
diff --git a/Bonfire.Boundaries.Web.AddToCircleWidgetLive.LiveViewNativeWeb.html b/Bonfire.Boundaries.Web.AddToCircleWidgetLive.LiveViewNativeWeb.html
index 9ef385f776c..5c45fcda0c8 100644
--- a/Bonfire.Boundaries.Web.AddToCircleWidgetLive.LiveViewNativeWeb.html
+++ b/Bonfire.Boundaries.Web.AddToCircleWidgetLive.LiveViewNativeWeb.html
@@ -13,7 +13,7 @@
-
+
diff --git a/Bonfire.Boundaries.Web.BlockButtonLive.LiveViewNativeWeb.html b/Bonfire.Boundaries.Web.BlockButtonLive.LiveViewNativeWeb.html
index 597a8efd81b..9ec3165fd2c 100644
--- a/Bonfire.Boundaries.Web.BlockButtonLive.LiveViewNativeWeb.html
+++ b/Bonfire.Boundaries.Web.BlockButtonLive.LiveViewNativeWeb.html
@@ -13,7 +13,7 @@
-
+
diff --git a/Bonfire.Boundaries.Web.BlockMenuButtonsLive.LiveViewNativeWeb.html b/Bonfire.Boundaries.Web.BlockMenuButtonsLive.LiveViewNativeWeb.html
index 565f1f610e6..075ef8ec878 100644
--- a/Bonfire.Boundaries.Web.BlockMenuButtonsLive.LiveViewNativeWeb.html
+++ b/Bonfire.Boundaries.Web.BlockMenuButtonsLive.LiveViewNativeWeb.html
@@ -13,7 +13,7 @@
-
+
diff --git a/Bonfire.Boundaries.Web.BlocksLive.LiveViewNativeWeb.html b/Bonfire.Boundaries.Web.BlocksLive.LiveViewNativeWeb.html
index 6b232cfce97..9bcb54b4fd2 100644
--- a/Bonfire.Boundaries.Web.BlocksLive.LiveViewNativeWeb.html
+++ b/Bonfire.Boundaries.Web.BlocksLive.LiveViewNativeWeb.html
@@ -13,7 +13,7 @@
-
+
diff --git a/Bonfire.Boundaries.Web.BoundariesDropdownLive.LiveViewNativeWeb.html b/Bonfire.Boundaries.Web.BoundariesDropdownLive.LiveViewNativeWeb.html
index 602229fa99f..955af674c04 100644
--- a/Bonfire.Boundaries.Web.BoundariesDropdownLive.LiveViewNativeWeb.html
+++ b/Bonfire.Boundaries.Web.BoundariesDropdownLive.LiveViewNativeWeb.html
@@ -13,7 +13,7 @@
-
+
diff --git a/Bonfire.Boundaries.Web.BoundariesGeneralAccessLive.LiveViewNativeWeb.html b/Bonfire.Boundaries.Web.BoundariesGeneralAccessLive.LiveViewNativeWeb.html
index 5a937b22920..b31a0308aa7 100644
--- a/Bonfire.Boundaries.Web.BoundariesGeneralAccessLive.LiveViewNativeWeb.html
+++ b/Bonfire.Boundaries.Web.BoundariesGeneralAccessLive.LiveViewNativeWeb.html
@@ -13,7 +13,7 @@
-
+
diff --git a/Bonfire.Boundaries.Web.BoundariesInfoLive.LiveViewNativeWeb.html b/Bonfire.Boundaries.Web.BoundariesInfoLive.LiveViewNativeWeb.html
index b34b84a61a8..a1ccc4a427b 100644
--- a/Bonfire.Boundaries.Web.BoundariesInfoLive.LiveViewNativeWeb.html
+++ b/Bonfire.Boundaries.Web.BoundariesInfoLive.LiveViewNativeWeb.html
@@ -13,7 +13,7 @@
-
+
diff --git a/Bonfire.Boundaries.Web.BoundariesLive.LiveViewNativeWeb.html b/Bonfire.Boundaries.Web.BoundariesLive.LiveViewNativeWeb.html
index 0c1be31a76a..1d5fde1199e 100644
--- a/Bonfire.Boundaries.Web.BoundariesLive.LiveViewNativeWeb.html
+++ b/Bonfire.Boundaries.Web.BoundariesLive.LiveViewNativeWeb.html
@@ -13,7 +13,7 @@
-
+
diff --git a/Bonfire.Boundaries.Web.BoundariesPresetDescriptionLive.LiveViewNativeWeb.html b/Bonfire.Boundaries.Web.BoundariesPresetDescriptionLive.LiveViewNativeWeb.html
index 911ffba304c..61d12d7f100 100644
--- a/Bonfire.Boundaries.Web.BoundariesPresetDescriptionLive.LiveViewNativeWeb.html
+++ b/Bonfire.Boundaries.Web.BoundariesPresetDescriptionLive.LiveViewNativeWeb.html
@@ -13,7 +13,7 @@
-
+
diff --git a/Bonfire.Boundaries.Web.BoundariesPresetNameLive.LiveViewNativeWeb.html b/Bonfire.Boundaries.Web.BoundariesPresetNameLive.LiveViewNativeWeb.html
index 86dc329bc1a..ec96efb5031 100644
--- a/Bonfire.Boundaries.Web.BoundariesPresetNameLive.LiveViewNativeWeb.html
+++ b/Bonfire.Boundaries.Web.BoundariesPresetNameLive.LiveViewNativeWeb.html
@@ -13,7 +13,7 @@
-
+
diff --git a/Bonfire.Boundaries.Web.BoundariesSelectionLive.LiveViewNativeWeb.html b/Bonfire.Boundaries.Web.BoundariesSelectionLive.LiveViewNativeWeb.html
index 4c22338a955..256703a9a23 100644
--- a/Bonfire.Boundaries.Web.BoundariesSelectionLive.LiveViewNativeWeb.html
+++ b/Bonfire.Boundaries.Web.BoundariesSelectionLive.LiveViewNativeWeb.html
@@ -13,7 +13,7 @@
-
+
diff --git a/Bonfire.Boundaries.Web.BoundaryComposerActionsLive.LiveViewNativeWeb.html b/Bonfire.Boundaries.Web.BoundaryComposerActionsLive.LiveViewNativeWeb.html
index a53d4fc9f65..bda36d57470 100644
--- a/Bonfire.Boundaries.Web.BoundaryComposerActionsLive.LiveViewNativeWeb.html
+++ b/Bonfire.Boundaries.Web.BoundaryComposerActionsLive.LiveViewNativeWeb.html
@@ -13,7 +13,7 @@
-
+
diff --git a/Bonfire.Boundaries.Web.BoundaryDetailsLive.LiveViewNativeWeb.html b/Bonfire.Boundaries.Web.BoundaryDetailsLive.LiveViewNativeWeb.html
index e22948072a2..68f4991ca19 100644
--- a/Bonfire.Boundaries.Web.BoundaryDetailsLive.LiveViewNativeWeb.html
+++ b/Bonfire.Boundaries.Web.BoundaryDetailsLive.LiveViewNativeWeb.html
@@ -13,7 +13,7 @@
-
+
diff --git a/Bonfire.Boundaries.Web.BoundaryDetailsModalLive.LiveViewNativeWeb.html b/Bonfire.Boundaries.Web.BoundaryDetailsModalLive.LiveViewNativeWeb.html
index 42a25dd920b..97d627b5da3 100644
--- a/Bonfire.Boundaries.Web.BoundaryDetailsModalLive.LiveViewNativeWeb.html
+++ b/Bonfire.Boundaries.Web.BoundaryDetailsModalLive.LiveViewNativeWeb.html
@@ -13,7 +13,7 @@
-
+
diff --git a/Bonfire.Boundaries.Web.BoundaryIconLive.LiveViewNativeWeb.html b/Bonfire.Boundaries.Web.BoundaryIconLive.LiveViewNativeWeb.html
index a0cba913a68..e93d7b273e7 100644
--- a/Bonfire.Boundaries.Web.BoundaryIconLive.LiveViewNativeWeb.html
+++ b/Bonfire.Boundaries.Web.BoundaryIconLive.LiveViewNativeWeb.html
@@ -13,7 +13,7 @@
-
+
diff --git a/Bonfire.Boundaries.Web.BoundaryIconStatelessLive.LiveViewNativeWeb.html b/Bonfire.Boundaries.Web.BoundaryIconStatelessLive.LiveViewNativeWeb.html
index 95038b94ade..df563a69902 100644
--- a/Bonfire.Boundaries.Web.BoundaryIconStatelessLive.LiveViewNativeWeb.html
+++ b/Bonfire.Boundaries.Web.BoundaryIconStatelessLive.LiveViewNativeWeb.html
@@ -13,7 +13,7 @@
-
+
diff --git a/Bonfire.Boundaries.Web.BoundaryItemsLive.LiveViewNativeWeb.html b/Bonfire.Boundaries.Web.BoundaryItemsLive.LiveViewNativeWeb.html
index e28f7cd5a0e..27b02490a3d 100644
--- a/Bonfire.Boundaries.Web.BoundaryItemsLive.LiveViewNativeWeb.html
+++ b/Bonfire.Boundaries.Web.BoundaryItemsLive.LiveViewNativeWeb.html
@@ -13,7 +13,7 @@
-
+
diff --git a/Bonfire.Boundaries.Web.CircleLive.LiveViewNativeWeb.html b/Bonfire.Boundaries.Web.CircleLive.LiveViewNativeWeb.html
index 685dcf44403..7e0d52599de 100644
--- a/Bonfire.Boundaries.Web.CircleLive.LiveViewNativeWeb.html
+++ b/Bonfire.Boundaries.Web.CircleLive.LiveViewNativeWeb.html
@@ -13,7 +13,7 @@
-
+
diff --git a/Bonfire.Boundaries.Web.CirclePreviewLive.LiveViewNativeWeb.html b/Bonfire.Boundaries.Web.CirclePreviewLive.LiveViewNativeWeb.html
index 67807851a4f..5d09f0ba893 100644
--- a/Bonfire.Boundaries.Web.CirclePreviewLive.LiveViewNativeWeb.html
+++ b/Bonfire.Boundaries.Web.CirclePreviewLive.LiveViewNativeWeb.html
@@ -13,7 +13,7 @@
-
+
diff --git a/Bonfire.Boundaries.Web.EditCircleLive.LiveViewNativeWeb.html b/Bonfire.Boundaries.Web.EditCircleLive.LiveViewNativeWeb.html
index 90be38d706f..f43235252a0 100644
--- a/Bonfire.Boundaries.Web.EditCircleLive.LiveViewNativeWeb.html
+++ b/Bonfire.Boundaries.Web.EditCircleLive.LiveViewNativeWeb.html
@@ -13,7 +13,7 @@
-
+
diff --git a/Bonfire.Boundaries.Web.ExcludeBoundaries.html b/Bonfire.Boundaries.Web.ExcludeBoundaries.html
index d45a461af26..fc93c14ef3c 100644
--- a/Bonfire.Boundaries.Web.ExcludeBoundaries.html
+++ b/Bonfire.Boundaries.Web.ExcludeBoundaries.html
@@ -13,7 +13,7 @@
-
+
diff --git a/Bonfire.Boundaries.Web.HeaderCircleLive.LiveViewNativeWeb.html b/Bonfire.Boundaries.Web.HeaderCircleLive.LiveViewNativeWeb.html
index 039e9e2985e..1024c0e8622 100644
--- a/Bonfire.Boundaries.Web.HeaderCircleLive.LiveViewNativeWeb.html
+++ b/Bonfire.Boundaries.Web.HeaderCircleLive.LiveViewNativeWeb.html
@@ -13,7 +13,7 @@
-
+
diff --git a/Bonfire.Boundaries.Web.IfCan.LiveViewNativeWeb.html b/Bonfire.Boundaries.Web.IfCan.LiveViewNativeWeb.html
index 9a5688d8497..0b277dde7fd 100644
--- a/Bonfire.Boundaries.Web.IfCan.LiveViewNativeWeb.html
+++ b/Bonfire.Boundaries.Web.IfCan.LiveViewNativeWeb.html
@@ -13,7 +13,7 @@
-
+
diff --git a/Bonfire.Boundaries.Web.InstanceSidebarNavLive.LiveViewNativeWeb.html b/Bonfire.Boundaries.Web.InstanceSidebarNavLive.LiveViewNativeWeb.html
index f1907892b45..5ae7e5b2c37 100644
--- a/Bonfire.Boundaries.Web.InstanceSidebarNavLive.LiveViewNativeWeb.html
+++ b/Bonfire.Boundaries.Web.InstanceSidebarNavLive.LiveViewNativeWeb.html
@@ -13,7 +13,7 @@
-
+
diff --git a/Bonfire.Boundaries.Web.MyAclsLive.LiveViewNativeWeb.html b/Bonfire.Boundaries.Web.MyAclsLive.LiveViewNativeWeb.html
index 9bba843c128..9b135ae26f4 100644
--- a/Bonfire.Boundaries.Web.MyAclsLive.LiveViewNativeWeb.html
+++ b/Bonfire.Boundaries.Web.MyAclsLive.LiveViewNativeWeb.html
@@ -13,7 +13,7 @@
-
+
diff --git a/Bonfire.Boundaries.Web.MyCirclesLive.LiveViewNativeWeb.html b/Bonfire.Boundaries.Web.MyCirclesLive.LiveViewNativeWeb.html
index 7a0d1892f00..699a3775b72 100644
--- a/Bonfire.Boundaries.Web.MyCirclesLive.LiveViewNativeWeb.html
+++ b/Bonfire.Boundaries.Web.MyCirclesLive.LiveViewNativeWeb.html
@@ -13,7 +13,7 @@
-
+
diff --git a/Bonfire.Boundaries.Web.MyCirclesPreviewLive.LiveViewNativeWeb.html b/Bonfire.Boundaries.Web.MyCirclesPreviewLive.LiveViewNativeWeb.html
index 6ff14763fe8..77971d150d8 100644
--- a/Bonfire.Boundaries.Web.MyCirclesPreviewLive.LiveViewNativeWeb.html
+++ b/Bonfire.Boundaries.Web.MyCirclesPreviewLive.LiveViewNativeWeb.html
@@ -13,7 +13,7 @@
-
+
diff --git a/Bonfire.Boundaries.Web.NewAclButtonLive.LiveViewNativeWeb.html b/Bonfire.Boundaries.Web.NewAclButtonLive.LiveViewNativeWeb.html
index 65417245c84..e33e1ffe026 100644
--- a/Bonfire.Boundaries.Web.NewAclButtonLive.LiveViewNativeWeb.html
+++ b/Bonfire.Boundaries.Web.NewAclButtonLive.LiveViewNativeWeb.html
@@ -13,7 +13,7 @@
-
+
diff --git a/Bonfire.Boundaries.Web.NewAclLive.LiveViewNativeWeb.html b/Bonfire.Boundaries.Web.NewAclLive.LiveViewNativeWeb.html
index 211648e9bd1..22e68de4aca 100644
--- a/Bonfire.Boundaries.Web.NewAclLive.LiveViewNativeWeb.html
+++ b/Bonfire.Boundaries.Web.NewAclLive.LiveViewNativeWeb.html
@@ -13,7 +13,7 @@
-
+
diff --git a/Bonfire.Boundaries.Web.NewCircleButtonLive.LiveViewNativeWeb.html b/Bonfire.Boundaries.Web.NewCircleButtonLive.LiveViewNativeWeb.html
index 5f4d548cb57..7be6c565686 100644
--- a/Bonfire.Boundaries.Web.NewCircleButtonLive.LiveViewNativeWeb.html
+++ b/Bonfire.Boundaries.Web.NewCircleButtonLive.LiveViewNativeWeb.html
@@ -13,7 +13,7 @@
-
+
diff --git a/Bonfire.Boundaries.Web.NewCircleLive.LiveViewNativeWeb.html b/Bonfire.Boundaries.Web.NewCircleLive.LiveViewNativeWeb.html
index fed1aeb1c5d..ba2c61a3eb1 100644
--- a/Bonfire.Boundaries.Web.NewCircleLive.LiveViewNativeWeb.html
+++ b/Bonfire.Boundaries.Web.NewCircleLive.LiveViewNativeWeb.html
@@ -13,7 +13,7 @@
-
+
diff --git a/Bonfire.Boundaries.Web.NewRoleButtonLive.LiveViewNativeWeb.html b/Bonfire.Boundaries.Web.NewRoleButtonLive.LiveViewNativeWeb.html
index 480ef71f081..3240af7fff4 100644
--- a/Bonfire.Boundaries.Web.NewRoleButtonLive.LiveViewNativeWeb.html
+++ b/Bonfire.Boundaries.Web.NewRoleButtonLive.LiveViewNativeWeb.html
@@ -13,7 +13,7 @@
-
+
diff --git a/Bonfire.Boundaries.Web.NewRoleLive.LiveViewNativeWeb.html b/Bonfire.Boundaries.Web.NewRoleLive.LiveViewNativeWeb.html
index a2a398d96d0..b1acb4ea02e 100644
--- a/Bonfire.Boundaries.Web.NewRoleLive.LiveViewNativeWeb.html
+++ b/Bonfire.Boundaries.Web.NewRoleLive.LiveViewNativeWeb.html
@@ -13,7 +13,7 @@
-
+
diff --git a/Bonfire.Boundaries.Web.PreviewBoundariesLive.LiveViewNativeWeb.html b/Bonfire.Boundaries.Web.PreviewBoundariesLive.LiveViewNativeWeb.html
index 809745f531e..25cb6f4f9ab 100644
--- a/Bonfire.Boundaries.Web.PreviewBoundariesLive.LiveViewNativeWeb.html
+++ b/Bonfire.Boundaries.Web.PreviewBoundariesLive.LiveViewNativeWeb.html
@@ -13,7 +13,7 @@
-
+
diff --git a/Bonfire.Boundaries.Web.RoleDetailsLive.LiveViewNativeWeb.html b/Bonfire.Boundaries.Web.RoleDetailsLive.LiveViewNativeWeb.html
index c500ac1a530..f4a3dd93104 100644
--- a/Bonfire.Boundaries.Web.RoleDetailsLive.LiveViewNativeWeb.html
+++ b/Bonfire.Boundaries.Web.RoleDetailsLive.LiveViewNativeWeb.html
@@ -13,7 +13,7 @@
-
+
diff --git a/Bonfire.Boundaries.Web.RoleLive.LiveViewNativeWeb.html b/Bonfire.Boundaries.Web.RoleLive.LiveViewNativeWeb.html
index 54bba17428e..bef37e00d5b 100644
--- a/Bonfire.Boundaries.Web.RoleLive.LiveViewNativeWeb.html
+++ b/Bonfire.Boundaries.Web.RoleLive.LiveViewNativeWeb.html
@@ -13,7 +13,7 @@
-
+
diff --git a/Bonfire.Boundaries.Web.RoleVerbLive.LiveViewNativeWeb.html b/Bonfire.Boundaries.Web.RoleVerbLive.LiveViewNativeWeb.html
index 26e98f0ce50..dff8097bb88 100644
--- a/Bonfire.Boundaries.Web.RoleVerbLive.LiveViewNativeWeb.html
+++ b/Bonfire.Boundaries.Web.RoleVerbLive.LiveViewNativeWeb.html
@@ -13,7 +13,7 @@
-
+
diff --git a/Bonfire.Boundaries.Web.RolesDropdownLive.LiveViewNativeWeb.html b/Bonfire.Boundaries.Web.RolesDropdownLive.LiveViewNativeWeb.html
index 65e23f7b7c5..7d27c8abcc9 100644
--- a/Bonfire.Boundaries.Web.RolesDropdownLive.LiveViewNativeWeb.html
+++ b/Bonfire.Boundaries.Web.RolesDropdownLive.LiveViewNativeWeb.html
@@ -13,7 +13,7 @@
-
+
diff --git a/Bonfire.Boundaries.Web.RolesLive.LiveViewNativeWeb.html b/Bonfire.Boundaries.Web.RolesLive.LiveViewNativeWeb.html
index db39c8bc976..681a389e114 100644
--- a/Bonfire.Boundaries.Web.RolesLive.LiveViewNativeWeb.html
+++ b/Bonfire.Boundaries.Web.RolesLive.LiveViewNativeWeb.html
@@ -13,7 +13,7 @@
-
+
diff --git a/Bonfire.Boundaries.Web.Routes.html b/Bonfire.Boundaries.Web.Routes.html
index 3061e58d55f..8abab245c8f 100644
--- a/Bonfire.Boundaries.Web.Routes.html
+++ b/Bonfire.Boundaries.Web.Routes.html
@@ -13,7 +13,7 @@
-
+
diff --git a/Bonfire.Boundaries.Web.SetBoundariesButtonLive.LiveViewNativeWeb.html b/Bonfire.Boundaries.Web.SetBoundariesButtonLive.LiveViewNativeWeb.html
index 338cb9a7bfe..65ae44eb1a0 100644
--- a/Bonfire.Boundaries.Web.SetBoundariesButtonLive.LiveViewNativeWeb.html
+++ b/Bonfire.Boundaries.Web.SetBoundariesButtonLive.LiveViewNativeWeb.html
@@ -13,7 +13,7 @@
-
+
diff --git a/Bonfire.Boundaries.Web.SetBoundariesLive.LiveViewNativeWeb.html b/Bonfire.Boundaries.Web.SetBoundariesLive.LiveViewNativeWeb.html
index ffc0f877a23..b5e7be0958a 100644
--- a/Bonfire.Boundaries.Web.SetBoundariesLive.LiveViewNativeWeb.html
+++ b/Bonfire.Boundaries.Web.SetBoundariesLive.LiveViewNativeWeb.html
@@ -13,7 +13,7 @@
-
+
diff --git a/Bonfire.Boundaries.Web.SidebarNavLive.LiveViewNativeWeb.html b/Bonfire.Boundaries.Web.SidebarNavLive.LiveViewNativeWeb.html
index 6e6c3c5ae3c..80a9c35544d 100644
--- a/Bonfire.Boundaries.Web.SidebarNavLive.LiveViewNativeWeb.html
+++ b/Bonfire.Boundaries.Web.SidebarNavLive.LiveViewNativeWeb.html
@@ -13,7 +13,7 @@
-
+
diff --git a/Bonfire.Boundaries.Web.SilenceDescriptionLive.LiveViewNativeWeb.html b/Bonfire.Boundaries.Web.SilenceDescriptionLive.LiveViewNativeWeb.html
index bd743456aa3..47f67c98140 100644
--- a/Bonfire.Boundaries.Web.SilenceDescriptionLive.LiveViewNativeWeb.html
+++ b/Bonfire.Boundaries.Web.SilenceDescriptionLive.LiveViewNativeWeb.html
@@ -13,7 +13,7 @@
-
+
diff --git a/Bonfire.Boundaries.Web.YesMaybeFalseLive.LiveViewNativeWeb.html b/Bonfire.Boundaries.Web.YesMaybeFalseLive.LiveViewNativeWeb.html
index 48a33d0e258..00fddf9d431 100644
--- a/Bonfire.Boundaries.Web.YesMaybeFalseLive.LiveViewNativeWeb.html
+++ b/Bonfire.Boundaries.Web.YesMaybeFalseLive.LiveViewNativeWeb.html
@@ -13,7 +13,7 @@
-
+
diff --git a/Bonfire.Boundaries.Web.YourRoleLive.LiveViewNativeWeb.html b/Bonfire.Boundaries.Web.YourRoleLive.LiveViewNativeWeb.html
index c9b850bff00..3682ccb0b61 100644
--- a/Bonfire.Boundaries.Web.YourRoleLive.LiveViewNativeWeb.html
+++ b/Bonfire.Boundaries.Web.YourRoleLive.LiveViewNativeWeb.html
@@ -13,7 +13,7 @@
-
+
diff --git a/Bonfire.Boundaries.html b/Bonfire.Boundaries.html
index 0cd743440e9..4858330677b 100644
--- a/Bonfire.Boundaries.html
+++ b/Bonfire.Boundaries.html
@@ -13,7 +13,7 @@
-
+
diff --git a/Bonfire.Common.Benchmark.html b/Bonfire.Common.Benchmark.html
index 9de1cdc3ebf..7058c321f4a 100644
--- a/Bonfire.Common.Benchmark.html
+++ b/Bonfire.Common.Benchmark.html
@@ -13,7 +13,7 @@
-
+
diff --git a/Bonfire.Common.Cache.html b/Bonfire.Common.Cache.html
index 310dd99bfdf..e3deb0b0f4b 100644
--- a/Bonfire.Common.Cache.html
+++ b/Bonfire.Common.Cache.html
@@ -13,7 +13,7 @@
-
+
diff --git a/Bonfire.Common.Changelog.Github.DataGrabber.html b/Bonfire.Common.Changelog.Github.DataGrabber.html
index d960c16348b..9978bfaab35 100644
--- a/Bonfire.Common.Changelog.Github.DataGrabber.html
+++ b/Bonfire.Common.Changelog.Github.DataGrabber.html
@@ -13,7 +13,7 @@
-
+
diff --git a/Bonfire.Common.Config.Error.html b/Bonfire.Common.Config.Error.html
index 5d98e3fee8d..380c06914bb 100644
--- a/Bonfire.Common.Config.Error.html
+++ b/Bonfire.Common.Config.Error.html
@@ -13,7 +13,7 @@
-
+
diff --git a/Bonfire.Common.Config.LoadExtensionsConfig.html b/Bonfire.Common.Config.LoadExtensionsConfig.html
index c5785dacf4f..14fa34c9f8c 100644
--- a/Bonfire.Common.Config.LoadExtensionsConfig.html
+++ b/Bonfire.Common.Config.LoadExtensionsConfig.html
@@ -13,7 +13,7 @@
-
+
diff --git a/Bonfire.Common.Config.html b/Bonfire.Common.Config.html
index 395f0c2dda7..64541ada752 100644
--- a/Bonfire.Common.Config.html
+++ b/Bonfire.Common.Config.html
@@ -13,7 +13,7 @@
-
+
diff --git a/Bonfire.Common.ConfigModule.html b/Bonfire.Common.ConfigModule.html
index cb12969cab7..467a11afa97 100644
--- a/Bonfire.Common.ConfigModule.html
+++ b/Bonfire.Common.ConfigModule.html
@@ -13,7 +13,7 @@
-
+
diff --git a/Bonfire.Common.ContextModule.html b/Bonfire.Common.ContextModule.html
index 6b08d10d458..6693b137f35 100644
--- a/Bonfire.Common.ContextModule.html
+++ b/Bonfire.Common.ContextModule.html
@@ -13,7 +13,7 @@
-
+
diff --git a/Bonfire.Common.DatesTimes.html b/Bonfire.Common.DatesTimes.html
index ca8cd57e68a..ae8ce842042 100644
--- a/Bonfire.Common.DatesTimes.html
+++ b/Bonfire.Common.DatesTimes.html
@@ -13,7 +13,7 @@
-
+
diff --git a/Bonfire.Common.Enums.html b/Bonfire.Common.Enums.html
index 28a7d4c5357..19e3cb59994 100644
--- a/Bonfire.Common.Enums.html
+++ b/Bonfire.Common.Enums.html
@@ -13,7 +13,7 @@
-
+
@@ -180,7 +180,7 @@
left
and right
), which can be structs, maps or lists.
-If left
and right
are Ecto.Changeset
s, merge_changesets/2
is called on them.
+If left
and right
are Ecto.Changeset
s, merge_changesets/2
is called on them.
If left
is a struct, a similar struct is returned with the merged values.
If left
and right
are lists, they are concatenated unless :replace_lists
option is set to true
.
ArgumentError
.
ArgumentError
.
Ecto
changesets. If both changesets have a prepare field, the function concatenates the values of the prepare fields. Either way it also calls Ecto.Changeset.merge/2
operation.Ecto
changesets. If both changesets have a prepare field, the function concatenates the values of the prepare fields. Either way it also calls Ecto.Changeset.merge/2
operation.deep_merge(left, right, opts \\ [])
left
and right
), which can be structs, maps or lists.
-If left
and right
are Ecto.Changeset
s, merge_changesets/2
is called on them.
+If left
and right
are Ecto.Changeset
s, merge_changesets/2
is called on them.
If left
is a struct, a similar struct is returned with the merged values.
If left
and right
are lists, they are concatenated unless :replace_lists
option is set to true
.deep_merge_reduce(list_or_map, opts \\ [])<
ArgumentError
.maybe_append(list, value)
maybe_elem(tuple, index, fallback \\ nil)
+
+
+
+ View Source
+
+
+
+ ArgumentError
.merge_changesets(cs1, cs2)
Ecto
changesets. If both changesets have a prepare field, the function concatenates the values of the prepare fields. Either way it also calls Ecto.Changeset.merge/2
operation.Ecto
changesets. If both changesets have a prepare field, the function concatenates the values of the prepare fields. Either way it also calls Ecto.Changeset.merge/2
operation.format_mfa(module, fun, arity)
Examples
-iex> Exception.format_mfa(Foo, :bar, 1)
-{Foo, :bar, "Foo.bar/1"}
-iex> Exception.format_mfa(Foo, :bar, [])
-{Foo, :bar, "Foo.bar()"}
-iex> Exception.format_mfa(nil, :bar, [])
-{nil, :bar, "nil.bar()"}
iex> Exception.format_mfa(Foo, :bar, 1)
+{Foo, :bar, "Foo.bar/1"}
+iex> Exception.format_mfa(Foo, :bar, [])
+{Foo, :bar, "Foo.bar()"}
+iex> Exception.format_mfa(nil, :bar, [])
+{nil, :bar, "nil.bar()"}
the set of natural languages that are preferred as a response to the request.
Language tags function are provided in
Cldr.LanguageTag
.Accept-Language
header is as follows in ABNF
format: Accept-Language = "Accept-Language" ":"
1#( language-range [ ";" "q" "=" qvalue ] )
- language-range = ( ( 1*8ALPHA *( "-" 1*8ALPHA ) ) | "*" )
Accept-Language: da, en-gb;q=0.8, en;q=0.7
best_match(accept_language)
Examples
-iex> Bonfire.Common.Localise.Cldr.AcceptLanguage.best_match("da;q=0.1,zh-TW;q=0.3", TestBackend.Cldr)
-{:ok,
- %Cldr.LanguageTag{
+
+ transform: %{},
+ language_variants: []
+ }}
+
+iex> Bonfire.Common.Localise.Cldr.AcceptLanguage.best_match("xx,yy;q=0.3")
+{:error,
+ {Cldr.NoMatchingLocale,
+ "No configured locale could be matched to \"xx,yy;q=0.3\""}}
+
+iex> Bonfire.Common.Localise.Cldr.AcceptLanguage.best_match("invalid_tag")
+{:error, {Cldr.LanguageTag.ParseError,
+ "Expected a BCP47 language tag. Could not parse the remaining \"g\" starting at position 11"}}iex> Bonfire.Common.Localise.Cldr.AcceptLanguage.best_match("da;q=0.1,zh-TW;q=0.3", TestBackend.Cldr)
+{:ok,
+ %Cldr.LanguageTag{
backend: TestBackend.Cldr,
canonical_locale_name: "zh-TW",
cldr_locale_name: :"zh-Hant",
- language_subtags: [],
- extensions: %{},
+ language_subtags: [],
+ extensions: %{},
gettext_locale_name: nil,
language: "zh",
- locale: %{},
- private_use: [],
+ locale: %{},
+ private_use: [],
rbnf_locale_name: :"zh-Hant",
requested_locale_name: "zh-TW",
script: :Hant,
territory: :TW,
- transform: %{},
- language_variants: []
- }}
+ transform: %{},
+ language_variants: []
+ }}
-iex> Bonfire.Common.Localise.Cldr.AcceptLanguage.best_match("da;q=0.1,zh-TW;q=0.3", TestBackend.Cldr)
-{:ok,
- %Cldr.LanguageTag{
+iex> Bonfire.Common.Localise.Cldr.AcceptLanguage.best_match("da;q=0.1,zh-TW;q=0.3", TestBackend.Cldr)
+{:ok,
+ %Cldr.LanguageTag{
backend: TestBackend.Cldr,
canonical_locale_name: "zh-TW",
cldr_locale_name: :"zh-Hant",
- language_subtags: [],
- extensions: %{},
+ language_subtags: [],
+ extensions: %{},
gettext_locale_name: nil,
language: "zh",
- locale: %{},
- private_use: [],
+ locale: %{},
+ private_use: [],
rbnf_locale_name: :"zh-Hant",
requested_locale_name: "zh-TW",
script: :Hant,
territory: :TW,
- transform: %{},
- language_variants: []
- }}
-
-iex> Bonfire.Common.Localise.Cldr.AcceptLanguage.best_match("xx,yy;q=0.3")
-{:error,
- {Cldr.NoMatchingLocale,
- "No configured locale could be matched to \"xx,yy;q=0.3\""}}
-
-iex> Bonfire.Common.Localise.Cldr.AcceptLanguage.best_match("invalid_tag")
-{:error, {Cldr.LanguageTag.ParseError,
- "Expected a BCP47 language tag. Could not parse the remaining \"g\" starting at position 11"}}
parse(tokens_or_string)
Example
-iex> Cldr.AcceptLanguage.parse("da,zh-TW;q=0.3", TestBackend.Cldr)
-{:ok,
- [
- {1.0,
- %Cldr.LanguageTag{
+
+ transform: %{},
+ language_variants: []
+ }},
+ {:error,
+ {Cldr.LanguageTag.ParseError,
+ "Expected a BCP47 language tag. Could not parse the remaining \"g\" starting at position 11"}}
+ ]}iex> Cldr.AcceptLanguage.parse("da,zh-TW;q=0.3", TestBackend.Cldr)
+{:ok,
+ [
+ {1.0,
+ %Cldr.LanguageTag{
backend: TestBackend.Cldr,
canonical_locale_name: "da",
cldr_locale_name: :da,
- language_subtags: [],
- extensions: %{},
+ language_subtags: [],
+ extensions: %{},
gettext_locale_name: nil,
language: "da",
- locale: %{},
- private_use: [],
+ locale: %{},
+ private_use: [],
rbnf_locale_name: :da,
requested_locale_name: "da",
script: :Latn,
territory: :DK,
- transform: %{},
- language_variants: []
- }},
- {0.3,
- %Cldr.LanguageTag{
+ transform: %{},
+ language_variants: []
+ }},
+ {0.3,
+ %Cldr.LanguageTag{
backend: TestBackend.Cldr,
canonical_locale_name: "zh-TW",
cldr_locale_name: :"zh-Hant",
- language_subtags: [],
- extensions: %{},
+ language_subtags: [],
+ extensions: %{},
gettext_locale_name: nil,
language: "zh",
- locale: %{},
- private_use: [],
+ locale: %{},
+ private_use: [],
rbnf_locale_name: :"zh-Hant",
requested_locale_name: "zh-TW",
script: :Hant,
territory: :TW,
- transform: %{},
- language_variants: []
- }}
- ]}
-
-iex> Bonfire.Common.Localise.Cldr.AcceptLanguage.parse("invalid_tag")
-{:error,
- {Cldr.LanguageTag.ParseError,
- "Expected a BCP47 language tag. Could not parse the remaining \"g\" starting at position 11"}}
-
-iex> Bonfire.Common.Localise.Cldr.AcceptLanguage.parse("da,zh-TW;q=0.3,invalid_tag")
-{:ok,
- [
- {1.0,
- %Cldr.LanguageTag{
+ transform: %{},
+ language_variants: []
+ }}
+ ]}
+
+iex> Bonfire.Common.Localise.Cldr.AcceptLanguage.parse("invalid_tag")
+{:error,
+ {Cldr.LanguageTag.ParseError,
+ "Expected a BCP47 language tag. Could not parse the remaining \"g\" starting at position 11"}}
+
+iex> Bonfire.Common.Localise.Cldr.AcceptLanguage.parse("da,zh-TW;q=0.3,invalid_tag")
+{:ok,
+ [
+ {1.0,
+ %Cldr.LanguageTag{
backend: TestBackend.Cldr,
canonical_locale_name: "da",
cldr_locale_name: :da,
- language_subtags: [],
- extensions: %{},
+ language_subtags: [],
+ extensions: %{},
gettext_locale_name: nil,
language: "da",
- locale: %{},
- private_use: [],
+ locale: %{},
+ private_use: [],
rbnf_locale_name: :da,
requested_locale_name: "da",
script: :Latn,
territory: :DK,
- transform: %{},
- language_variants: []
- }},
- {0.3,
- %Cldr.LanguageTag{
+ transform: %{},
+ language_variants: []
+ }},
+ {0.3,
+ %Cldr.LanguageTag{
backend: TestBackend.Cldr,
canonical_locale_name: "zh-TW",
cldr_locale_name: :"zh-Hant",
- language_subtags: [],
- extensions: %{},
+ language_subtags: [],
+ extensions: %{},
gettext_locale_name: nil,
language: "zh",
- locale: %{},
- private_use: [],
+ locale: %{},
+ private_use: [],
rbnf_locale_name: :"zh-Hant",
requested_locale_name: "zh-TW",
script: :Hant,
territory: :TW,
- transform: %{},
- language_variants: []
- }},
- {:error,
- {Cldr.LanguageTag.ParseError,
- "Expected a BCP47 language tag. Could not parse the remaining \"g\" starting at position 11"}}
- ]}
parse!(accept_language)
Example
-iex> Bonfire.Common.Localise.Cldr.AcceptLanguage.parse!("da,zh-TW;q=0.3")
-[
- {1.0,
- %Cldr.LanguageTag{
+
+ transform: %{},
+ language_variants: []
+ }},
+ {:error,
+ {Cldr.LanguageTag.ParseError,
+ "Expected a BCP47 language tag. Could not parse the remaining \"g\" starting at position 11"}}
+]iex> Bonfire.Common.Localise.Cldr.AcceptLanguage.parse!("da,zh-TW;q=0.3")
+[
+ {1.0,
+ %Cldr.LanguageTag{
backend: TestBackend.Cldr,
canonical_locale_name: "da",
cldr_locale_name: :da,
- language_subtags: [],
- extensions: %{},
+ language_subtags: [],
+ extensions: %{},
gettext_locale_name: nil,
language: "da",
- locale: %{},
- private_use: [],
+ locale: %{},
+ private_use: [],
rbnf_locale_name: :da,
requested_locale_name: "da",
script: :Latn,
territory: :DK,
- transform: %{},
- language_variants: []
- }},
- {0.3,
- %Cldr.LanguageTag{
+ transform: %{},
+ language_variants: []
+ }},
+ {0.3,
+ %Cldr.LanguageTag{
backend: TestBackend.Cldr,
canonical_locale_name: "zh-TW",
cldr_locale_name: :"zh-Hant",
- language_subtags: [],
- extensions: %{},
+ language_subtags: [],
+ extensions: %{},
gettext_locale_name: nil,
language: "zh",
- locale: %{},
- private_use: [],
+ locale: %{},
+ private_use: [],
rbnf_locale_name: :"zh-Hant",
requested_locale_name: "zh-TW",
script: :Hant,
territory: :TW,
- transform: %{},
- language_variants: []
- }}
-]
+ transform: %{},
+ language_variants: []
+ }}
+]
Bonfire.Common.Localise.Cldr.AcceptLanguage.parse! "invalid_tag"
** (Cldr.AcceptLanguageError) "Expected a BCP47 language tag. Could not parse the remaining "g" starting at position 11
(ex_cldr) lib/cldr/accept_language.ex:304: Cldr.AcceptLanguage.parse!/1
-iex> Bonfire.Common.Localise.Cldr.AcceptLanguage.parse!("da,zh-TW;q=0.3,invalid_tag")
-[
- {1.0,
- %Cldr.LanguageTag{
+iex> Bonfire.Common.Localise.Cldr.AcceptLanguage.parse!("da,zh-TW;q=0.3,invalid_tag")
+[
+ {1.0,
+ %Cldr.LanguageTag{
backend: TestBackend.Cldr,
canonical_locale_name: "da",
cldr_locale_name: :da,
- language_subtags: [],
- extensions: %{},
+ language_subtags: [],
+ extensions: %{},
gettext_locale_name: nil,
language: "da",
- locale: %{},
- private_use: [],
+ locale: %{},
+ private_use: [],
rbnf_locale_name: :da,
requested_locale_name: "da",
script: :Latn,
territory: :DK,
- transform: %{},
- language_variants: []
- }},
- {0.3,
- %Cldr.LanguageTag{
+ transform: %{},
+ language_variants: []
+ }},
+ {0.3,
+ %Cldr.LanguageTag{
backend: TestBackend.Cldr,
canonical_locale_name: "zh-TW",
cldr_locale_name: :"zh-Hant",
- language_subtags: [],
- extensions: %{},
+ language_subtags: [],
+ extensions: %{},
gettext_locale_name: nil,
language: "zh",
- locale: %{},
- private_use: [],
+ locale: %{},
+ private_use: [],
rbnf_locale_name: :"zh-Hant",
requested_locale_name: "zh-TW",
script: :Hant,
territory: :TW,
- transform: %{},
- language_variants: []
- }},
- {:error,
- {Cldr.LanguageTag.ParseError,
- "Expected a BCP47 language tag. Could not parse the remaining \"g\" starting at position 11"}}
-]
calendar_from_locale(locale)
Examples
+{:ok, Cldr.Calendar.Persian}
iex> Bonfire.Common.Localise.Cldr.Calendar.calendar_from_locale "en-GB"
-{:ok, Cldr.Calendar.GB}
+{:ok, Cldr.Calendar.GB}
iex> Bonfire.Common.Localise.Cldr.Calendar.calendar_from_locale "en-GB-u-ca-gregory"
-{:ok, Cldr.Calendar.Gregorian}
+{:ok, Cldr.Calendar.Gregorian}
iex> Bonfire.Common.Localise.Cldr.Calendar.calendar_from_locale "en"
-{:ok, Cldr.Calendar.US}
+{:ok, Cldr.Calendar.US}
iex> Bonfire.Common.Localise.Cldr.Calendar.calendar_from_locale "fa-IR"
-{:ok, Cldr.Calendar.Persian}
calendar_from_territory(territory)
Examples
iex> Bonfire.Common.Localise.Cldr.Calendar.calendar_from_territory :US
-{:ok, Cldr.Calendar.Gregorian}
+{:ok, Cldr.Calendar.Gregorian}
iex> Bonfire.Common.Localise.Cldr.Calendar.calendar_from_territory :XX
-{:error, {Cldr.UnknownTerritoryError, "The territory :XX is unknown"}}
+{:error, {Cldr.UnknownTerritoryError, "The territory :XX is unknown"}}
@@ -604,19 +604,19 @@
strftime_options!(locale \\ Bonfire.Common.
Example
iex: MyApp.Cldr.Calendar.strftime_options!
-[
- am_pm_names: #Function<0.32021692/1 in MyApp.Cldr.Calendar.strftime_options/2>,
- month_names: #Function<1.32021692/1 in MyApp.Cldr.Calendar.strftime_options/2>,
- abbreviated_month_names: #Function<2.32021692/1 in MyApp.Cldr.Calendar.strftime_options/2>,
- day_of_week_names: #Function<3.32021692/1 in MyApp.Cldr.Calendar.strftime_options/2>,
- abbreviated_day_of_week_names: #Function<4.32021692/1 in MyApp.Cldr.Calendar.strftime_options/2>
-]
+[
+ am_pm_names: #Function<0.32021692/1 in MyApp.Cldr.Calendar.strftime_options/2>,
+ month_names: #Function<1.32021692/1 in MyApp.Cldr.Calendar.strftime_options/2>,
+ abbreviated_month_names: #Function<2.32021692/1 in MyApp.Cldr.Calendar.strftime_options/2>,
+ day_of_week_names: #Function<3.32021692/1 in MyApp.Cldr.Calendar.strftime_options/2>,
+ abbreviated_day_of_week_names: #Function<4.32021692/1 in MyApp.Cldr.Calendar.strftime_options/2>
+]
Typical usage
-
+iex: NimbleStrftime.format(Date.today(), MyApp.Cldr.Calendar.strftime_options!())
iex: NimbleStrftime.format(Date.today(), MyApp.Cldr.Calendar.strftime_options!())
currencies_for_locale(locale, only \\ :all,
FJD: %Cldr.Currency{
+ %{
@@ -493,11 +493,11 @@ FJD: %Cldr.Currency{
cash_digits: 2,
cash_rounding: 0,
code: "FJD",
- count: %{one: "Fijian dollar", other: "Fijian dollars"},
+ count: %{one: "Fijian dollar", other: "Fijian dollars"},
digits: 2,
from: nil,
iso_digits: 2,
@@ -427,12 +427,12 @@
currencies_for_locale(locale, only \\ :all,
symbol: "FJD",
tender: true,
to: nil
- },
- SUR: %Cldr.Currency{
+ },
+ SUR: %Cldr.Currency{
cash_digits: 2,
cash_rounding: 0,
code: "SUR",
- count: %{one: "Soviet rouble", other: "Soviet roubles"},
+ count: %{one: "Soviet rouble", other: "Soviet roubles"},
digits: 2,
from: nil,
iso_digits: nil,
@@ -442,7 +442,7 @@ currencies_for_locale(locale, only \\ :all,
symbol: "SUR",
tender: true,
to: nil
- },
+ },
...
}}currencies_for_locale!(locale, only \\ :all
Example
FJD: %Cldr.Currency{
+ => %{
FJD: %Cldr.Currency{
cash_digits: 2,
cash_rounding: 0,
code: "FJD",
- count: %{one: "Fijian dollar", other: "Fijian dollars"},
+ count: %{one: "Fijian dollar", other: "Fijian dollars"},
digits: 2,
from: nil,
iso_digits: 2,
@@ -507,12 +507,12 @@
currencies_for_locale!(locale, only \\ :all
symbol: "FJD",
tender: true,
to: nil
-},
-SUR: %Cldr.Currency{
+},
+SUR: %Cldr.Currency{
cash_digits: 2,
cash_rounding: 0,
code: "SUR",
- count: %{one: "Soviet rouble", other: "Soviet roubles"},
+ count: %{one: "Soviet rouble", other: "Soviet roubles"},
digits: 2,
from: nil,
iso_digits: nil,
@@ -522,7 +522,7 @@ currencies_for_locale!(locale, only \\ :all
symbol: "SUR",
tender: true,
to: nil
-},
+},
...currency_for_code(currency_or_currency_code
Examples
-
{:ok, "พ. ๑ ม.ค. – อา. ๑๒ ม.ค. ๒๐๒๐"}iex> Bonfire.Common.Localise.Cldr.Currency.currency_for_code("AUD")
-{:ok,
- %Cldr.Currency{
+
+}}iex> Bonfire.Common.Localise.Cldr.Currency.currency_for_code("AUD")
+{:ok,
+ %Cldr.Currency{
cash_digits: 2,
cash_rounding: 0,
code: "AUD",
- count: %{one: "Australian dollar", other: "Australian dollars"},
+ count: %{one: "Australian dollar", other: "Australian dollars"},
digits: 2,
iso_digits: 2,
name: "Australian Dollar",
@@ -594,15 +594,15 @@
currency_for_code(currency_or_currency_code
rounding: 0,
symbol: "A$",
tender: true
-}}
+}}
-iex> Bonfire.Common.Localise.Cldr.Currency.currency_for_code("THB")
-{:ok,
- %Cldr.Currency{
+iex> Bonfire.Common.Localise.Cldr.Currency.currency_for_code("THB")
+{:ok,
+ %Cldr.Currency{
cash_digits: 2,
cash_rounding: 0,
code: "THB",
- count: %{one: "Thai baht", other: "Thai baht"},
+ count: %{one: "Thai baht", other: "Thai baht"},
digits: 2,
iso_digits: 2,
name: "Thai Baht",
@@ -610,7 +610,7 @@ currency_for_code(currency_or_currency_code
rounding: 0,
symbol: "THB",
tender: true
-}}currency_for_code!(currency_or_currency_cod
Examples
-
iex> Bonfire.Common.Localise.Cldr.Currency.currency_for_code!("AUD")
-%Cldr.Currency{
+
+}iex> Bonfire.Common.Localise.Cldr.Currency.currency_for_code!("AUD")
+%Cldr.Currency{
cash_digits: 2,
cash_rounding: 0,
code: "AUD",
- count: %{one: "Australian dollar", other: "Australian dollars"},
+ count: %{one: "Australian dollar", other: "Australian dollars"},
digits: 2,
iso_digits: 2,
name: "Australian Dollar",
@@ -682,14 +682,14 @@
currency_for_code!(currency_or_currency_cod
rounding: 0,
symbol: "A$",
tender: true
-}
+}
-iex> Bonfire.Common.Localise.Cldr.Currency.currency_for_code!("THB")
-%Cldr.Currency{
+iex> Bonfire.Common.Localise.Cldr.Currency.currency_for_code!("THB")
+%Cldr.Currency{
cash_digits: 2,
cash_rounding: 0,
code: "THB",
- count: %{one: "Thai baht", other: "Thai baht"},
+ count: %{one: "Thai baht", other: "Thai baht"},
digits: 2,
iso_digits: 2,
name: "Thai Baht",
@@ -697,7 +697,7 @@ currency_for_code!(currency_or_currency_cod
rounding: 0,
symbol: "THB",
tender: true
-}currency_from_locale(locale)
Examples
-iex> {:ok, locale} = Bonfire.Common.Localise.Cldr.validate_locale("en")
+
iex> {:ok, locale} = Bonfire.Common.Localise.Cldr.validate_locale("en")
iex> Bonfire.Common.Localise.Cldr.Currency.currency_from_locale locale
:USD
-iex> {:ok, locale} = Bonfire.Common.Localise.Cldr.validate_locale("en-AU")
+iex> {:ok, locale} = Bonfire.Common.Localise.Cldr.validate_locale("en-AU")
iex> Bonfire.Common.Localise.Cldr.Currency.currency_from_locale locale
:AUD
-iex> Bonfire.Common.Localise.Cldr.Currency.currency_from_locale("en-GB")
+iex> Bonfire.Common.Localise.Cldr.Currency.currency_from_locale("en-GB")
:GBP
currency_history_for_locale(language_tag)
Example
-
+iex> MyApp.Cldr.Currency.currency_history_for_locale("en")
-{:ok,
- %{
- USD: %{from: ~D[1792-01-01], to: nil},
- USN: %{tender: false},
- USS: %{from: nil, tender: false, to: ~D[2014-03-01]}
- }
-}
iex> MyApp.Cldr.Currency.currency_history_for_locale("en")
+{:ok,
+ %{
+ USD: %{from: ~D[1792-01-01], to: nil},
+ USN: %{tender: false},
+ USS: %{from: nil, tender: false, to: ~D[2014-03-01]}
+ }
+}
currency_strings(locale, only \\ :all, exce
Example
-
MyApp.Cldr.Currency.currency_strings("en")
-=> {:ok,
- %{
+
+ }}MyApp.Cldr.Currency.currency_strings("en")
+=> {:ok,
+ %{
"mexican silver pesos" => :MXP,
"sudanese dinar" => :SDD,
"bad" => :BAD,
@@ -868,7 +868,7 @@
currency_strings(locale, only \\ :all, exce
"guyanaese dollars" => :GYD,
"equatorial guinean ekwele" => :GQE,
...
- }}currency_strings!(locale_name, only \\ :all
Example
-
MyApp.Cldr.Currency.currency_strings!("en")
-=> %{
+
+ }MyApp.Cldr.Currency.currency_strings!("en")
+=> %{
"mexican silver pesos" => :MXP,
"sudanese dinar" => :SDD,
"bad" => :BAD,
@@ -938,7 +938,7 @@
currency_strings!(locale_name, only \\ :all
"guyanaese dollars" => :GYD,
"equatorial guinean ekwele" => :GQE,
...
- }current_currency_from_locale(locale)
Example
-iex> MyApp.Cldr.Currency.current_currency_from_locale("en")
+
iex> MyApp.Cldr.Currency.current_currency_from_locale("en")
:USD
-iex> MyApp.Cldr.Currency.current_currency_from_locale("en-AU")
+iex> MyApp.Cldr.Currency.current_currency_from_locale("en-AU")
:AUD
current_territory_currencies()
Example
-
+iex> Bonfire.Common.Localise.Cldr.Currency.current_territory_currencies()
iex> Bonfire.Common.Localise.Cldr.Currency.current_territory_currencies()
known_currency_code(currency_code)
Examples
-iex> Bonfire.Common.Localise.Cldr.Currency.known_currency_code("AUD")
-{:ok, :AUD}
+
+iex> Bonfire.Common.Localise.Cldr.Currency.known_currency_code("GGG")
+{:error, {Cldr.UnknownCurrencyError, "The currency \"GGG\" is invalid"}}iex> Bonfire.Common.Localise.Cldr.Currency.known_currency_code("AUD")
+{:ok, :AUD}
-iex> Bonfire.Common.Localise.Cldr.Currency.known_currency_code("GGG")
-{:error, {Cldr.UnknownCurrencyError, "The currency \"GGG\" is invalid"}}
known_currency_code?(currency_code)
Examples
-iex> Bonfire.Common.Localise.Cldr.Currency.known_currency_code?("AUD")
+
iex> Bonfire.Common.Localise.Cldr.Currency.known_currency_code?("AUD")
true
-iex> Bonfire.Common.Localise.Cldr.Currency.known_currency_code?("GGG")
+iex> Bonfire.Common.Localise.Cldr.Currency.known_currency_code?("GGG")
false
-iex> Bonfire.Common.Localise.Cldr.Currency.known_currency_code?(:XCV)
+iex> Bonfire.Common.Localise.Cldr.Currency.known_currency_code?(:XCV)
false
known_currency_codes()
Example
-
+iex> Bonfire.Common.Localise.Cldr.Currency.known_currency_codes()
iex> Bonfire.Common.Localise.Cldr.Currency.known_currency_codes()
new(currency, options \\ [])
Example
-iex> Bonfire.Common.Localise.Cldr.Currency.new(:XAE, name: "Custom Name", digits: 0)
-{:ok,
- %Cldr.Currency{
+
+ }}
+iex> MyApp.Cldr.Currency.new(:XAH, name: "Custom Name")
+{:error, "Required options are missing. Required options are [:name, :digits]"}
+iex> Bonfire.Common.Localise.Cldr.Currency.new(:XAE, name: "XAE", digits: 0)
+{:error, {Cldr.CurrencyAlreadyDefined, "Currency :XAE is already defined."}}iex> Bonfire.Common.Localise.Cldr.Currency.new(:XAE, name: "Custom Name", digits: 0)
+{:ok,
+ %Cldr.Currency{
alt_code: :XAE,
cash_digits: 0,
cash_rounding: nil,
code: :XAE,
- count: %{other: "Custom Name"},
+ count: %{other: "Custom Name"},
digits: 0,
from: nil,
iso_digits: 0,
@@ -1287,11 +1287,11 @@
new(currency, options \\ [])
symbol: "XAE",
tender: false,
to: nil
- }}
-iex> MyApp.Cldr.Currency.new(:XAH, name: "Custom Name")
-{:error, "Required options are missing. Required options are [:name, :digits]"}
-iex> Bonfire.Common.Localise.Cldr.Currency.new(:XAE, name: "XAE", digits: 0)
-{:error, {Cldr.CurrencyAlreadyDefined, "Currency :XAE is already defined."}}pluralize(number, currency, options \\ [])<
Examples
-
iex> Bonfire.Common.Localise.Cldr.Currency.pluralize(1, :USD)
-{:ok, "US dollar"}
+
+iex> Bonfire.Common.Localise.Cldr.Currency.pluralize(1, :USD, locale: "fr")
+{:ok, "dollar des États-Unis"}iex> Bonfire.Common.Localise.Cldr.Currency.pluralize(1, :USD)
+{:ok, "US dollar"}
-iex> Bonfire.Common.Localise.Cldr.Currency.pluralize(3, :USD)
-{:ok, "US dollars"}
+iex> Bonfire.Common.Localise.Cldr.Currency.pluralize(3, :USD)
+{:ok, "US dollars"}
-iex> Bonfire.Common.Localise.Cldr.Currency.pluralize(12, :USD, locale: "zh")
-{:ok, "美元"}
+iex> Bonfire.Common.Localise.Cldr.Currency.pluralize(12, :USD, locale: "zh")
+{:ok, "美元"}
-iex> Bonfire.Common.Localise.Cldr.Currency.pluralize(12, :USD, locale: "fr")
-{:ok, "dollars des États-Unis"}
+iex> Bonfire.Common.Localise.Cldr.Currency.pluralize(12, :USD, locale: "fr")
+{:ok, "dollars des États-Unis"}
-iex> Bonfire.Common.Localise.Cldr.Currency.pluralize(1, :USD, locale: "fr")
-{:ok, "dollar des États-Unis"}
strings_for_currency(currency, locale)
Example
-
+iex> MyApp.Cldr.Currency.strings_for_currency(:AUD, "en")
-["a$", "australian dollars", "aud", "australian dollar"]
iex> MyApp.Cldr.Currency.strings_for_currency(:AUD, "en")
+["a$", "australian dollars", "aud", "australian dollar"]
to_string(from, to, options)
Examples
+iex> Bonfire.Common.Localise.Cldr.Date.Interval.to_string ~D[2020-01-01], ~D[2020-12-31]
-{:ok, "Jan 1 – Dec 31, 2020"}
+{:ok, "Jan 1 – Dec 31, 2020"}
iex> Bonfire.Common.Localise.Cldr.Date.Interval.to_string ~D[2020-01-01], ~D[2020-01-12]
-{:ok, "Jan 1 – 12, 2020"}
+{:ok, "Jan 1 – 12, 2020"}
iex> Bonfire.Common.Localise.Cldr.Date.Interval.to_string ~D[2020-01-01], ~D[2020-01-12],
...> format: :long
-{:ok, "Wed, Jan 1 – Sun, Jan 12, 2020"}
+{:ok, "Wed, Jan 1 – Sun, Jan 12, 2020"}
iex> Bonfire.Common.Localise.Cldr.Date.Interval.to_string ~D[2020-01-01], ~D[2020-12-01],
...> format: :long, style: :year_and_month
-{:ok, "January – December 2020"}
+{:ok, "January – December 2020"}
iex> Bonfire.Common.Localise.Cldr.Date.Interval.to_string ~D[2020-01-01], ~D[2020-01-12],
...> format: :short
-{:ok, "1/1/2020 – 1/12/2020"}
+{:ok, "1/1/2020 – 1/12/2020"}
iex> Bonfire.Common.Localise.Cldr.Date.Interval.to_string ~D[2020-01-01], ~D[2020-01-12],
...> format: :long, locale: "fr"
-{:ok, "mer. 1 – dim. 12 janv. 2020"}
+{:ok, "mer. 1 – dim. 12 janv. 2020"}
iex> Bonfire.Common.Localise.Cldr.Date.Interval.to_string ~D[2020-01-01], ~D[2020-01-12],
...> format: :long, locale: "th", number_system: :thai
-{:ok, "พ. ๑ ม.ค. – อา. ๑๒ ม.ค. ๒๐๒๐"}
to_string!(from, to, options)
Examples
-iex> Bonfire.Common.Localise.Cldr.Date.Interval.to_string! Date.range(~D[2020-01-01], ~D[2020-12-31])
+
iex> Bonfire.Common.Localise.Cldr.Date.Interval.to_string! Date.range(~D[2020-01-01], ~D[2020-12-31])
"Jan 1 – Dec 31, 2020"
-iex> Bonfire.Common.Localise.Cldr.Date.Interval.to_string! Date.range(~D[2020-01-01], ~D[2020-01-12])
+iex> Bonfire.Common.Localise.Cldr.Date.Interval.to_string! Date.range(~D[2020-01-01], ~D[2020-01-12])
"Jan 1 – 12, 2020"
-iex> Bonfire.Common.Localise.Cldr.Date.Interval.to_string! Date.range(~D[2020-01-01], ~D[2020-01-12]),
+iex> Bonfire.Common.Localise.Cldr.Date.Interval.to_string! Date.range(~D[2020-01-01], ~D[2020-01-12]),
...> format: :long
"Wed, Jan 1 – Sun, Jan 12, 2020"
-iex> Bonfire.Common.Localise.Cldr.Date.Interval.to_string! Date.range(~D[2020-01-01], ~D[2020-12-01]),
+iex> Bonfire.Common.Localise.Cldr.Date.Interval.to_string! Date.range(~D[2020-01-01], ~D[2020-12-01]),
...> format: :long, style: :year_and_month
"January – December 2020"
@@ -414,11 +414,11 @@
to_string!(from, to, options)
iex> Bonfire.Common.Localise.Cldr.Date.Interval.to_string! ~I"2020-01/12"
"Jan 1 – Dec 31, 2020"
-iex> Bonfire.Common.Localise.Cldr.Date.Interval.to_string! Date.range(~D[2020-01-01], ~D[2020-01-12]),
+iex> Bonfire.Common.Localise.Cldr.Date.Interval.to_string! Date.range(~D[2020-01-01], ~D[2020-01-12]),
...> format: :short
"1/1/2020 – 1/12/2020"
-iex> Bonfire.Common.Localise.Cldr.Date.Interval.to_string! Date.range(~D[2020-01-01], ~D[2020-01-12]),
+iex> Bonfire.Common.Localise.Cldr.Date.Interval.to_string! Date.range(~D[2020-01-01], ~D[2020-01-12]),
...> format: :long, locale: "fr"
"mer. 1 – dim. 12 janv. 2020"to_string(date, options \\ [])
Examples
+{:ok, "10 Julie 2017"}iex> Bonfire.Common.Localise.Cldr.Date.to_string ~D[2017-07-10], format: :medium, locale: "en"
-{:ok, "Jul 10, 2017"}
+{:ok, "Jul 10, 2017"}
iex> Bonfire.Common.Localise.Cldr.Date.to_string ~D[2017-07-10], locale: "en"
-{:ok, "Jul 10, 2017"}
+{:ok, "Jul 10, 2017"}
iex> Bonfire.Common.Localise.Cldr.Date.to_string ~D[2017-07-10], format: :full, locale: "en"
-{:ok, "Monday, July 10, 2017"}
+{:ok, "Monday, July 10, 2017"}
iex> Bonfire.Common.Localise.Cldr.Date.to_string ~D[2017-07-10], format: :short, locale: "en"
-{:ok, "7/10/17"}
+{:ok, "7/10/17"}
iex> Bonfire.Common.Localise.Cldr.Date.to_string ~D[2017-07-10], format: :short, locale: "fr"
-{:ok, "10/07/2017"}
+{:ok, "10/07/2017"}
iex> Bonfire.Common.Localise.Cldr.Date.to_string ~D[2017-07-10], format: :long, locale: "af"
-{:ok, "10 Julie 2017"}
calendars_for(locale \\ Bonfire.Common.Loca
Example
-
iex> Bonfire.Common.Localise.Cldr.DateTime.Format.calendars_for(:en)
-{:ok, [:buddhist, :chinese, :coptic, :dangi, :ethiopic, :ethiopic_amete_alem,
+
+ :islamic_rgsa, :islamic_tbla, :islamic_umalqura, :japanese, :persian, :roc]}iex> Bonfire.Common.Localise.Cldr.DateTime.Format.calendars_for(:en)
+{:ok, [:buddhist, :chinese, :coptic, :dangi, :ethiopic, :ethiopic_amete_alem,
:generic, :gregorian, :hebrew, :indian, :islamic, :islamic_civil,
- :islamic_rgsa, :islamic_tbla, :islamic_umalqura, :japanese, :persian, :roc]}
date_formats(locale \\ Bonfire.Common.Local
Examples:
-
iex> Bonfire.Common.Localise.Cldr.DateTime.Format.date_formats(:en)
-{:ok, %Cldr.Date.Formats{
+
+}}iex> Bonfire.Common.Localise.Cldr.DateTime.Format.date_formats(:en)
+{:ok, %Cldr.Date.Formats{
full: "EEEE, MMMM d, y",
long: "MMMM d, y",
medium: "MMM d, y",
short: "M/d/yy"
-}}
+}}
-iex> Bonfire.Common.Localise.Cldr.DateTime.Format.date_formats(:en, :buddhist)
-{:ok, %Cldr.Date.Formats{
+iex> Bonfire.Common.Localise.Cldr.DateTime.Format.date_formats(:en, :buddhist)
+{:ok, %Cldr.Date.Formats{
full: "EEEE, MMMM d, y G",
long: "MMMM d, y G",
medium: "MMM d, y G",
short: "M/d/y GGGGG"
-}}
date_time_at_formats(locale \\ Bonfire.Comm
Examples:
-
iex> Bonfire.Common.Localise.Cldr.DateTime.Format.date_time_at_formats(:en)
-{:ok, %Cldr.DateTime.Formats{
+
+ short: "{1}, {0}"}
+}iex> Bonfire.Common.Localise.Cldr.DateTime.Format.date_time_at_formats(:en)
+{:ok, %Cldr.DateTime.Formats{
full: "{1} 'at' {0}",
long: "{1} 'at' {0}",
medium: "{1}, {0}",
- short: "{1}, {0}"}
-}
+ short: "{1}, {0}"}
+}
-iex> Bonfire.Common.Localise.Cldr.DateTime.Format.date_time_at_formats(:en, :buddhist)
-{:ok, %Cldr.DateTime.Formats{
+iex> Bonfire.Common.Localise.Cldr.DateTime.Format.date_time_at_formats(:en, :buddhist)
+{:ok, %Cldr.DateTime.Formats{
full: "{1} 'at' {0}",
long: "{1} 'at' {0}",
medium: "{1}, {0}",
- short: "{1}, {0}"}
-}
date_time_available_formats(locale \\ Bonfi
Examples:
+ }
+}
iex> Bonfire.Common.Localise.Cldr.DateTime.Format.date_time_available_formats "en"
-{
+{
:ok,
- %{
+ %{
d: "d",
h: "h a",
hm: "h:mm a",
@@ -626,7 +626,7 @@
date_time_available_formats(locale \\ Bonfi
hmv: "h:mm a v",
ms: "mm:ss",
y: "y",
- yw: %{one: "'week' w 'of' Y", other: "'week' w 'of' Y"},
+ yw: %{one: "'week' w 'of' Y", other: "'week' w 'of' Y"},
Bh: "h B",
Bhm: "h:mm B",
Bhms: "h:mm:ss B",
@@ -652,7 +652,7 @@ date_time_available_formats(locale \\ Bonfi
MEd: "E, M/d",
MMM: "LLL",
MMMEd: "E, MMM d",
- MMMMW: %{one: "'week' W 'of' MMMM", other: "'week' W 'of' MMMM"},
+ MMMMW: %{one: "'week' W 'of' MMMM", other: "'week' W 'of' MMMM"},
MMMMd: "MMMM d",
MMMd: "MMM d",
Md: "M/d",
@@ -665,8 +665,8 @@ date_time_available_formats(locale \\ Bonfi
yMd: "M/d/y",
yQQQ: "QQQ y",
yQQQQ: "QQQQ y"
- }
-}date_time_formats(locale \\ Bonfire.Common.
Examples:
-
iex> Bonfire.Common.Localise.Cldr.DateTime.Format.date_time_formats(:en)
-{:ok, %Cldr.DateTime.Formats{
+
+}}iex> Bonfire.Common.Localise.Cldr.DateTime.Format.date_time_formats(:en)
+{:ok, %Cldr.DateTime.Formats{
full: "{1}, {0}",
long: "{1}, {0}",
medium: "{1}, {0}",
short: "{1}, {0}"
-}}
+}}
-iex> Bonfire.Common.Localise.Cldr.DateTime.Format.date_time_formats(:en, :buddhist)
-{:ok, %Cldr.DateTime.Formats{
+iex> Bonfire.Common.Localise.Cldr.DateTime.Format.date_time_formats(:en, :buddhist)
+{:ok, %Cldr.DateTime.Formats{
full: "{1}, {0}",
long: "{1}, {0}",
medium: "{1}, {0}",
short: "{1}, {0}"
-}}
date_time_interval_fallback(locale \\ Bonfi
Examples:
+[0, " – ", 1]
iex> Bonfire.Common.Localise.Cldr.DateTime.Format.date_time_interval_fallback :en, :gregorian
-[0, " – ", 1]
gmt_format(locale \\ Bonfire.Common.Localis
Example
+{:ok, ["GMT", 0]}
iex> Bonfire.Common.Localise.Cldr.DateTime.Format.gmt_format :en
-{:ok, ["GMT", 0]}
gmt_zero_format(locale \\ Bonfire.Common.Lo
Example
+{:ok, "UTC"}
iex> Bonfire.Common.Localise.Cldr.DateTime.Format.gmt_zero_format :en
-{:ok, "GMT"}
+{:ok, "GMT"}
iex> Bonfire.Common.Localise.Cldr.DateTime.Format.gmt_zero_format :fr
-{:ok, "UTC"}
hour_format(locale \\ Bonfire.Common.Locali
Example
+{:ok, {"+HH:mm", "-HH:mm"}}
iex> Bonfire.Common.Localise.Cldr.DateTime.Format.hour_format "en"
-{:ok, {"+HH:mm", "-HH:mm"}}
time_formats(locale \\ Bonfire.Common.Local
Examples:
-
iex> Bonfire.Common.Localise.Cldr.DateTime.Format.time_formats(:en)
-{:ok, %Cldr.Time.Formats{
+
+}}iex> Bonfire.Common.Localise.Cldr.DateTime.Format.time_formats(:en)
+{:ok, %Cldr.Time.Formats{
full: "h:mm:ss a zzzz",
long: "h:mm:ss a z",
medium: "h:mm:ss a",
short: "h:mm a"
-}}
+}}
-iex> Bonfire.Common.Localise.Cldr.DateTime.Format.time_formats(:en, :buddhist)
-{:ok, %Cldr.Time.Formats{
+iex> Bonfire.Common.Localise.Cldr.DateTime.Format.time_formats(:en, :buddhist)
+{:ok, %Cldr.Time.Formats{
full: "h:mm:ss a zzzz",
long: "h:mm:ss a z",
medium: "h:mm:ss a",
short: "h:mm a"
-}}
format(date, format, locale \\ Cldr.get_loc
Examples
+{:ok, "17/09/03 10:09"}
iex> Bonfire.Common.Localise.Cldr.DateTime.Formatter.format ~U[2017-09-03 10:23:00.0Z], "yy/MM/dd hh:MM", "en"
-{:ok, "17/09/03 10:09"}
to_string(from, to, options \\ [])
+{:ok, "Jan 1, 2020, 12:00:00 AM –"}
iex> Bonfire.Common.Localise.Cldr.DateTime.Interval.to_string ~U[2020-01-01 00:00:00.0Z],
...> ~U[2020-12-31 10:00:00.0Z]
-{:ok, "Jan 1, 2020, 12:00:00 AM – Dec 31, 2020, 10:00:00 AM"}
+{:ok, "Jan 1, 2020, 12:00:00 AM – Dec 31, 2020, 10:00:00 AM"}
iex> Bonfire.Common.Localise.Cldr.DateTime.Interval.to_string ~U[2020-01-01 00:00:00.0Z], nil
-{:ok, "Jan 1, 2020, 12:00:00 AM –"}
to_string(time, options \\ [])
Examples
-iex> Bonfire.Common.Localise.Cldr.DateTime.Relative.to_string(-1)
-{:ok, "1 second ago"}
+
+iex> Bonfire.Common.Localise.Cldr.DateTime.Relative.to_string(~D[2017-04-29], unit: :ziggeraut)
+{:error, {Cldr.UnknownTimeUnit,
+ "Unknown time unit :ziggeraut. Valid time units are [:day, :fri, :hour, :minute, :mon, :month, :quarter, :sat, :second, :sun, :thu, :tue, :wed, :week, :year]"}}iex> Bonfire.Common.Localise.Cldr.DateTime.Relative.to_string(-1)
+{:ok, "1 second ago"}
-iex> Bonfire.Common.Localise.Cldr.DateTime.Relative.to_string(1)
-{:ok, "in 1 second"}
+iex> Bonfire.Common.Localise.Cldr.DateTime.Relative.to_string(1)
+{:ok, "in 1 second"}
-iex> Bonfire.Common.Localise.Cldr.DateTime.Relative.to_string(1, unit: :day)
-{:ok, "tomorrow"}
+iex> Bonfire.Common.Localise.Cldr.DateTime.Relative.to_string(1, unit: :day)
+{:ok, "tomorrow"}
-iex> Bonfire.Common.Localise.Cldr.DateTime.Relative.to_string(1, unit: :day, locale: "fr")
-{:ok, "demain"}
+iex> Bonfire.Common.Localise.Cldr.DateTime.Relative.to_string(1, unit: :day, locale: "fr")
+{:ok, "demain"}
-iex> Bonfire.Common.Localise.Cldr.DateTime.Relative.to_string(1, unit: :day, style: :narrow)
-{:ok, "tomorrow"}
+iex> Bonfire.Common.Localise.Cldr.DateTime.Relative.to_string(1, unit: :day, style: :narrow)
+{:ok, "tomorrow"}
-iex> Bonfire.Common.Localise.Cldr.DateTime.Relative.to_string(1234, unit: :year)
-{:ok, "in 1,234 years"}
+iex> Bonfire.Common.Localise.Cldr.DateTime.Relative.to_string(1234, unit: :year)
+{:ok, "in 1,234 years"}
-iex> Bonfire.Common.Localise.Cldr.DateTime.Relative.to_string(1234, unit: :year, locale: "fr")
-{:ok, "dans 1 234 ans"}
+iex> Bonfire.Common.Localise.Cldr.DateTime.Relative.to_string(1234, unit: :year, locale: "fr")
+{:ok, "dans 1 234 ans"}
-iex> Bonfire.Common.Localise.Cldr.DateTime.Relative.to_string(31)
-{:ok, "in 31 seconds"}
+iex> Bonfire.Common.Localise.Cldr.DateTime.Relative.to_string(31)
+{:ok, "in 31 seconds"}
-iex> Bonfire.Common.Localise.Cldr.DateTime.Relative.to_string(~D[2017-04-29], relative_to: ~D[2017-04-26])
-{:ok, "in 3 days"}
+iex> Bonfire.Common.Localise.Cldr.DateTime.Relative.to_string(~D[2017-04-29], relative_to: ~D[2017-04-26])
+{:ok, "in 3 days"}
-iex> Bonfire.Common.Localise.Cldr.DateTime.Relative.to_string(310, style: :short, locale: "fr")
-{:ok, "dans 5 min"}
+iex> Bonfire.Common.Localise.Cldr.DateTime.Relative.to_string(310, style: :short, locale: "fr")
+{:ok, "dans 5 min"}
-iex> Bonfire.Common.Localise.Cldr.DateTime.Relative.to_string(310, style: :narrow, locale: "fr")
-{:ok, "+5 min"}
+iex> Bonfire.Common.Localise.Cldr.DateTime.Relative.to_string(310, style: :narrow, locale: "fr")
+{:ok, "+5 min"}
iex> Bonfire.Common.Localise.Cldr.DateTime.Relative.to_string 2, unit: :wed, style: :short, locale: "en"
-{:ok, "in 2 Wed."}
+{:ok, "in 2 Wed."}
iex> Bonfire.Common.Localise.Cldr.DateTime.Relative.to_string 1, unit: :wed, style: :short
-{:ok, "next Wed."}
+{:ok, "next Wed."}
iex> Bonfire.Common.Localise.Cldr.DateTime.Relative.to_string -1, unit: :wed, style: :short
-{:ok, "last Wed."}
+{:ok, "last Wed."}
iex> Bonfire.Common.Localise.Cldr.DateTime.Relative.to_string -1, unit: :wed
-{:ok, "last Wednesday"}
+{:ok, "last Wednesday"}
iex> Bonfire.Common.Localise.Cldr.DateTime.Relative.to_string -1, unit: :quarter
-{:ok, "last quarter"}
+{:ok, "last quarter"}
iex> Bonfire.Common.Localise.Cldr.DateTime.Relative.to_string -1, unit: :mon, locale: "fr"
-{:ok, "lundi dernier"}
+{:ok, "lundi dernier"}
-iex> Bonfire.Common.Localise.Cldr.DateTime.Relative.to_string(~D[2017-04-29], unit: :ziggeraut)
-{:error, {Cldr.UnknownTimeUnit,
- "Unknown time unit :ziggeraut. Valid time units are [:day, :fri, :hour, :minute, :mon, :month, :quarter, :sat, :second, :sun, :thu, :tue, :wed, :week, :year]"}}
to_string(date_time, options \\ [])
Examples
-iex> {:ok, datetime} = DateTime.from_naive(~N[2000-01-01 23:59:59.0], "Etc/UTC")
+
+{:ok, "samedi 1 janvier 2000, 23:59:59 UTC"}iex> {:ok, datetime} = DateTime.from_naive(~N[2000-01-01 23:59:59.0], "Etc/UTC")
iex> Bonfire.Common.Localise.Cldr.DateTime.to_string datetime
-{:ok, "Jan 1, 2000, 11:59:59 PM"}
+{:ok, "Jan 1, 2000, 11:59:59 PM"}
iex> Bonfire.Common.Localise.Cldr.DateTime.to_string datetime, locale: "en"
-{:ok, "Jan 1, 2000, 11:59:59 PM"}
+{:ok, "Jan 1, 2000, 11:59:59 PM"}
iex> Bonfire.Common.Localise.Cldr.DateTime.to_string datetime, format: :long, locale: "en"
-{:ok, "January 1, 2000, 11:59:59 PM UTC"}
+{:ok, "January 1, 2000, 11:59:59 PM UTC"}
iex> Bonfire.Common.Localise.Cldr.DateTime.to_string datetime, format: :hms, locale: "en"
-{:ok, "11:59:59 PM"}
+{:ok, "11:59:59 PM"}
iex> Bonfire.Common.Localise.Cldr.DateTime.to_string datetime, format: :full, locale: "en"
-{:ok, "Saturday, January 1, 2000, 11:59:59 PM GMT"}
+{:ok, "Saturday, January 1, 2000, 11:59:59 PM GMT"}
iex> Bonfire.Common.Localise.Cldr.DateTime.to_string datetime, format: :full, locale: "fr"
-{:ok, "samedi 1 janvier 2000, 23:59:59 UTC"}
to_string!(date_time, options \\ [])
Examples
-iex> {:ok, datetime} = DateTime.from_naive(~N[2000-01-01 23:59:59.0], "Etc/UTC")
+
iex> {:ok, datetime} = DateTime.from_naive(~N[2000-01-01 23:59:59.0], "Etc/UTC")
iex> Bonfire.Common.Localise.Cldr.DateTime.to_string! datetime, locale: "en"
"Jan 1, 2000, 11:59:59 PM"
iex> Bonfire.Common.Localise.Cldr.DateTime.to_string! datetime, format: :long, locale: "en"
diff --git a/Bonfire.Common.Localise.Cldr.Interval.html b/Bonfire.Common.Localise.Cldr.Interval.html
index 027b45bae18..2e92c6e9277 100644
--- a/Bonfire.Common.Localise.Cldr.Interval.html
+++ b/Bonfire.Common.Localise.Cldr.Interval.html
@@ -13,7 +13,7 @@
-
+
@@ -306,11 +306,11 @@
to_string(interval, options)
+{:ok, "Wed, Jan 1 – Thu, Dec 31, 2020"}iex> use CalendarInterval
iex> Bonfire.Common.Localise.Cldr.Interval.to_string ~I"2020-01-01/12",
...> format: :long
-{:ok, "Wed, Jan 1 – Sun, Jan 12, 2020"}
+{:ok, "Wed, Jan 1 – Sun, Jan 12, 2020"}
-iex> Bonfire.Common.Localise.Cldr.Interval.to_string Date.range(~D[2020-01-01], ~D[2020-12-31]),
+iex> Bonfire.Common.Localise.Cldr.Interval.to_string Date.range(~D[2020-01-01], ~D[2020-12-31]),
...> format: :long
-{:ok, "Wed, Jan 1 – Thu, Dec 31, 2020"}
to_string(from, to, options \\ [])
Examples
+{:ok, "January 1, 2020, 12:00:00 AM UTC – 10:05:00 AM UTC"}
iex> Bonfire.Common.Localise.Cldr.Interval.to_string ~D[2020-01-01], ~D[2020-12-31]
-{:ok, "Jan 1 – Dec 31, 2020"}
+{:ok, "Jan 1 – Dec 31, 2020"}
iex> Bonfire.Common.Localise.Cldr.Interval.to_string ~D[2020-01-01], ~D[2020-01-12]
-{:ok, "Jan 1 – 12, 2020"}
+{:ok, "Jan 1 – 12, 2020"}
iex> Bonfire.Common.Localise.Cldr.Interval.to_string ~D[2020-01-01], ~D[2020-01-12],
...> format: :long
-{:ok, "Wed, Jan 1 – Sun, Jan 12, 2020"}
+{:ok, "Wed, Jan 1 – Sun, Jan 12, 2020"}
iex> Bonfire.Common.Localise.Cldr.Interval.to_string ~D[2020-01-01], ~D[2020-12-01],
...> format: :long, style: :year_and_month
-{:ok, "January – December 2020"}
+{:ok, "January – December 2020"}
iex> use CalendarInterval
iex> Bonfire.Common.Localise.Cldr.Interval.to_string ~I"2020-01-01/12",
...> format: :long
-{:ok, "Wed, Jan 1 – Sun, Jan 12, 2020"}
+{:ok, "Wed, Jan 1 – Sun, Jan 12, 2020"}
iex> Bonfire.Common.Localise.Cldr.Interval.to_string ~U[2020-01-01 00:00:00.0Z], ~U[2020-12-01 10:05:00.0Z],
...> format: :long
-{:ok, "January 1, 2020, 12:00:00 AM UTC – December 1, 2020, 10:05:00 AM UTC"}
+{:ok, "January 1, 2020, 12:00:00 AM UTC – December 1, 2020, 10:05:00 AM UTC"}
iex> Bonfire.Common.Localise.Cldr.Interval.to_string ~U[2020-01-01 00:00:00.0Z], ~U[2020-01-01 10:05:00.0Z],
...> format: :long
-{:ok, "January 1, 2020, 12:00:00 AM UTC – 10:05:00 AM UTC"}
to_string!(interval, options)
...> format: :long
"Wed, Jan 1 – Sun, Jan 12, 2020"
-iex> Bonfire.Common.Localise.Cldr.Interval.to_string! Date.range(~D[2020-01-01], ~D[2020-12-31]),
+iex> Bonfire.Common.Localise.Cldr.Interval.to_string! Date.range(~D[2020-01-01], ~D[2020-12-31]),
...> format: :long
"Wed, Jan 1 – Thu, Dec 31, 2020"
available_languages(locale \\ get_locale())
Example
-
> Bonfire.Common.Localise.Cldr.Language.Language.available_languages(:en)
-["aa", "ab", "ace", "ach", "ada", "ady", "ae", "aeb", "af", "afh", "agq", "ain",
+
+"bas", "bax", "bbc", "bbj", ...]> Bonfire.Common.Localise.Cldr.Language.Language.available_languages(:en)
+["aa", "ab", "ace", "ach", "ada", "ady", "ae", "aeb", "af", "afh", "agq", "ain",
"ak", "akk", "akz", "ale", "aln", "alt", "am", "an", "ang", "anp", "ar",
"ar-001", "arc", "arn", "aro", "arp", "arq", "ars", "arw", "ary", "arz", "as",
"asa", "ase", "ast", "av", "avk", "awa", "ay", "az", "ba", "bal", "ban", "bar",
-"bas", "bax", "bbc", "bbj", ...]
known_languages(locale \\ get_locale())
Example
-
+> Bonfire.Common.Localise.Cldr.Language.Language.known_languages(:en)
-%{"bez" => %{standard: "Bena"}, "lo" => %{standard: "Lao"},
-"kha" => %{standard: "Khasi"}, "eo" => %{standard: "Esperanto"},
-"rm" => %{standard: "Romansh"}, "ja" => %{standard: "Japanese"},
-"sw-CD" => %{standard: "Congo Swahili"},
-"pdc" => %{standard: "Pennsylvania German"}, "om" => %{standard: "Oromo"},
-"jut" => %{standard: "Jutish"}, "lij" => %{standard: "Ligurian"},
-"kut" => %{standard: "Kutenai"}, "vep" => %{standard: "Veps"},
-"yao" => %{standard: "Yao"}, "gez" => %{standard: "Geez"},
-"cr" => %{standard: "Cree"}, "ne" => %{standard: "Nepali"},
-"zbl" => %{standard: "Blissymbols"}, "ae" => %{standard: "Avestan"},
-"rof" => %{standard: "Rombo"}, "tkl" => %{standard: "Tokelau"},
-"rgn" => %{standard: "Romagnol"}, "el" => %{standard: "Greek"},
-"myv" => %{standard: "Erzya"}, "smj" => %{standard: "Lule Sami"},
-"fo" => %{standard: "Faroese"}, "ii" => %{standard: "Sichuan Yi"},
-"bum" => %{standard: "Bulu"}, "za" => %{standard: "Zhuang"},
-"raj" => %{standard: "Rajasthani"}, "mrj" => %{standard: "Western Mari"},
-"stq" => %{standard: "Saterland Frisian"}, "hu" => %{standard: "Hungarian"},
-"mga" => %{standard: "Middle Irish"}, "bej" => %{standard: "Beja"},
-"yue" => %{standard: "Cantonese"}, "xog" => %{standard: "Soga"},
-"ttt" => %{standard: "Muslim Tat"}, "uga" => %{standard: "Ugaritic"},
-"rup" => %{standard: "Aromanian"},
-"crs" => %{standard: "Seselwa Creole French"}, "oc" => %{standard: "Occitan"},
-"chp" => %{standard: "Chipewyan"}, "zen" => %{standard: "Zenaga"},
-"kmb" => %{standard: "Kimbundu"}, "nr" => %{standard: "South Ndebele"},
-"tiv" => %{standard: "Tiv"}, "aln" => %{standard: "Gheg Albanian"},
-"sh" => %{standard: "Serbo-Croatian"}, "fil" => %{...}, ...}
> Bonfire.Common.Localise.Cldr.Language.Language.known_languages(:en)
+%{"bez" => %{standard: "Bena"}, "lo" => %{standard: "Lao"},
+"kha" => %{standard: "Khasi"}, "eo" => %{standard: "Esperanto"},
+"rm" => %{standard: "Romansh"}, "ja" => %{standard: "Japanese"},
+"sw-CD" => %{standard: "Congo Swahili"},
+"pdc" => %{standard: "Pennsylvania German"}, "om" => %{standard: "Oromo"},
+"jut" => %{standard: "Jutish"}, "lij" => %{standard: "Ligurian"},
+"kut" => %{standard: "Kutenai"}, "vep" => %{standard: "Veps"},
+"yao" => %{standard: "Yao"}, "gez" => %{standard: "Geez"},
+"cr" => %{standard: "Cree"}, "ne" => %{standard: "Nepali"},
+"zbl" => %{standard: "Blissymbols"}, "ae" => %{standard: "Avestan"},
+"rof" => %{standard: "Rombo"}, "tkl" => %{standard: "Tokelau"},
+"rgn" => %{standard: "Romagnol"}, "el" => %{standard: "Greek"},
+"myv" => %{standard: "Erzya"}, "smj" => %{standard: "Lule Sami"},
+"fo" => %{standard: "Faroese"}, "ii" => %{standard: "Sichuan Yi"},
+"bum" => %{standard: "Bulu"}, "za" => %{standard: "Zhuang"},
+"raj" => %{standard: "Rajasthani"}, "mrj" => %{standard: "Western Mari"},
+"stq" => %{standard: "Saterland Frisian"}, "hu" => %{standard: "Hungarian"},
+"mga" => %{standard: "Middle Irish"}, "bej" => %{standard: "Beja"},
+"yue" => %{standard: "Cantonese"}, "xog" => %{standard: "Soga"},
+"ttt" => %{standard: "Muslim Tat"}, "uga" => %{standard: "Ugaritic"},
+"rup" => %{standard: "Aromanian"},
+"crs" => %{standard: "Seselwa Creole French"}, "oc" => %{standard: "Occitan"},
+"chp" => %{standard: "Chipewyan"}, "zen" => %{standard: "Zenaga"},
+"kmb" => %{standard: "Kimbundu"}, "nr" => %{standard: "South Ndebele"},
+"tiv" => %{standard: "Tiv"}, "aln" => %{standard: "Gheg Albanian"},
+"sh" => %{standard: "Serbo-Croatian"}, "fil" => %{...}, ...}
to_string(key, options \\ [])
Example
-
+iex> Bonfire.Common.Localise.Cldr.Language.Language.to_string("eo")
-{:ok, "Esperanto"}
iex> Bonfire.Common.Localise.Cldr.Language.Language.to_string("eo")
+{:ok, "Esperanto"}
["Monday", "Tuesday", "Wednesday"]
-then we can format that list for a given locale by:
+then we can format that list for a given locale by:iex> Bonfire.Common.Localise.Cldr.List.to_string(["Monday", "Tuesday", "Wednesday"], locale: "en")
-{:ok, "Monday, Tuesday, and Wednesday"}
iex> Bonfire.Common.Localise.Cldr.List.to_string(["Monday", "Tuesday", "Wednesday"], locale: "en")
+{:ok, "Monday, Tuesday, and Wednesday"}
intersperse(list, options \\ [])
Examples
-iex> Bonfire.Common.Localise.Cldr.List.intersperse(["a", "b", "c"], locale: "en")
-{:ok, ["a", ", ", "b", ", and ", "c"]}
+
+iex> Bonfire.Common.Localise.Cldr.List.intersperse([1,2])
+{:ok, [1, " and ", 2]}iex> Bonfire.Common.Localise.Cldr.List.intersperse(["a", "b", "c"], locale: "en")
+{:ok, ["a", ", ", "b", ", and ", "c"]}
-iex> Bonfire.Common.Localise.Cldr.List.intersperse(["a", "b", "c"], locale: "en", format: :unit_narrow)
-{:ok, ["a", " ", "b", " ", "c"]}
+iex> Bonfire.Common.Localise.Cldr.List.intersperse(["a", "b", "c"], locale: "en", format: :unit_narrow)
+{:ok, ["a", " ", "b", " ", "c"]}
-iex> Bonfire.Common.Localise.Cldr.List.intersperse(["a", "b", "c"], locale: "fr")
-{:ok, ["a", ", ", "b", " et ", "c"]}
+iex> Bonfire.Common.Localise.Cldr.List.intersperse(["a", "b", "c"], locale: "fr")
+{:ok, ["a", ", ", "b", " et ", "c"]}
-iex> Bonfire.Common.Localise.Cldr.List.intersperse([1,2,3,4,5,6])
-{:ok, [1, ", ", 2, ", ", 3, ", ", 4, ", ", 5, ", and ", 6]}
+iex> Bonfire.Common.Localise.Cldr.List.intersperse([1,2,3,4,5,6])
+{:ok, [1, ", ", 2, ", ", 3, ", ", 4, ", ", 5, ", and ", 6]}
-iex> Bonfire.Common.Localise.Cldr.List.intersperse(["a"])
-{:ok, ["a"]}
+iex> Bonfire.Common.Localise.Cldr.List.intersperse(["a"])
+{:ok, ["a"]}
-iex> Bonfire.Common.Localise.Cldr.List.intersperse([1,2])
-{:ok, [1, " and ", 2]}
intersperse!(list, options \\ [])
Examples
-iex> Bonfire.Common.Localise.Cldr.List.intersperse!(["a", "b", "c"], locale: "en")
-["a", ", ", "b", ", and ", "c"]
+
+iex> Bonfire.Common.Localise.Cldr.List.intersperse!(["a", "b", "c"], locale: "en", format: :unit_narrow)
+["a", " ", "b", " ", "c"]iex> Bonfire.Common.Localise.Cldr.List.intersperse!(["a", "b", "c"], locale: "en")
+["a", ", ", "b", ", and ", "c"]
-iex> Bonfire.Common.Localise.Cldr.List.intersperse!(["a", "b", "c"], locale: "en", format: :unit_narrow)
-["a", " ", "b", " ", "c"]
list_formats_for(locale_name)
Example
-
+iex> Bonfire.Common.Localise.Cldr.List.list_formats_for(:en)
-[:or, :or_narrow, :or_short, :standard, :standard_narrow, :standard_short,
- :unit, :unit_narrow, :unit_short]
iex> Bonfire.Common.Localise.Cldr.List.list_formats_for(:en)
+[:or, :or_narrow, :or_short, :standard, :standard_narrow, :standard_short,
+ :unit, :unit_narrow, :unit_short]
list_patterns_for(locale_name)
Example
-
+iex> Bonfire.Common.Localise.Cldr.List.list_patterns_for(:en)
-%{
- or: %{
- 2 => [0, " or ", 1],
- end: [0, ", or ", 1],
- middle: [0, ", ", 1],
- start: [0, ", ", 1]
- },
- or_narrow: %{
- 2 => [0, " or ", 1],
- end: [0, ", or ", 1],
- middle: [0, ", ", 1],
- start: [0, ", ", 1]
- },
- or_short: %{
- 2 => [0, " or ", 1],
- end: [0, ", or ", 1],
- middle: [0, ", ", 1],
- start: [0, ", ", 1]
- },
- standard: %{
- 2 => [0, " and ", 1],
- end: [0, ", and ", 1],
- middle: [0, ", ", 1],
- start: [0, ", ", 1]
- },
- standard_narrow: %{
- 2 => [0, ", ", 1],
- end: [0, ", ", 1],
- middle: [0, ", ", 1],
- start: [0, ", ", 1]
- },
- standard_short: %{
- 2 => [0, " & ", 1],
- end: [0, ", & ", 1],
- middle: [0, ", ", 1],
- start: [0, ", ", 1]
- },
- unit: %{
- 2 => [0, ", ", 1],
- end: [0, ", ", 1],
- middle: [0, ", ", 1],
- start: [0, ", ", 1]
- },
- unit_narrow: %{
- 2 => [0, " ", 1],
- end: [0, " ", 1],
- middle: [0, " ", 1],
- start: [0, " ", 1]
- },
- unit_short: %{
- 2 => [0, ", ", 1],
- end: [0, ", ", 1],
- middle: [0, ", ", 1],
- start: [0, ", ", 1]
- }
-}
iex> Bonfire.Common.Localise.Cldr.List.list_patterns_for(:en)
+%{
+ or: %{
+ 2 => [0, " or ", 1],
+ end: [0, ", or ", 1],
+ middle: [0, ", ", 1],
+ start: [0, ", ", 1]
+ },
+ or_narrow: %{
+ 2 => [0, " or ", 1],
+ end: [0, ", or ", 1],
+ middle: [0, ", ", 1],
+ start: [0, ", ", 1]
+ },
+ or_short: %{
+ 2 => [0, " or ", 1],
+ end: [0, ", or ", 1],
+ middle: [0, ", ", 1],
+ start: [0, ", ", 1]
+ },
+ standard: %{
+ 2 => [0, " and ", 1],
+ end: [0, ", and ", 1],
+ middle: [0, ", ", 1],
+ start: [0, ", ", 1]
+ },
+ standard_narrow: %{
+ 2 => [0, ", ", 1],
+ end: [0, ", ", 1],
+ middle: [0, ", ", 1],
+ start: [0, ", ", 1]
+ },
+ standard_short: %{
+ 2 => [0, " & ", 1],
+ end: [0, ", & ", 1],
+ middle: [0, ", ", 1],
+ start: [0, ", ", 1]
+ },
+ unit: %{
+ 2 => [0, ", ", 1],
+ end: [0, ", ", 1],
+ middle: [0, ", ", 1],
+ start: [0, ", ", 1]
+ },
+ unit_narrow: %{
+ 2 => [0, " ", 1],
+ end: [0, " ", 1],
+ middle: [0, " ", 1],
+ start: [0, " ", 1]
+ },
+ unit_short: %{
+ 2 => [0, ", ", 1],
+ end: [0, ", ", 1],
+ middle: [0, ", ", 1],
+ start: [0, ", ", 1]
+ }
+}
to_string(list, options \\ [])
Examples
-iex> Bonfire.Common.Localise.Cldr.List.to_string(["a", "b", "c"], locale: "en")
-{:ok, "a, b, and c"}
+
+iex> Bonfire.Common.Localise.Cldr.List.to_string([1,2])
+{:ok, "1 and 2"}iex> Bonfire.Common.Localise.Cldr.List.to_string(["a", "b", "c"], locale: "en")
+{:ok, "a, b, and c"}
-iex> Bonfire.Common.Localise.Cldr.List.to_string(["a", "b", "c"], locale: "en", format: :unit_narrow)
-{:ok, "a b c"}
+iex> Bonfire.Common.Localise.Cldr.List.to_string(["a", "b", "c"], locale: "en", format: :unit_narrow)
+{:ok, "a b c"}
-iex> Bonfire.Common.Localise.Cldr.List.to_string(["a", "b", "c"], locale: "fr")
-{:ok, "a, b et c"}
+iex> Bonfire.Common.Localise.Cldr.List.to_string(["a", "b", "c"], locale: "fr")
+{:ok, "a, b et c"}
-iex> Bonfire.Common.Localise.Cldr.List.to_string([1,2,3,4,5,6])
-{:ok, "1, 2, 3, 4, 5, and 6"}
+iex> Bonfire.Common.Localise.Cldr.List.to_string([1,2,3,4,5,6])
+{:ok, "1, 2, 3, 4, 5, and 6"}
-iex> Bonfire.Common.Localise.Cldr.List.to_string(["a"])
-{:ok, "a"}
+iex> Bonfire.Common.Localise.Cldr.List.to_string(["a"])
+{:ok, "a"}
-iex> Bonfire.Common.Localise.Cldr.List.to_string([1,2])
-{:ok, "1 and 2"}
to_string!(list, options \\ [])
Examples
-iex> Bonfire.Common.Localise.Cldr.List.to_string!(["a", "b", "c"], locale: "en")
+
iex> Bonfire.Common.Localise.Cldr.List.to_string!(["a", "b", "c"], locale: "en")
"a, b, and c"
-iex> Bonfire.Common.Localise.Cldr.List.to_string!(["a", "b", "c"], locale: "en", format: :unit_narrow)
+iex> Bonfire.Common.Localise.Cldr.List.to_string!(["a", "b", "c"], locale: "en", format: :unit_narrow)
"a b c"
fallback_locale_names(locale)
Examples
-iex> Bonfire.Common.Localise.Cldr.Locale.fallback_locale_names(:"fr-CA")
-{:ok, [:"fr-CA", :fr, :und]}
+
+iex> Bonfire.Common.Localise.Cldr.Locale.fallback_locale_names(:nb)
+{:ok, [:nb, :no, :und]}iex> Bonfire.Common.Localise.Cldr.Locale.fallback_locale_names(:"fr-CA")
+{:ok, [:"fr-CA", :fr, :und]}
# Fallbacks are typically formed by progressively
# stripping variant, territory and script from the
# given locale name. But not always - there are
# certain fallbacks that take a different path.
-iex> Bonfire.Common.Localise.Cldr.Locale.fallback_locale_names(:nb)
-{:ok, [:nb, :no, :und]}
fallback_locales(locale)
Examples
-Bonfire.Common.Localise.Cldr.Locale.fallback_locales(:"fr-CA")
-=> {:ok,
- [#Cldr.LanguageTag<fr-CA [validated]>, #Cldr.LanguageTag<fr [validated]>,
- #Cldr.LanguageTag<und [validated]>]}
+
+Bonfire.Common.Localise.Cldr.Locale.fallback_locales(:nb))
+=> {:ok,
+ [#Cldr.LanguageTag<nb [validated]>, #Cldr.LanguageTag<no [validated]>,
+ #Cldr.LanguageTag<und [validated]>]}Bonfire.Common.Localise.Cldr.Locale.fallback_locales(:"fr-CA")
+=> {:ok,
+ [#Cldr.LanguageTag<fr-CA [validated]>, #Cldr.LanguageTag<fr [validated]>,
+ #Cldr.LanguageTag<und [validated]>]}
# Fallbacks are typically formed by progressively
# stripping variant, territory and script from the
# given locale name. But not always - there are
# certain fallbacks that take a different path.
-Bonfire.Common.Localise.Cldr.Locale.fallback_locales(:nb))
-=> {:ok,
- [#Cldr.LanguageTag<nb [validated]>, #Cldr.LanguageTag<no [validated]>,
- #Cldr.LanguageTag<und [validated]>]}
locale_from_host(host, options \\ [])
Examples
+iex> Bonfire.Common.Localise.Cldr.Locale.locale_from_host("a.b.com")
+{:error,
+ {Cldr.UnknownLocaleError, "No locale was identified for territory \"com\""}}
iex> Bonfire.Common.Localise.Cldr.Locale.locale_from_host "a.b.com.au"
-Elixir.Bonfire.Common.Localise.Cldr.validate_locale(:"en-AU")
+Elixir.Bonfire.Common.Localise.Cldr.validate_locale(:"en-AU")
-iex> Bonfire.Common.Localise.Cldr.Locale.locale_from_host("a.b.com.tv")
-{:error,
- {Cldr.UnknownLocaleError, "No locale was identified for territory \"tv\""}}
+iex> Bonfire.Common.Localise.Cldr.Locale.locale_from_host("a.b.com.tv")
+{:error,
+ {Cldr.UnknownLocaleError, "No locale was identified for territory \"tv\""}}
-iex> Bonfire.Common.Localise.Cldr.Locale.locale_from_host("a.b.com")
-{:error,
- {Cldr.UnknownLocaleError, "No locale was identified for territory \"com\""}}
territory_from_host(host)
Examples
-iex> Cldr.Locale.territory_from_host("a.b.com.au")
-{:ok, :AU}
+
+iex> Cldr.Locale.territory_from_host("a.b.com")
+{:error,
+ {Cldr.UnknownLocaleError, "No locale was identified for territory \"com\""}}iex> Cldr.Locale.territory_from_host("a.b.com.au")
+{:ok, :AU}
-iex> Cldr.Locale.territory_from_host("a.b.com")
-{:error,
- {Cldr.UnknownLocaleError, "No locale was identified for territory \"com\""}}
pluralize(number, locale_name, substitution
Examples
-
iex> Bonfire.Common.Localise.Cldr.Number.Cardinal.pluralize 1, "en", %{one: "one"}
+
iex> Bonfire.Common.Localise.Cldr.Number.Cardinal.pluralize 1, "en", %{one: "one"}
"one"
-iex> Bonfire.Common.Localise.Cldr.Number.Cardinal.pluralize 2, "en", %{one: "one"}
+iex> Bonfire.Common.Localise.Cldr.Number.Cardinal.pluralize 2, "en", %{one: "one"}
nil
-iex> Bonfire.Common.Localise.Cldr.Number.Cardinal.pluralize 2, "en", %{one: "one", two: "two", other: "other"}
+iex> Bonfire.Common.Localise.Cldr.Number.Cardinal.pluralize 2, "en", %{one: "one", two: "two", other: "other"}
"other"
-iex> Bonfire.Common.Localise.Cldr.Number.Cardinal.pluralize 22, "en", %{one: "one", two: "two", other: "other"}
+iex> Bonfire.Common.Localise.Cldr.Number.Cardinal.pluralize 22, "en", %{one: "one", two: "two", other: "other"}
"other"
-iex> Bonfire.Common.Localise.Cldr.Number.Cardinal.pluralize Decimal.new(1), "en", %{one: "one"}
+iex> Bonfire.Common.Localise.Cldr.Number.Cardinal.pluralize Decimal.new(1), "en", %{one: "one"}
"one"
-iex> Bonfire.Common.Localise.Cldr.Number.Cardinal.pluralize Decimal.new(2), "en", %{one: "one"}
+iex> Bonfire.Common.Localise.Cldr.Number.Cardinal.pluralize Decimal.new(2), "en", %{one: "one"}
nil
-iex> Bonfire.Common.Localise.Cldr.Number.Cardinal.pluralize Decimal.new(2), "en", %{one: "one", two: "two"}
+iex> Bonfire.Common.Localise.Cldr.Number.Cardinal.pluralize Decimal.new(2), "en", %{one: "one", two: "two"}
nil
-iex> Bonfire.Common.Localise.Cldr.Number.Cardinal.pluralize 1..10, "ar", %{one: "one", few: "few", other: "other"}
+iex> Bonfire.Common.Localise.Cldr.Number.Cardinal.pluralize 1..10, "ar", %{one: "one", few: "few", other: "other"}
"few"
-iex> Bonfire.Common.Localise.Cldr.Number.Cardinal.pluralize 1..10, "en", %{one: "one", few: "few", other: "other"}
+iex> Bonfire.Common.Localise.Cldr.Number.Cardinal.pluralize 1..10, "en", %{one: "one", few: "few", other: "other"}
"other"
decimal_format_list()
Example
+"000 Tr ¤", ...]
#=> Bonfire.Common.Localise.Cldr.Number.Format.Format.decimal_format_list
-["#", "#,##,##0%",
+["#", "#,##,##0%",
"#,##,##0.###", "#,##,##0.00¤", "#,##,##0.00¤;(#,##,##0.00¤)",
"#,##,##0 %", "#,##0%", "#,##0.###", "#,##0.00 ¤",
"#,##0.00 ¤;(#,##0.00 ¤)", "#,##0.00¤", "#,##0.00¤;(#,##0.00¤)",
@@ -472,7 +472,7 @@
decimal_format_list()
"000 B ¤", "000 E ¤", "000 K ¤", "000 MRD ¤", "000 Md ¤", "000 Mio'.' ¤",
"000 Mio ¤", "000 Mld ¤", "000 Mln ¤", "000 Mn ¤", "000 Mrd'.' ¤",
"000 Mrd ¤", "000 Mr ¤", "000 M ¤", "000 NT ¤", "000 N ¤", "000 Tn ¤",
-"000 Tr ¤", ...]decimal_format_list_for(locale \\ Bonfire.C
Example
-
iex> Bonfire.Common.Localise.Cldr.Number.Format.decimal_format_list_for(:en)
-{:ok, ["#,##0%", "#,##0.###", "#,##0.00", "#,##0.00;(#,##0.00)","#E0",
+
+ "¤ 000T", "¤ 00B", "¤ 00K", "¤ 00M", "¤ 00T", "¤ 0B", "¤ 0K", "¤ 0M", "¤ 0T"]}iex> Bonfire.Common.Localise.Cldr.Number.Format.decimal_format_list_for(:en)
+{:ok, ["#,##0%", "#,##0.###", "#,##0.00", "#,##0.00;(#,##0.00)","#E0",
"0 billion", "0 million", "0 thousand",
"0 trillion", "00 billion", "00 million", "00 thousand", "00 trillion",
"000 billion", "000 million", "000 thousand", "000 trillion", "000B", "000K",
@@ -529,7 +529,7 @@
decimal_format_list_for(locale \\ Bonfire.C
"¤#,##0.00", "¤#,##0.00;(¤#,##0.00)", "¤000B", "¤000K", "¤000M",
"¤000T", "¤00B", "¤00K", "¤00M", "¤00T", "¤0B", "¤0K", "¤0M", "¤0T",
"¤ #,##0.00", "¤ #,##0.00;(¤ #,##0.00)", "¤ 000B", "¤ 000K", "¤ 000M",
- "¤ 000T", "¤ 00B", "¤ 00K", "¤ 00M", "¤ 00T", "¤ 0B", "¤ 0K", "¤ 0M", "¤ 0T"]}default_grouping_for(locale \\ Bonfire.Comm
Examples
-
+iex> Bonfire.Common.Localise.Cldr.Number.Format.default_grouping_for(:en)
-{:ok, %{fraction: %{first: 0, rest: 0}, integer: %{first: 3, rest: 3}}}
iex> Bonfire.Common.Localise.Cldr.Number.Format.default_grouping_for(:en)
+{:ok, %{fraction: %{first: 0, rest: 0}, integer: %{first: 3, rest: 3}}}
default_grouping_for!(locale)
Examples
-
+iex> Bonfire.Common.Localise.Cldr.Number.Format.default_grouping_for!(:en)
-%{fraction: %{first: 0, rest: 0}, integer: %{first: 3, rest: 3}}
iex> Bonfire.Common.Localise.Cldr.Number.Format.default_grouping_for!(:en)
+%{fraction: %{first: 0, rest: 0}, integer: %{first: 3, rest: 3}}
formats_for(locale \\ Bonfire.Common.Locali
percent: "#,##0 %",
scientific: "#E0",
standard: "#,##0.###"
- currency_short: [{"1000", [one: "0 k ¤", other: "0 k ¤"]},
- {"10000", [one: "00 k ¤", other: "00 k ¤"]},
- {"100000", [one: "000 k ¤", other: "000 k ¤"]},
- {"1000000", [one: "0 M ¤", other: "0 M ¤"]},
- {"10000000", [one: "00 M ¤", other: "00 M ¤"]},
- {"100000000", [one: "000 M ¤", other: "000 M ¤"]},
- {"1000000000", [one: "0 Md ¤", other: "0 Md ¤"]},
- {"10000000000", [one: "00 Md ¤", other: "00 Md ¤"]},
- {"100000000000", [one: "000 Md ¤", other: "000 Md ¤"]},
- {"1000000000000", [one: "0 Bn ¤", other: "0 Bn ¤"]},
- {"10000000000000", [one: "00 Bn ¤", other: "00 Bn ¤"]},
- {"100000000000000", [one: "000 Bn ¤", other: "000 Bn ¤"]}],
+ currency_short: [{"1000", [one: "0 k ¤", other: "0 k ¤"]},
+ {"10000", [one: "00 k ¤", other: "00 k ¤"]},
+ {"100000", [one: "000 k ¤", other: "000 k ¤"]},
+ {"1000000", [one: "0 M ¤", other: "0 M ¤"]},
+ {"10000000", [one: "00 M ¤", other: "00 M ¤"]},
+ {"100000000", [one: "000 M ¤", other: "000 M ¤"]},
+ {"1000000000", [one: "0 Md ¤", other: "0 Md ¤"]},
+ {"10000000000", [one: "00 Md ¤", other: "00 Md ¤"]},
+ {"100000000000", [one: "000 Md ¤", other: "000 Md ¤"]},
+ {"1000000000000", [one: "0 Bn ¤", other: "0 Bn ¤"]},
+ {"10000000000000", [one: "00 Bn ¤", other: "00 Bn ¤"]},
+ {"100000000000000", [one: "000 Bn ¤", other: "000 Bn ¤"]}],
...
}
minimum_grouping_digits_for(locale \\ Bonfi
Examples
-
+iex> Bonfire.Common.Localise.Cldr.Number.Format.minimum_grouping_digits_for("en")
-{:ok, 1}
iex> Bonfire.Common.Localise.Cldr.Number.Format.minimum_grouping_digits_for("en")
+{:ok, 1}
minimum_grouping_digits_for!(locale)
Examples
-iex> Bonfire.Common.Localise.Cldr.Number.Format.minimum_grouping_digits_for!("en")
+
iex> Bonfire.Common.Localise.Cldr.Number.Format.minimum_grouping_digits_for!("en")
1
pluralize(number, locale_name, substitution
Examples
-
iex> Bonfire.Common.Localise.Cldr.Number.Ordinal.pluralize 1, :en, %{one: "one"}
+
diff --git a/Bonfire.Common.Localise.Cldr.Number.PluralRule.Range.html b/Bonfire.Common.Localise.Cldr.Number.PluralRule.Range.html
index ad56d7fc720..5dbe1a99c2c 100644
--- a/Bonfire.Common.Localise.Cldr.Number.PluralRule.Range.html
+++ b/Bonfire.Common.Localise.Cldr.Number.PluralRule.Range.html
@@ -13,7 +13,7 @@
-
+
diff --git a/Bonfire.Common.Localise.Cldr.Number.Symbol.html b/Bonfire.Common.Localise.Cldr.Number.Symbol.html
index 0fe4df3ab2d..ef5c69d343a 100644
--- a/Bonfire.Common.Localise.Cldr.Number.Symbol.html
+++ b/Bonfire.Common.Localise.Cldr.Number.Symbol.html
@@ -13,7 +13,7 @@
-
+
@@ -372,9 +372,9 @@ iex> Bonfire.Common.Localise.Cldr.Number.Ordinal.pluralize 1, :en, %{one: "one"}
"one"
-iex> Bonfire.Common.Localise.Cldr.Number.Ordinal.pluralize 2, :en, %{one: "one"}
+iex> Bonfire.Common.Localise.Cldr.Number.Ordinal.pluralize 2, :en, %{one: "one"}
nil
-iex> Bonfire.Common.Localise.Cldr.Number.Ordinal.pluralize 2, :en, %{one: "one", two: "two"}
+iex> Bonfire.Common.Localise.Cldr.Number.Ordinal.pluralize 2, :en, %{one: "one", two: "two"}
"two"
-iex> Bonfire.Common.Localise.Cldr.Number.Ordinal.pluralize 22, :en, %{one: "one", two: "two", other: "other"}
+iex> Bonfire.Common.Localise.Cldr.Number.Ordinal.pluralize 22, :en, %{one: "one", two: "two", other: "other"}
"two"
-iex> Bonfire.Common.Localise.Cldr.Number.Ordinal.pluralize Decimal.new(1), :en, %{one: "one"}
+iex> Bonfire.Common.Localise.Cldr.Number.Ordinal.pluralize Decimal.new(1), :en, %{one: "one"}
"one"
-iex> Bonfire.Common.Localise.Cldr.Number.Ordinal.pluralize Decimal.new(2), :en, %{one: "one"}
+iex> Bonfire.Common.Localise.Cldr.Number.Ordinal.pluralize Decimal.new(2), :en, %{one: "one"}
nil
-iex> Bonfire.Common.Localise.Cldr.Number.Ordinal.pluralize Decimal.new(2), :en, %{one: "one", two: "two"}
+iex> Bonfire.Common.Localise.Cldr.Number.Ordinal.pluralize Decimal.new(2), :en, %{one: "one", two: "two"}
"two"
-iex> Bonfire.Common.Localise.Cldr.Number.Ordinal.pluralize 1..10, "ar", %{one: "one", few: "few", other: "other"}
+iex> Bonfire.Common.Localise.Cldr.Number.Ordinal.pluralize 1..10, "ar", %{one: "one", few: "few", other: "other"}
"other"
-iex> Bonfire.Common.Localise.Cldr.Number.Ordinal.pluralize 1..10, "en", %{one: "one", few: "few", other: "other"}
+iex> Bonfire.Common.Localise.Cldr.Number.Ordinal.pluralize 1..10, "en", %{one: "one", few: "few", other: "other"}
"other"
number_symbols_for(locale \\ Bonfire.Common
Example:
-
{Cldr.UnknownNumberSystemError,
+ "The number system :finance is unknown for the locale named :en. Valid number systems are %{default: :latn, native: :latn}"}
+}iex> Bonfire.Common.Localise.Cldr.Number.Symbol.number_symbols_for(:th)
-{:ok, %{
- latn: %Cldr.Number.Symbol{
+
+ }
+ }}iex> Bonfire.Common.Localise.Cldr.Number.Symbol.number_symbols_for(:th)
+{:ok, %{
+ latn: %Cldr.Number.Symbol{
decimal: ".",
exponential: "E",
group: ",",
@@ -387,8 +387,8 @@
number_symbols_for(locale \\ Bonfire.Common
plus_sign: "+",
superscripting_exponent: "×",
time_separator: ":"
- },
- thai: %Cldr.Number.Symbol{
+ },
+ thai: %Cldr.Number.Symbol{
decimal: ".",
exponential: "E",
group: ",",
@@ -401,8 +401,8 @@ number_symbols_for(locale \\ Bonfire.Common
plus_sign: "+",
superscripting_exponent: "×",
time_separator: ":"
- }
- }}number_system_for(locale, system_name)
Examples
+ iex> Bonfire.Common.Localise.Cldr.Number.System.number_system_for "th", :latn
-{:ok, %{digits: "0123456789", type: :numeric}}
+{:ok, %{digits: "0123456789", type: :numeric}}
iex> Bonfire.Common.Localise.Cldr.Number.System.number_system_for "en", :default
-{:ok, %{digits: "0123456789", type: :numeric}}
+{:ok, %{digits: "0123456789", type: :numeric}}
iex> Bonfire.Common.Localise.Cldr.Number.System.number_system_for "he", :traditional
-{:ok, %{rules: "hebrew", type: :algorithmic}}
+{:ok, %{rules: "hebrew", type: :algorithmic}}
iex> Bonfire.Common.Localise.Cldr.Number.System.number_system_for "en", :native
-{:ok, %{digits: "0123456789", type: :numeric}}
+{:ok, %{digits: "0123456789", type: :numeric}}
iex> Bonfire.Common.Localise.Cldr.Number.System.number_system_for "en", :finance
-{
+{
:error,
- {Cldr.UnknownNumberSystemError,
- "The number system :finance is unknown for the locale named :en. Valid number systems are %{default: :latn, native: :latn}"}
-}
number_system_names_for(locale)
Examples
+{:error, {Cldr.InvalidLanguageError, "The language \"zz\" is invalid"}}
iex> Bonfire.Common.Localise.Cldr.Number.System.number_system_names_for "en"
-{:ok, [:latn]}
+{:ok, [:latn]}
iex> Bonfire.Common.Localise.Cldr.Number.System.number_system_names_for "zz"
-{:error, {Cldr.InvalidLanguageError, "The language \"zz\" is invalid"}}
number_systems_for(locale)
Examples
+{:error, {Cldr.InvalidLanguageError, "The language \"zz\" is invalid"}}
iex> Bonfire.Common.Localise.Cldr.Number.System.number_systems_for "en"
-{:ok, %{default: :latn, native: :latn}}
+{:ok, %{default: :latn, native: :latn}}
iex> Bonfire.Common.Localise.Cldr.Number.System.number_systems_for "th"
-{:ok, %{default: :latn, native: :thai}}
+{:ok, %{default: :latn, native: :thai}}
iex> Bonfire.Common.Localise.Cldr.Number.System.number_systems_for "zz"
-{:error, {Cldr.InvalidLanguageError, "The language \"zz\" is invalid"}}
system_name_from(system_name, locale)
Examples
-ex> Bonfire.Common.Localise.Cldr.Number.System.system_name_from(:default, "en")
-{:ok, :latn}
+
ex> Bonfire.Common.Localise.Cldr.Number.System.system_name_from(:default, "en")
+{:ok, :latn}
-iex> Bonfire.Common.Localise.Cldr.Number.System.system_name_from("latn", "en")
-{:ok, :latn}
+iex> Bonfire.Common.Localise.Cldr.Number.System.system_name_from("latn", "en")
+{:ok, :latn}
-iex> Bonfire.Common.Localise.Cldr.Number.System.system_name_from(:native, "en")
-{:ok, :latn}
+iex> Bonfire.Common.Localise.Cldr.Number.System.system_name_from(:native, "en")
+{:ok, :latn}
-iex> Bonfire.Common.Localise.Cldr.Number.System.system_name_from(:nope, "en")
-{
+iex> Bonfire.Common.Localise.Cldr.Number.System.system_name_from(:nope, "en")
+{
:error,
- {Cldr.UnknownNumberSystemError, "The number system :nope is unknown"}
-}
to_system(number, system)
Examples
+{:ok, "壹佰贰拾叁"}
iex> Bonfire.Common.Localise.Cldr.Number.System.to_system 123456, :hebr
-{:ok, "קכ״ג׳תנ״ו"}
+{:ok, "קכ״ג׳תנ״ו"}
iex> Bonfire.Common.Localise.Cldr.Number.System.to_system 123, :hans
-{:ok, "一百二十三"}
+{:ok, "一百二十三"}
iex> Bonfire.Common.Localise.Cldr.Number.System.to_system 123, :hant
-{:ok, "一百二十三"}
+{:ok, "一百二十三"}
iex> Bonfire.Common.Localise.Cldr.Number.System.to_system 123, :hansfin
-{:ok, "壹佰贰拾叁"}
transliteration map is slow, pairs of transliterations can be configured so that the
transliteration map is created at compile time and therefore speeding up transliteration at
run time.
use Cldr
configuration
-in a backend module:defmodule MyApp.Cldr do
+in a backend module:
defmodule MyApp.Cldr do
use Cldr,
- locale: ["en", "fr", "th"],
+ locale: ["en", "fr", "th"],
default_locale: "en",
- precompile_transliterations: [{:latn, :thai}, {:arab, :thai}]
-end
:latn
to :thai
and from :arab
to :thai
.Cldr.Number.System.numeric_systems/0
.transliterate(sequence, locale \\ Bonfire.C
Examples
-
iex> Bonfire.Common.Localise.Cldr.Number.Transliterate.transliterate("123556")
+
diff --git a/Bonfire.Common.Localise.Cldr.Number.html b/Bonfire.Common.Localise.Cldr.Number.html
index 26b47cfe3a8..880feee74e2 100644
--- a/Bonfire.Common.Localise.Cldr.Number.html
+++ b/Bonfire.Common.Localise.Cldr.Number.html
@@ -13,7 +13,7 @@
-
+
@@ -435,19 +435,19 @@ iex> Bonfire.Common.Localise.Cldr.Number.Transliterate.transliterate("123556")
"123556"
-iex> Bonfire.Common.Localise.Cldr.Number.Transliterate.transliterate("123,556.000", "fr", :default)
+iex> Bonfire.Common.Localise.Cldr.Number.Transliterate.transliterate("123,556.000", "fr", :default)
"123 556,000"
-iex> Bonfire.Common.Localise.Cldr.Number.Transliterate.transliterate("123556", "th", :default)
+iex> Bonfire.Common.Localise.Cldr.Number.Transliterate.transliterate("123556", "th", :default)
"123556"
-iex> Bonfire.Common.Localise.Cldr.Number.Transliterate.transliterate("123556", "th", "thai")
+iex> Bonfire.Common.Localise.Cldr.Number.Transliterate.transliterate("123556", "th", "thai")
"๑๒๓๕๕๖"
-iex> Bonfire.Common.Localise.Cldr.Number.Transliterate.transliterate("123556", "th", :native)
+iex> Bonfire.Common.Localise.Cldr.Number.Transliterate.transliterate("123556", "th", :native)
"๑๒๓๕๕๖"
-iex> Bonfire.Common.Localise.Cldr.Number.Transliterate.transliterate("Some number is: 123556", "th", "thai")
+iex> Bonfire.Common.Localise.Cldr.Number.Transliterate.transliterate("Some number is: 123556", "th", "thai")
"Some number is: ๑๒๓๕๕๖"
parse(string, options \\ [])
Examples
-iex> Bonfire.Common.Localise.Cldr.Number.parse("+1.000,34", locale: "de")
-{:ok, 1000.34}
+
+iex> Bonfire.Common.Localise.Cldr.Number.parse("+1.000,34", locale: "de", number: :integer)
+{:error,
+ {Cldr.Number.ParseError,
+ "The string \"+1.000,34\" could not be parsed as a number"}}iex> Bonfire.Common.Localise.Cldr.Number.parse("+1.000,34", locale: "de")
+{:ok, 1000.34}
-iex> Bonfire.Common.Localise.Cldr.Number.parse("-1_000_000.34")
-{:ok, -1000000.34}
+iex> Bonfire.Common.Localise.Cldr.Number.parse("-1_000_000.34")
+{:ok, -1000000.34}
-iex> Bonfire.Common.Localise.Cldr.Number.parse("1.000", locale: "de", number: :integer)
-{:ok, 1000}
+iex> Bonfire.Common.Localise.Cldr.Number.parse("1.000", locale: "de", number: :integer)
+{:ok, 1000}
-iex> Bonfire.Common.Localise.Cldr.Number.parse("+1.000,34", locale: "de", number: :integer)
-{:error,
- {Cldr.Number.ParseError,
- "The string \"+1.000,34\" could not be parsed as a number"}}
resolve_currencies(list, options \\ [])
Examples
-iex> Bonfire.Common.Localise.Cldr.Number.scan("100 US dollars")
+
+iex> Bonfire.Common.Localise.Cldr.Number.scan("100 dollars des États-Unis")
+...> |> Bonfire.Common.Localise.Cldr.Number.resolve_currencies(locale: "fr")
+[100, :USD]iex> Bonfire.Common.Localise.Cldr.Number.scan("100 US dollars")
...> |> Bonfire.Common.Localise.Cldr.Number.resolve_currencies
-[100, :USD]
+[100, :USD]
-iex> Bonfire.Common.Localise.Cldr.Number.scan("100 eurosports")
-...> |> Bonfire.Common.Localise.Cldr.Number.resolve_currencies(fuzzy: 0.75)
-[100, :EUR]
+iex> Bonfire.Common.Localise.Cldr.Number.scan("100 eurosports")
+...> |> Bonfire.Common.Localise.Cldr.Number.resolve_currencies(fuzzy: 0.75)
+[100, :EUR]
-iex> Bonfire.Common.Localise.Cldr.Number.scan("100 dollars des États-Unis")
-...> |> Bonfire.Common.Localise.Cldr.Number.resolve_currencies(locale: "fr")
-[100, :USD]
resolve_currency(string, options \\ [])
Examples
-iex> Bonfire.Common.Localise.Cldr.Number.resolve_currency("US dollars")
-[:USD]
+
+iex> Bonfire.Common.Localise.Cldr.Number.resolve_currency("not a known currency", locale: "fr")
+{:error,
+ {Cldr.UnknownCurrencyError,
+ "The currency \"not a known currency\" is unknown or not supported"}}iex> Bonfire.Common.Localise.Cldr.Number.resolve_currency("US dollars")
+[:USD]
-iex> Bonfire.Common.Localise.Cldr.Number.resolve_currency("100 eurosports", fuzzy: 0.75)
-[:EUR]
+iex> Bonfire.Common.Localise.Cldr.Number.resolve_currency("100 eurosports", fuzzy: 0.75)
+[:EUR]
-iex> Bonfire.Common.Localise.Cldr.Number.resolve_currency("dollars des États-Unis", locale: "fr")
-[:USD]
+iex> Bonfire.Common.Localise.Cldr.Number.resolve_currency("dollars des États-Unis", locale: "fr")
+[:USD]
-iex> Bonfire.Common.Localise.Cldr.Number.resolve_currency("not a known currency", locale: "fr")
-{:error,
- {Cldr.UnknownCurrencyError,
- "The currency \"not a known currency\" is unknown or not supported"}}
resolve_per(string, options \\ [])
Examples
+iex> Bonfire.Common.Localise.Cldr.Number.resolve_per "11%"
-["11", :percent]
+["11", :percent]
iex> Bonfire.Common.Localise.Cldr.Number.resolve_per "% of linguists"
-[:percent, " of linguists"]
+[:percent, " of linguists"]
iex> Bonfire.Common.Localise.Cldr.Number.resolve_per "% of linguists %"
-[:percent, " of linguists ", :percent]
resolve_pers(list, options \\ [])
Examples
-
+iex> Bonfire.Common.Localise.Cldr.Number.scan("100%")
-...> |> Bonfire.Common.Localise.Cldr.Number.resolve_pers()
-[100, :percent]
iex> Bonfire.Common.Localise.Cldr.Number.scan("100%")
+...> |> Bonfire.Common.Localise.Cldr.Number.resolve_pers()
+[100, :percent]
scan(string, options \\ [])
Examples
-iex> Bonfire.Common.Localise.Cldr.Number.scan("£1_000_000.34")
-["£", 1000000.34]
+
+iex> Bonfire.Common.Localise.Cldr.Number.scan("The loss is -1.000 euros", locale: "de", number: :integer)
+["The loss is ", -1000, " euros"]iex> Bonfire.Common.Localise.Cldr.Number.scan("£1_000_000.34")
+["£", 1000000.34]
-iex> Bonfire.Common.Localise.Cldr.Number.scan("I want £1_000_000 dollars")
-["I want £", 1000000, " dollars"]
+iex> Bonfire.Common.Localise.Cldr.Number.scan("I want £1_000_000 dollars")
+["I want £", 1000000, " dollars"]
-iex> Bonfire.Common.Localise.Cldr.Number.scan("The prize is 23")
-["The prize is ", 23]
+iex> Bonfire.Common.Localise.Cldr.Number.scan("The prize is 23")
+["The prize is ", 23]
-iex> Bonfire.Common.Localise.Cldr.Number.scan("The lottery number is 23 for the next draw")
-["The lottery number is ", 23, " for the next draw"]
+iex> Bonfire.Common.Localise.Cldr.Number.scan("The lottery number is 23 for the next draw")
+["The lottery number is ", 23, " for the next draw"]
-iex> Bonfire.Common.Localise.Cldr.Number.scan("The loss is -1.000 euros", locale: "de", number: :integer)
-["The loss is ", -1000, " euros"]
to_approx_string(number, options \\ [])
Example
+{:ok, "~1,234"}
iex> Bonfire.Common.Localise.Cldr.Number.to_approx_string 1234
-{:ok, "~1,234"}
to_at_least_string(number, options \\ [])
Example
+{:ok, "1,234+"}
iex> Bonfire.Common.Localise.Cldr.Number.to_at_least_string 1234
-{:ok, "1,234+"}
to_at_most_string(number, options \\ [])Example
+{:ok, "≤1,234"}
iex> Bonfire.Common.Localise.Cldr.Number.to_at_most_string 1234
-{:ok, "≤1,234"}
to_range_string(range, options \\ [])
Example
+{:ok, "1,234–5,678"}
iex> Bonfire.Common.Localise.Cldr.Number.to_range_string 1234..5678
-{:ok, "1,234–5,678"}
to_string(number, options \\ default_option
iex> Cldr.Number.to_string(100, format: :currency, currency: :USD, wrapper: fn
+applied to the symbol than the number. For example:
iex> Cldr.Number.to_string(100, format: :currency, currency: :USD, wrapper: fn
...> string, :currency_symbol -> "<span class=\"symbol\">" <> string <> "</span>"
...> string, :number -> "<span class=\"number\">" <> string <> "</span>"
...> string, :currency_space -> "<span>" <> string <> "</span>"
...> string, _other -> string
-...> end)
-{:ok, "<span class=\"symbol\">$</span><span class=\"number\">100.00</span>"}
Phoenix.HTML.Tag.content_tag/3
+Phoenix.HTML.Tag.content_tag/3
function if wrapping HTML tags since these will ensure HTML entities are
-correctly encoded. For example:iex> Cldr.Number.to_string(100, format: :currency, currency: :USD, wrapper: fn
-...> string, :currency_symbol -> Phoenix.HTML.Tag.content_tag(:span, string, class: "symbol")
-...> string, :number -> Phoenix.HTML.Tag.content_tag(:span, string, class: "number")
-...> string, :currency_space -> Phoenix.HTML.Tag.content_tag(:span, string)
+correctly encoded. For example:
iex> Cldr.Number.to_string(100, format: :currency, currency: :USD, wrapper: fn
+...> string, :currency_symbol -> Phoenix.HTML.Tag.content_tag(:span, string, class: "symbol")
+...> string, :number -> Phoenix.HTML.Tag.content_tag(:span, string, class: "number")
+...> string, :currency_space -> Phoenix.HTML.Tag.content_tag(:span, string)
...> string, _other -> string
-...> end)
-{:ok, "<span class=\"symbol\">$</span><span class=\"number\">100.00</span>"}
to_string(number, options \\ default_option
Examples
iex> Bonfire.Common.Localise.Cldr.Number.to_string 12345
-{:ok, "12,345"}
+{:ok, "12,345"}
iex> Bonfire.Common.Localise.Cldr.Number.to_string 12345, locale: "fr"
-{:ok, "12 345"}
+{:ok, "12 345"}
iex> Bonfire.Common.Localise.Cldr.Number.to_string 1345.32, currency: :EUR, locale: "es", minimum_grouping_digits: 1
-{:ok, "1.345,32 €"}
+{:ok, "1.345,32 €"}
iex> Bonfire.Common.Localise.Cldr.Number.to_string 1345.32, currency: :EUR, locale: "es"
-{:ok, "1345,32 €"}
+{:ok, "1345,32 €"}
iex> Bonfire.Common.Localise.Cldr.Number.to_string 12345, locale: "fr", currency: "USD"
-{:ok, "12 345,00 $US"}
+{:ok, "12 345,00 $US"}
iex> Bonfire.Common.Localise.Cldr.Number.to_string 12345, format: "#E0"
-{:ok, "1.2345E4"}
+{:ok, "1.2345E4"}
iex> Bonfire.Common.Localise.Cldr.Number.to_string 12345, format: :accounting, currency: "THB"
-{:ok, "THB 12,345.00"}
+{:ok, "THB 12,345.00"}
iex> Bonfire.Common.Localise.Cldr.Number.to_string -12345, format: :accounting, currency: "THB"
-{:ok, "(THB 12,345.00)"}
+{:ok, "(THB 12,345.00)"}
iex> Bonfire.Common.Localise.Cldr.Number.to_string 12345, format: :accounting, currency: "THB",
...> locale: "th"
-{:ok, "฿12,345.00"}
+{:ok, "฿12,345.00"}
iex> Bonfire.Common.Localise.Cldr.Number.to_string 12345, format: :accounting, currency: "THB",
...> locale: "th", number_system: :native
-{:ok, "฿๑๒,๓๔๕.๐๐"}
+{:ok, "฿๑๒,๓๔๕.๐๐"}
iex> Bonfire.Common.Localise.Cldr.Number.to_string 1244.30, format: :long
-{:ok, "1 thousand"}
+{:ok, "1 thousand"}
iex> Bonfire.Common.Localise.Cldr.Number.to_string 1244.30, format: :long, currency: "USD"
-{:ok, "1,244 US dollars"}
+{:ok, "1,244 US dollars"}
iex> Bonfire.Common.Localise.Cldr.Number.to_string 1244.30, format: :short
-{:ok, "1K"}
+{:ok, "1K"}
iex> Bonfire.Common.Localise.Cldr.Number.to_string 1244.30, format: :short, currency: "EUR"
-{:ok, "€1K"}
+{:ok, "€1K"}
iex> Bonfire.Common.Localise.Cldr.Number.to_string 1234, format: :spellout
-{:ok, "one thousand two hundred thirty-four"}
+{:ok, "one thousand two hundred thirty-four"}
iex> Bonfire.Common.Localise.Cldr.Number.to_string 1234, format: :spellout_verbose
-{:ok, "one thousand two hundred and thirty-four"}
+{:ok, "one thousand two hundred and thirty-four"}
iex> Bonfire.Common.Localise.Cldr.Number.to_string 1989, format: :spellout_year
-{:ok, "nineteen eighty-nine"}
+{:ok, "nineteen eighty-nine"}
iex> Bonfire.Common.Localise.Cldr.Number.to_string 123, format: :ordinal
-{:ok, "123rd"}
+{:ok, "123rd"}
iex> Bonfire.Common.Localise.Cldr.Number.to_string 123, format: :roman
-{:ok, "CXXIII"}
+{:ok, "CXXIII"}
iex> Bonfire.Common.Localise.Cldr.Number.to_string 123, locale: "th-u-nu-thai"
-{:ok, "๑๒๓"}
+{:ok, "๑๒๓"}
Errors
{:error, reason}
will be returned if an error is detected.
-The two most likely causes of an error return are: iex> Bonfire.Common.Localise.Cldr.Number.to_string(12345, format: "0#")
- {:error, {Cldr.FormatCompileError,
- "Decimal format compiler: syntax error before: \"#\""}}
locale
and
+The two most likely causes of an error return are: iex> Bonfire.Common.Localise.Cldr.Number.to_string(12345, format: "0#")
+ {:error, {Cldr.FormatCompileError,
+ "Decimal format compiler: syntax error before: \"#\""}}
locale
and
number_system
. This happens typically when the number system is
:algorithmic
rather than the more common :numeric
. In this case the error
-return looks like:
+return looks like: iex> Bonfire.Common.Localise.Cldr.Number.to_string(1234, locale: "he", number_system: "hebr", format: :percent)
- {:error, {Cldr.UnknownFormatError,
- "The locale :he with number system :hebr does not define a format :percent"}}
iex> Bonfire.Common.Localise.Cldr.Number.to_string(1234, locale: "he", number_system: "hebr", format: :percent)
+ {:error, {Cldr.UnknownFormatError,
+ "The locale :he with number system :hebr does not define a format :percent"}}
validate_number_system(locale, number_syste
Examples
+{:error, {Cldr.InvalidLanguageError, "The language \"zz\" is invalid"}}
iex> Bonfire.Common.Localise.Cldr.Number.validate_number_system "en", :latn
-{:ok, :latn}
+{:ok, :latn}
iex> Bonfire.Common.Localise.Cldr.Number.validate_number_system "en", :default
-{:ok, :latn}
+{:ok, :latn}
iex> Bonfire.Common.Localise.Cldr.Number.validate_number_system "en", :unknown
-{:error,
- {Cldr.UnknownNumberSystemError, "The number system :unknown is unknown"}}
+{:error,
+ {Cldr.UnknownNumberSystemError, "The number system :unknown is unknown"}}
iex> Bonfire.Common.Localise.Cldr.Number.validate_number_system "zz", :default
-{:error, {Cldr.InvalidLanguageError, "The language \"zz\" is invalid"}}
Cldr.Number.to_string/2
function.iex> Bonfire.Common.Localise.Cldr.Rbnf.NumberSystem.rule_sets(:und)
-...> |> Enum.sort()
-[
+defined in the Unicode CLDR data repository. Available rules are identified by:
iex> Bonfire.Common.Localise.Cldr.Rbnf.NumberSystem.rule_sets(:und)
+...> |> Enum.sort()
+[
:armenian_lower,
:armenian_upper,
:cyrillic_lower,
@@ -155,9 +155,9 @@
:roman_upper,
:tamil,
:zz_default
-]iex> Bonfire.Common.Localise.Cldr.Rbnf.NumberSystem.roman_upper(123, :und)
-"CXXIII"
+]iex> Bonfire.Common.Localise.Cldr.Number.to_string(123, format: :roman)
-{:ok, "CXXIII"}
iex> Bonfire.Common.Localise.Cldr.Rbnf.NumberSystem.roman_upper(123, :und)
+"CXXIII"
iex> Bonfire.Common.Localise.Cldr.Number.to_string(123, format: :roman)
+{:ok, "CXXIII"}
Cldr.Number.to_string/2
function.iex> Bonfire.Common.Localise.Cldr.Rbnf.Ordinal.rule_sets(:en)
-[:digits_ordinal]
+defined in the Unicode CLDR data repository. Available rules are identified by:
iex> Bonfire.Common.Localise.Cldr.Rbnf.Ordinal.rule_sets(:en)
+[:digits_ordinal]
-iex> Bonfire.Common.Localise.Cldr.Rbnf.Ordinal.rule_sets("fr")
-...> |> Enum.sort()
-[
+iex> Bonfire.Common.Localise.Cldr.Rbnf.Ordinal.rule_sets("fr")
+...> |> Enum.sort()
+[
:digits_ordinal,
:digits_ordinal_feminine,
:digits_ordinal_feminine_plural,
:digits_ordinal_masculine,
:digits_ordinal_masculine_plural
-]
iex> Bonfire.Common.Localise.Cldr.Rbnf.Ordinal.digits_ordinal(123, :en)
-"123rd"
+]iex> Bonfire.Common.Localise.Cldr.Number.to_string(123, format: :ordinal)
-{:ok, "123rd"}
iex> Bonfire.Common.Localise.Cldr.Rbnf.Ordinal.digits_ordinal(123, :en)
+"123rd"
iex> Bonfire.Common.Localise.Cldr.Number.to_string(123, format: :ordinal)
+{:ok, "123rd"}
Cldr.Number.to_string/2
function.iex> Bonfire.Common.Localise.Cldr.Rbnf.Spellout.rule_sets("en")
-...> |> Enum.sort()
-[
+defined in the Unicode CLDR data repository. Available rules are identified by:
iex> Bonfire.Common.Localise.Cldr.Rbnf.Spellout.rule_sets("en")
+...> |> Enum.sort()
+[
:spellout_cardinal,
:spellout_cardinal_verbose,
:spellout_numbering,
@@ -149,9 +149,9 @@
:spellout_numbering_year,
:spellout_ordinal,
:spellout_ordinal_verbose
-]iex> Bonfire.Common.Localise.Cldr.Rbnf.Spellout.spellout_ordinal(123, "en")
-"one hundred twenty-third"
+]iex> Bonfire.Common.Localise.Cldr.Number.to_string(123, format: :spellout)
-{:ok, "one hundred twenty-three"}
iex> Bonfire.Common.Localise.Cldr.Rbnf.Spellout.spellout_ordinal(123, "en")
+"one hundred twenty-third"
iex> Bonfire.Common.Localise.Cldr.Number.to_string(123, format: :spellout)
+{:ok, "one hundred twenty-three"}
to_string(from, to, options \\ [])
Examples
+{:ok, "10:00:00 AM –"}
iex> Bonfire.Common.Localise.Cldr.Time.Interval.to_string ~T[10:00:00], ~T[10:03:00], format: :short
-{:ok, "10 – 10 AM"}
+{:ok, "10 – 10 AM"}
iex> Bonfire.Common.Localise.Cldr.Time.Interval.to_string ~T[10:00:00], ~T[10:03:00], format: :medium
-{:ok, "10:00 – 10:03 AM"}
+{:ok, "10:00 – 10:03 AM"}
iex> Bonfire.Common.Localise.Cldr.Time.Interval.to_string ~T[10:00:00], ~T[10:03:00], format: :long
-{:ok, "10:00 – 10:03 AM"}
+{:ok, "10:00 – 10:03 AM"}
iex> Bonfire.Common.Localise.Cldr.Time.Interval.to_string ~T[10:00:00], ~T[10:03:00],
...> format: :long, style: :flex
-{:ok, "10:00 – 10:03 in the morning"}
+{:ok, "10:00 – 10:03 in the morning"}
iex> Bonfire.Common.Localise.Cldr.Time.Interval.to_string ~U[2020-01-01 00:00:00.0Z], ~U[2020-01-01 10:00:00.0Z],
...> format: :long, style: :flex
-{:ok, "12:00 – 10:00 in the morning"}
+{:ok, "12:00 – 10:00 in the morning"}
iex> Bonfire.Common.Localise.Cldr.Time.Interval.to_string ~U[2020-01-01 00:00:00.0Z], ~U[2020-01-01 10:00:00.0Z],
...> format: :long, style: :zone
-{:ok, "12:00 – 10:00 AM Etc/UTC"}
+{:ok, "12:00 – 10:00 AM Etc/UTC"}
iex> Bonfire.Common.Localise.Cldr.Time.Interval.to_string ~T[10:00:00], ~T[10:03:00],
...> format: :long, style: :flex, locale: "th"
-{:ok, "10:00 – 10:03 ในตอนเช้า"}
+{:ok, "10:00 – 10:03 ในตอนเช้า"}
iex> Bonfire.Common.Localise.Cldr.Time.Interval.to_string ~T[10:00:00], nil
-{:ok, "10:00:00 AM –"}
to_string(time, options \\ [])
Examples
+{:ok, "11:59:59 PM UTC"}
iex> Cldr.Time.to_string ~T[07:35:13.215217]
-{:ok, "7:35:13 AM"}
+{:ok, "7:35:13 AM"}
iex> Cldr.Time.to_string ~T[07:35:13.215217], format: :short
-{:ok, "7:35 AM"}
+{:ok, "7:35 AM"}
iex> Cldr.Time.to_string ~T[07:35:13.215217], format: :medium, locale: "fr"
-{:ok, "07:35:13"}
+{:ok, "07:35:13"}
iex> Cldr.Time.to_string ~T[07:35:13.215217], format: :medium
-{:ok, "7:35:13 AM"}
+{:ok, "7:35:13 AM"}
-iex> {:ok, datetime} = DateTime.from_naive(~N[2000-01-01 23:59:59.0], "Etc/UTC")
+iex> {:ok, datetime} = DateTime.from_naive(~N[2000-01-01 23:59:59.0], "Etc/UTC")
iex> Cldr.Time.to_string datetime, format: :long
-{:ok, "11:59:59 PM UTC"}
to_string!(time, options \\ [])
"7:35 AM"
iex> Bonfire.Common.Localise.Cldr.Time.to_string ~T[07:35:13.215217], format: :short, period: :variant
-{:ok, "7:35 AM"}
+{:ok, "7:35 AM"}
iex> Bonfire.Common.Localise.Cldr.Time.to_string! ~T[07:35:13.215217], format: :medium, locale: "fr"
"07:35:13"
@@ -334,7 +334,7 @@ to_string!(time, options \\ [])
iex> Bonfire.Common.Localise.Cldr.Time.to_string! ~T[07:35:13.215217], format: :medium
"7:35:13 AM"
-iex> {:ok, datetime} = DateTime.from_naive(~N[2000-01-01 23:59:59.0], "Etc/UTC")
+iex> {:ok, datetime} = DateTime.from_naive(~N[2000-01-01 23:59:59.0], "Etc/UTC")
iex> Bonfire.Common.Localise.Cldr.Time.to_string! datetime, format: :long
"11:59:59 PM UTC"
localize(unit, options \\ [])
Examples
-
+iex> unit = Cldr.Unit.new!(1.83, :meter)
-iex> Bonfire.Common.Localise.Cldr.Unit.localize(unit, usage: :person_height, territory: :US)
-[
- Cldr.Unit.new!(:foot, 6, usage: :person_height),
- Cldr.Unit.new!(:inch, "0.04724409448818897637795275598", usage: :person_height)
-]
iex> unit = Cldr.Unit.new!(1.83, :meter)
+iex> Bonfire.Common.Localise.Cldr.Unit.localize(unit, usage: :person_height, territory: :US)
+[
+ Cldr.Unit.new!(:foot, 6, usage: :person_height),
+ Cldr.Unit.new!(:inch, "0.04724409448818897637795275598", usage: :person_height)
+]
parse(unit_string, options \\ [])
Examples
+iex> Bonfire.Common.Localise.Cldr.Unit.parse("42 millispangels")
+{:error, {Cldr.UnknownUnitError, "Unknown unit was detected at \"spangels\""}}
iex> Bonfire.Common.Localise.Cldr.Unit.parse "1kg"
-Cldr.Unit.new(1, :kilogram)
+Cldr.Unit.new(1, :kilogram)
iex> Bonfire.Common.Localise.Cldr.Unit.parse "1 tages", locale: "de"
-Cldr.Unit.new(1, :day)
+Cldr.Unit.new(1, :day)
iex> Bonfire.Common.Localise.Cldr.Unit.parse "1 tag", locale: "de"
-Cldr.Unit.new(1, :day)
+Cldr.Unit.new(1, :day)
-iex> Bonfire.Common.Localise.Cldr.Unit.parse("42 millispangels")
-{:error, {Cldr.UnknownUnitError, "Unknown unit was detected at \"spangels\""}}
parse!(unit_string, options \\ [])
Examples
iex> Bonfire.Common.Localise.Cldr.Unit.parse! "1kg"
-Cldr.Unit.new!(1, :kilogram)
+Cldr.Unit.new!(1, :kilogram)
iex> Bonfire.Common.Localise.Cldr.Unit.parse! "1 tages", locale: "de"
-Cldr.Unit.new!(1, :day)
+Cldr.Unit.new!(1, :day)
-iex> Bonfire.Common.Localise.Cldr.Unit.parse!("42 candela per lux")
-Cldr.Unit.new!(42, "candela per lux")
+iex> Bonfire.Common.Localise.Cldr.Unit.parse!("42 candela per lux")
+Cldr.Unit.new!(42, "candela per lux")
-iex> Bonfire.Common.Localise.Cldr.Unit.parse!("42 millispangels")
+iex> Bonfire.Common.Localise.Cldr.Unit.parse!("42 millispangels")
** (Cldr.UnknownUnitError) Unknown unit was detected at "spangels"
parse_unit_name(unit_name_string, options \
Examples
+iex> Bonfire.Common.Localise.Cldr.Unit.parse_unit_name("millispangels")
+{:error, {Cldr.UnknownUnitError, "Unknown unit was detected at \"spangels\""}}
iex> Bonfire.Common.Localise.Cldr.Unit.parse_unit_name "kg"
-{:ok, :kilogram}
+{:ok, :kilogram}
iex> Bonfire.Common.Localise.Cldr.Unit.parse_unit_name "w"
-{:ok, :watt}
+{:ok, :watt}
iex> Bonfire.Common.Localise.Cldr.Unit.parse_unit_name "w", only: :duration
-{:ok, :week}
+{:ok, :week}
-iex> Bonfire.Common.Localise.Cldr.Unit.parse_unit_name "m", only: [:year, :month, :day]
-{:ok, :month}
+iex> Bonfire.Common.Localise.Cldr.Unit.parse_unit_name "m", only: [:year, :month, :day]
+{:ok, :month}
iex> Bonfire.Common.Localise.Cldr.Unit.parse_unit_name "tages", locale: "de"
-{:ok, :day}
+{:ok, :day}
iex> Bonfire.Common.Localise.Cldr.Unit.parse_unit_name "tag", locale: "de"
-{:ok, :day}
+{:ok, :day}
-iex> Bonfire.Common.Localise.Cldr.Unit.parse_unit_name("millispangels")
-{:error, {Cldr.UnknownUnitError, "Unknown unit was detected at \"spangels\""}}
parse_unit_name!(unit_name_string, options
iex> Bonfire.Common.Localise.Cldr.Unit.parse_unit_name! "w", only: :duration
:week
-iex> Bonfire.Common.Localise.Cldr.Unit.parse_unit_name! "m", only: [:year, :month, :day]
+iex> Bonfire.Common.Localise.Cldr.Unit.parse_unit_name! "m", only: [:year, :month, :day]
:month
iex> Bonfire.Common.Localise.Cldr.Unit.parse_unit_name! "tages", locale: "de"
@@ -1815,7 +1815,7 @@
parse_unit_name!(unit_name_string, options
iex> Bonfire.Common.Localise.Cldr.Unit.parse_unit_name! "tag", locale: "de"
:day
-iex> Bonfire.Common.Localise.Cldr.Unit.parse_unit_name!("millispangels")
+iex> Bonfire.Common.Localise.Cldr.Unit.parse_unit_name!("millispangels")
** (Cldr.UnknownUnitError) Unknown unit was detected at "spangels"
preferred_units(unit, options \\ [])
Examples
-iex> meter = Cldr.Unit.new!(:meter, 1)
+
+{:ok, [:meter], [round_nearest: 1]}iex> meter = Cldr.Unit.new!(:meter, 1)
iex> Bonfire.Common.Localise.Cldr.Unit.preferred_units meter, locale: "en-US", usage: :person_height
-{:ok, [:foot, :inch], []}
+{:ok, [:foot, :inch], []}
iex> Bonfire.Common.Localise.Cldr.Unit.preferred_units meter, locale: "en-US", usage: :person
-{:ok, [:inch], []}
+{:ok, [:inch], []}
iex> Bonfire.Common.Localise.Cldr.Unit.preferred_units meter, locale: "en-AU", usage: :person
-{:ok, [:centimeter], []}
+{:ok, [:centimeter], []}
iex> Bonfire.Common.Localise.Cldr.Unit.preferred_units meter, locale: "en-US", usage: :road
-{:ok, [:foot], [round_nearest: 1]}
+{:ok, [:foot], [round_nearest: 1]}
iex> Bonfire.Common.Localise.Cldr.Unit.preferred_units meter, locale: "en-AU", usage: :road
-{:ok, [:meter], [round_nearest: 1]}
preferred_units!(unit, options \\ [])
Examples
-iex> meter = Cldr.Unit.new!(:meter, 2)
+
+[:meter]iex> meter = Cldr.Unit.new!(:meter, 2)
iex> Bonfire.Common.Localise.Cldr.Unit.preferred_units! meter, locale: "en-US", usage: :person_height
-[:foot, :inch]
+[:foot, :inch]
iex> Bonfire.Common.Localise.Cldr.Unit.preferred_units! meter, locale: "en-AU", usage: :person
-[:centimeter]
+[:centimeter]
iex> Bonfire.Common.Localise.Cldr.Unit.preferred_units! meter, locale: "en-US", usage: :road
-[:foot]
+[:foot]
iex> Bonfire.Common.Localise.Cldr.Unit.preferred_units! meter, locale: "en-AU", usage: :road
-[:meter]
to_iolist(number, options \\ [])
Examples
-
+iex> Bonfire.Common.Localise.Cldr.Unit.to_iolist Cldr.Unit.new!(:gallon, 123)
-{:ok, ["123", " gallons"]}
iex> Bonfire.Common.Localise.Cldr.Unit.to_iolist Cldr.Unit.new!(:gallon, 123)
+{:ok, ["123", " gallons"]}
to_iolist!(number, options \\ [])
Examples
+["123", " gallons"]
iex> Bonfire.Common.Localise.Cldr.Unit.to_iolist! 123, unit: :gallon
-["123", " gallons"]
to_string(number, options \\ [])
Examples
-iex> Bonfire.Common.Localise.Cldr.Unit.to_string Cldr.Unit.new!(:gallon, 123)
-{:ok, "123 gallons"}
+
+iex> Bonfire.Common.Localise.Cldr.Unit.to_string Cldr.Unit.new!(:megabyte, 1234), locale: "en", style: :unknown
+{:error, {Cldr.UnknownFormatError, "The unit style :unknown is not known."}}iex> Bonfire.Common.Localise.Cldr.Unit.to_string Cldr.Unit.new!(:gallon, 123)
+{:ok, "123 gallons"}
-iex> Bonfire.Common.Localise.Cldr.Unit.to_string Cldr.Unit.new!(:gallon, 1)
-{:ok, "1 gallon"}
+iex> Bonfire.Common.Localise.Cldr.Unit.to_string Cldr.Unit.new!(:gallon, 1)
+{:ok, "1 gallon"}
-iex> Bonfire.Common.Localise.Cldr.Unit.to_string Cldr.Unit.new!(:gallon, 1), locale: "af"
-{:ok, "1 gelling"}
+iex> Bonfire.Common.Localise.Cldr.Unit.to_string Cldr.Unit.new!(:gallon, 1), locale: "af"
+{:ok, "1 gelling"}
-iex> Bonfire.Common.Localise.Cldr.Unit.to_string Cldr.Unit.new!(:gallon, 1), locale: "af-NA"
-{:ok, "1 gelling"}
+iex> Bonfire.Common.Localise.Cldr.Unit.to_string Cldr.Unit.new!(:gallon, 1), locale: "af-NA"
+{:ok, "1 gelling"}
-iex> Bonfire.Common.Localise.Cldr.Unit.to_string Cldr.Unit.new!(:gallon, 1), locale: "bs"
-{:ok, "1 galon"}
+iex> Bonfire.Common.Localise.Cldr.Unit.to_string Cldr.Unit.new!(:gallon, 1), locale: "bs"
+{:ok, "1 galon"}
-iex> Bonfire.Common.Localise.Cldr.Unit.to_string Cldr.Unit.new!(:gallon, 1234), format: :long
-{:ok, "1 thousand gallons"}
+iex> Bonfire.Common.Localise.Cldr.Unit.to_string Cldr.Unit.new!(:gallon, 1234), format: :long
+{:ok, "1 thousand gallons"}
-iex> Bonfire.Common.Localise.Cldr.Unit.to_string Cldr.Unit.new!(:gallon, 1234), format: :short
-{:ok, "1K gallons"}
+iex> Bonfire.Common.Localise.Cldr.Unit.to_string Cldr.Unit.new!(:gallon, 1234), format: :short
+{:ok, "1K gallons"}
-iex> Bonfire.Common.Localise.Cldr.Unit.to_string Cldr.Unit.new!(:megahertz, 1234)
-{:ok, "1,234 megahertz"}
+iex> Bonfire.Common.Localise.Cldr.Unit.to_string Cldr.Unit.new!(:megahertz, 1234)
+{:ok, "1,234 megahertz"}
-iex> Bonfire.Common.Localise.Cldr.Unit.to_string Cldr.Unit.new!(:megahertz, 1234), style: :narrow
-{:ok, "1,234MHz"}
+iex> Bonfire.Common.Localise.Cldr.Unit.to_string Cldr.Unit.new!(:megahertz, 1234), style: :narrow
+{:ok, "1,234MHz"}
-iex> Bonfire.Common.Localise.Cldr.Unit.to_string Cldr.Unit.new!(:megabyte, 1234), locale: "en", style: :unknown
-{:error, {Cldr.UnknownFormatError, "The unit style :unknown is not known."}}
locale_name
in Cldr format or
false
based upon whether the locale name is configured in
-Gettext
.Gettext
.default_locale()
Example
-iex> Bonfire.Common.Localise.Cldr.default_locale()
-%Cldr.LanguageTag{
+
+ transform: %{},
+ language_variants: []
+}iex> Bonfire.Common.Localise.Cldr.default_locale()
+%Cldr.LanguageTag{
backend: Bonfire.Common.Localise.Cldr,
canonical_locale_name: "en-001",
cldr_locale_name: :"en-001",
- language_subtags: [],
- extensions: %{},
+ language_subtags: [],
+ extensions: %{},
gettext_locale_name: "en",
language: "en",
- locale: %{},
- private_use: [],
+ locale: %{},
+ private_use: [],
rbnf_locale_name: :en,
requested_locale_name: "en-001",
script: :Latn,
territory: :"001",
- transform: %{},
- language_variants: []
-}
default_territory()
Example
-iex> Bonfire.Common.Localise.Cldr.default_territory()
+
iex> Bonfire.Common.Localise.Cldr.default_territory()
:"001"
ellipsis(string, options \\ [])
Examples
-iex> Bonfire.Common.Localise.Cldr.ellipsis("And furthermore")
+
@@ -709,23 +709,23 @@ iex> Bonfire.Common.Localise.Cldr.ellipsis("And furthermore")
"And furthermore…"
-iex> Bonfire.Common.Localise.Cldr.ellipsis(["And furthermore", "there is much to be done"], locale: :ja)
+iex> Bonfire.Common.Localise.Cldr.ellipsis(["And furthermore", "there is much to be done"], locale: :ja)
"And furthermore…there is much to be done"
-iex> Bonfire.Common.Localise.Cldr.ellipsis("And furthermore", format: :word)
+iex> Bonfire.Common.Localise.Cldr.ellipsis("And furthermore", format: :word)
"And furthermore …"
-iex> Bonfire.Common.Localise.Cldr.ellipsis(["And furthermore", "there is much to be done"], locale: :ja, format: :word)
+iex> Bonfire.Common.Localise.Cldr.ellipsis(["And furthermore", "there is much to be done"], locale: :ja, format: :word)
"And furthermore … there is much to be done"
get_locale()
Example
-iex> Bonfire.Common.Localise.Cldr.put_locale("pl")
-iex> Bonfire.Common.Localise.Cldr.get_locale()
-%Cldr.LanguageTag{
+
+ transform: %{},
+ language_variants: []
+ }iex> Bonfire.Common.Localise.Cldr.put_locale("pl")
+iex> Bonfire.Common.Localise.Cldr.get_locale()
+%Cldr.LanguageTag{
backend: Elixir.Bonfire.Common.Localise.Cldr,
canonical_locale_name: "pl",
cldr_locale_name: :pl,
- extensions: %{},
+ extensions: %{},
language: "pl",
- locale: %{},
- private_use: [],
+ locale: %{},
+ private_use: [],
rbnf_locale_name: :pl,
territory: :PL,
requested_locale_name: "pl",
script: :Latn,
- transform: %{},
- language_variants: []
- }
known_gettext_locale_name(locale_name)
locale_name
in Cldr format or
false
based upon whether the locale name is configured in
-Gettext
.
+
Gettext
.
@@ -812,10 +812,10 @@
-known_gettext_locale_name(locale_name)
Examples
iex> Bonfire.Common.Localise.Cldr.known_gettext_locale_name("en")
+
iex> Bonfire.Common.Localise.Cldr.known_gettext_locale_name("en")
"en"
-iex> Bonfire.Common.Localise.Cldr.known_gettext_locale_name("en-SA")
+iex> Bonfire.Common.Localise.Cldr.known_gettext_locale_name("en-SA")
false
known_gettext_locale_name?(locale_name)
Examples
-iex> Bonfire.Common.Localise.Cldr.known_gettext_locale_name?("en")
+
@@ -935,10 +935,10 @@ iex> Bonfire.Common.Localise.Cldr.known_gettext_locale_name?("en")
true
-iex> Bonfire.Common.Localise.Cldr.known_gettext_locale_name?("!!")
+iex> Bonfire.Common.Localise.Cldr.known_gettext_locale_name?("!!")
false
known_locale_name(locale_name)
Examples
-iex> Bonfire.Common.Localise.Cldr.known_locale_name(:"en-AU")
+
@@ -980,10 +980,10 @@ iex> Bonfire.Common.Localise.Cldr.known_locale_name(:"en-AU")
:"en-AU"
-iex> Bonfire.Common.Localise.Cldr.known_locale_name(:"en-SA")
+iex> Bonfire.Common.Localise.Cldr.known_locale_name(:"en-SA")
false
known_locale_name?(locale_name)
Examples
-iex> Bonfire.Common.Localise.Cldr.known_locale_name?(:en)
+
@@ -1009,7 +1009,7 @@ iex> Bonfire.Common.Localise.Cldr.known_locale_name?(:en)
true
-iex> Bonfire.Common.Localise.Cldr.known_locale_name?(:"!!")
+iex> Bonfire.Common.Localise.Cldr.known_locale_name?(:"!!")
false
known_locale_names()
Gettext
.Gettext
.
known_number_system_types()
Example
-
+iex> Bonfire.Common.Localise.Cldr.known_number_system_types()
-[:default, :finance, :native, :traditional]
iex> Bonfire.Common.Localise.Cldr.known_number_system_types()
+[:default, :finance, :native, :traditional]
known_rbnf_locale_name(locale_name)
Examples
-iex> Bonfire.Common.Localise.Cldr.known_rbnf_locale_name(:en)
+
iex> Bonfire.Common.Localise.Cldr.known_rbnf_locale_name(:en)
:en
-iex> Bonfire.Common.Localise.Cldr.known_rbnf_locale_name(:"en-SA")
+iex> Bonfire.Common.Localise.Cldr.known_rbnf_locale_name(:"en-SA")
false
known_rbnf_locale_name?(locale_name)
Examples
-iex> Bonfire.Common.Localise.Cldr.known_rbnf_locale_name?(:en)
+
@@ -1288,14 +1288,14 @@ iex> Bonfire.Common.Localise.Cldr.known_rbnf_locale_name?(:en)
true
-iex> Bonfire.Common.Localise.Cldr.known_rbnf_locale_name?(:"!!")
+iex> Bonfire.Common.Localise.Cldr.known_rbnf_locale_name?(:"!!")
false
put_gettext_locale(locale)
Examples
+iex> Bonfire.Common.Localise.Cldr.put_gettext_locale(~l"de")
+{:error,
+ {Cldr.UnknownLocaleError,
+ "Locale #Cldr.LanguageTag<de [validated]> does not map to a known gettext locale name"}}iex> import Cldr.LanguageTag.Sigil
-iex> Bonfire.Common.Localise.Cldr.put_gettext_locale(~l"en")
-{:ok, "en"}
+iex> Bonfire.Common.Localise.Cldr.put_gettext_locale(~l"en")
+{:ok, "en"}
iex> import Cldr.LanguageTag.Sigil
-iex> Bonfire.Common.Localise.Cldr.put_gettext_locale(~l"de")
-{:error,
- {Cldr.UnknownLocaleError,
- "Locale #Cldr.LanguageTag<de [validated]> does not map to a known gettext locale name"}}
put_locale(locale_name)
Examples
-iex> Bonfire.Common.Localise.Cldr.put_locale("en")
-{:ok,
- %Cldr.LanguageTag{
+
+iex> Bonfire.Common.Localise.Cldr.put_locale("invalid-locale!")
+{:error, {Cldr.LanguageTag.ParseError,
+ "Expected a BCP47 language tag. Could not parse the remaining \"!\" starting at position 15"}}iex> Bonfire.Common.Localise.Cldr.put_locale("en")
+{:ok,
+ %Cldr.LanguageTag{
backend: Bonfire.Common.Localise.Cldr,
canonical_locale_name: "en",
cldr_locale_name: :en,
- language_subtags: [],
- extensions: %{},
+ language_subtags: [],
+ extensions: %{},
gettext_locale_name: "en",
language: "en",
- locale: %{},
- private_use: [],
+ locale: %{},
+ private_use: [],
rbnf_locale_name: :en,
requested_locale_name: "en",
script: :Latn,
territory: :US,
- transform: %{},
- language_variants: []
- }}
+ transform: %{},
+ language_variants: []
+ }}
-iex> Bonfire.Common.Localise.Cldr.put_locale("invalid-locale!")
-{:error, {Cldr.LanguageTag.ParseError,
- "Expected a BCP47 language tag. Could not parse the remaining \"!\" starting at position 15"}}
quote(string, options \\ [])
Examples
-iex> Bonfire.Common.Localise.Cldr.quote("Quoted String")
+
iex> Bonfire.Common.Localise.Cldr.quote("Quoted String")
"“Quoted String”"
-iex> Bonfire.Common.Localise.Cldr.quote("Quoted String", locale: :ja)
+iex> Bonfire.Common.Localise.Cldr.quote("Quoted String", locale: :ja)
"「Quoted String」"
validate_locale(locale)
Examples
-iex> Bonfire.Common.Localise.Cldr.validate_locale(:en)
-{:ok,
-%Cldr.LanguageTag{
+
+iex> Bonfire.Common.Localise.Cldr.validate_locale("zzz")
+{:error, {Cldr.InvalidLanguageError, "The language \"zzz\" is invalid"}}iex> Bonfire.Common.Localise.Cldr.validate_locale(:en)
+{:ok,
+%Cldr.LanguageTag{
backend: Bonfire.Common.Localise.Cldr,
canonical_locale_name: "en",
cldr_locale_name: :en,
- extensions: %{},
+ extensions: %{},
gettext_locale_name: "en",
language: "en",
- locale: %{},
- private_use: [],
+ locale: %{},
+ private_use: [],
rbnf_locale_name: :en,
requested_locale_name: "en",
script: :Latn,
territory: :US,
- transform: %{},
- language_variants: []
-}}
+ transform: %{},
+ language_variants: []
+}}
-iex> Bonfire.Common.Localise.Cldr.validate_locale Bonfire.Common.Localise.Cldr.default_locale()
-{:ok,
-%Cldr.LanguageTag{
+iex> Bonfire.Common.Localise.Cldr.validate_locale Bonfire.Common.Localise.Cldr.default_locale()
+{:ok,
+%Cldr.LanguageTag{
backend: Bonfire.Common.Localise.Cldr,
canonical_locale_name: "en-001",
cldr_locale_name: :"en-001",
- extensions: %{},
+ extensions: %{},
gettext_locale_name: "en",
language: "en",
- locale: %{},
- private_use: [],
+ locale: %{},
+ private_use: [],
rbnf_locale_name: :en,
requested_locale_name: "en-001",
script: :Latn,
territory: :"001",
- transform: %{},
- language_variants: []
-}}
+ transform: %{},
+ language_variants: []
+}}
-iex> Bonfire.Common.Localise.Cldr.validate_locale("zzz")
-{:error, {Cldr.InvalidLanguageError, "The language \"zzz\" is invalid"}}
validate_number_system_type(number_system_t
Examples
-
iex> Bonfire.Common.Localise.Cldr.validate_number_system_type(:default)
-{:ok, :default}
+
+ {Cldr.UnknownNumberSystemTypeError, "The number system type \"bork\" is invalid"}
+}iex> Bonfire.Common.Localise.Cldr.validate_number_system_type(:default)
+{:ok, :default}
-iex> Bonfire.Common.Localise.Cldr.validate_number_system_type(:traditional)
-{:ok, :traditional}
+iex> Bonfire.Common.Localise.Cldr.validate_number_system_type(:traditional)
+{:ok, :traditional}
-iex> Bonfire.Common.Localise.Cldr.validate_number_system_type(:latn)
-{
+iex> Bonfire.Common.Localise.Cldr.validate_number_system_type(:latn)
+{
:error,
- {Cldr.UnknownNumberSystemTypeError, "The number system type :latn is unknown"}
-}
+ {Cldr.UnknownNumberSystemTypeError, "The number system type :latn is unknown"}
+}
-iex> Bonfire.Common.Localise.Cldr.validate_number_system_type("bork")
-{
+iex> Bonfire.Common.Localise.Cldr.validate_number_system_type("bork")
+{
:error,
- {Cldr.UnknownNumberSystemTypeError, "The number system type \"bork\" is invalid"}
-}
# Plural translation
usage:
- <%= lp("Hi friend", "Hi friends", 2) %>
- <%= lp("Hiya %{user_or_users}", "Hiyas %{user_or_users}", 1, [user_or_users: "Bookchin"], "test context") %>
+ <%= lp("Hi friend", "Hi friends", 2) %>
+ <%= lp("Hiya %{user_or_users}", "Hiyas %{user_or_users}", 1, [user_or_users: "Bookchin"], "test context") %>
output:
Hi friends
diff --git a/Bonfire.Common.Localise.Gettext.Plural.html b/Bonfire.Common.Localise.Gettext.Plural.html
index 65a90d4e6df..90a7f920873 100644
--- a/Bonfire.Common.Localise.Gettext.Plural.html
+++ b/Bonfire.Common.Localise.Gettext.Plural.html
@@ -13,7 +13,7 @@
-
+
@@ -221,10 +221,10 @@ nplurals(locale_name)
Examples
-iex> Bonfire.Common.Localise.Gettext.Plural.nplurals("pl")
+
@@ -262,28 +262,28 @@ iex> Bonfire.Common.Localise.Gettext.Plural.nplurals("pl")
4
-iex> Bonfire.Common.Localise.Gettext.Plural.nplurals("en")
+iex> Bonfire.Common.Localise.Gettext.Plural.nplurals("en")
2
plural(locale, n)
Examples
-iex> Bonfire.Common.Localise.Gettext.Plural.plural("pl", 1)
+
diff --git a/Bonfire.Common.Localise.Gettext.html b/Bonfire.Common.Localise.Gettext.html
index a00247592e3..9f9a5720ab4 100644
--- a/Bonfire.Common.Localise.Gettext.html
+++ b/Bonfire.Common.Localise.Gettext.html
@@ -13,7 +13,7 @@
-
+
@@ -160,7 +160,7 @@ iex> Bonfire.Common.Localise.Gettext.Plural.plural("pl", 1)
0
-iex> Bonfire.Common.Localise.Gettext.Plural.plural("pl", 2)
+iex> Bonfire.Common.Localise.Gettext.Plural.plural("pl", 2)
1
-iex> Bonfire.Common.Localise.Gettext.Plural.plural("pl", 5)
+iex> Bonfire.Common.Localise.Gettext.Plural.plural("pl", 5)
2
-iex> Bonfire.Common.Localise.Gettext.Plural.plural("pl", 112)
+iex> Bonfire.Common.Localise.Gettext.Plural.plural("pl", 112)
2
-iex> Bonfire.Common.Localise.Gettext.Plural.plural("en", 1)
+iex> Bonfire.Common.Localise.Gettext.Plural.plural("en", 1)
0
-iex> Bonfire.Common.Localise.Gettext.Plural.plural("en", 2)
+iex> Bonfire.Common.Localise.Gettext.Plural.plural("en", 2)
1
-iex> Bonfire.Common.Localise.Gettext.Plural.plural("en", 112)
+iex> Bonfire.Common.Localise.Gettext.Plural.plural("en", 112)
1
-iex> Bonfire.Common.Localise.Gettext.Plural.plural("en_GB", 112)
+iex> Bonfire.Common.Localise.Gettext.Plural.plural("en_GB", 112)
1
Gettext.Backend.dgettext/3
.Gettext.Backend.dgettext/3
.
-
Gettext.Backend.dgettext_noop/2
.Gettext.Backend.dgettext_noop/2
.
-
Gettext.Backend.dngettext/5
.Gettext.Backend.dngettext/5
.
-
Gettext.Backend.dngettext_noop/3
.Gettext.Backend.dngettext_noop/3
.
-
Gettext.Backend.dpgettext/4
.Gettext.Backend.dpgettext/4
.
-
Gettext.Backend.dpngettext/6
.Gettext.Backend.dpngettext/6
.
-
Gettext.Backend.gettext/2
.Gettext.Backend.gettext/2
.
-
Gettext.Backend.gettext_comment/1
.Gettext.Backend.gettext_comment/1
.
-
Gettext.Backend.gettext_noop/1
.Gettext.Backend.gettext_noop/1
.
-
Gettext.Backend.handle_missing_bindings/2
.Gettext.Backend.handle_missing_bindings/2
.
-
Gettext.Backend.handle_missing_plural_translation/7
.Gettext.Backend.handle_missing_plural_translation/7
.
-
Gettext.Backend.handle_missing_translation/5
.Gettext.Backend.handle_missing_translation/5
.
-
Gettext.Backend.ngettext/4
.Gettext.Backend.ngettext/4
.
-
Gettext.Backend.ngettext_noop/2
.Gettext.Backend.ngettext_noop/2
.
-
Gettext.Backend.pgettext/3
.Gettext.Backend.pgettext/3
.
-
Gettext.Backend.pngettext/5
.Gettext.Backend.pngettext/5
.dgettext(domain, msgid, bindings \\ Macro.e
Gettext.Backend.dgettext/3
.Gettext.Backend.dgettext/3
.dgettext_noop(domain, msgid)
Gettext.Backend.dgettext_noop/2
.Gettext.Backend.dgettext_noop/2
.dngettext(domain, msgid, msgid_plural, n, b
Gettext.Backend.dngettext/5
.Gettext.Backend.dngettext/5
.dngettext_noop(domain, msgid, msgid_plural)
Gettext.Backend.dngettext_noop/3
.Gettext.Backend.dngettext_noop/3
.dpgettext(domain, msgctxt, msgid, bindings
Gettext.Backend.dpgettext/4
.Gettext.Backend.dpgettext/4
.dpngettext(domain, msgctxt, msgid, msgid_pl
Gettext.Backend.dpngettext/6
.Gettext.Backend.dpngettext/6
.gettext(msgid, bindings \\ Macro.escape(%{}
Gettext.Backend.gettext/2
.Gettext.Backend.gettext/2
.gettext_comment(comment)
Gettext.Backend.gettext_comment/1
.Gettext.Backend.gettext_comment/1
.gettext_noop(msgid)
Gettext.Backend.gettext_noop/1
.Gettext.Backend.gettext_noop/1
.handle_missing_bindings(exception, incomple
Gettext.Backend.handle_missing_bindings/2
.Gettext.Backend.handle_missing_bindings/2
.handle_missing_plural_translation(locale, d
Gettext.Backend.handle_missing_plural_translation/7
.Gettext.Backend.handle_missing_plural_translation/7
.handle_missing_translation(locale, domain,
Gettext.Backend.handle_missing_translation/5
.Gettext.Backend.handle_missing_translation/5
.ngettext(msgid, msgid_plural, n, bindings \
Gettext.Backend.ngettext/4
.Gettext.Backend.ngettext/4
.ngettext_noop(msgid, msgid_plural)
Gettext.Backend.ngettext_noop/2
.Gettext.Backend.ngettext_noop/2
.pgettext(msgctxt, msgid, bindings \\ Macro.
Gettext.Backend.pgettext/3
.Gettext.Backend.pgettext/3
.pngettext(msgctxt, msgid, msgid_plural, n,
Gettext.Backend.pngettext/5
.Gettext.Backend.pngettext/5
.
-
Ecto.Repo.aggregate/3
.Ecto.Repo.aggregate/3
.
-
Ecto.Repo.aggregate/4
.Ecto.Repo.aggregate/4
.
-
Ecto.Repo.all/2
.Ecto.Repo.all/2
.
-
Ecto.Repo.checked_out?/0
.Ecto.Repo.checked_out?/0
.
-
Ecto.Repo.checkout/2
.Ecto.Repo.checkout/2
.
-
Ecto.Repo.config/0
.Ecto.Repo.config/0
.
-
Ecto.Repo.default_options/1
.Ecto.Repo.default_options/1
.
-
Ecto.Repo.delete/2
.Ecto.Repo.delete/2
.
-
Ecto.Repo.delete!/2
.Ecto.Repo.delete!/2
.
-
Ecto.Repo.delete_all/2
.Ecto.Repo.delete_all/2
.
-
Ecto.Repo.exists?/2
.Ecto.Repo.exists?/2
.
-
Ecto.Repo.get/3
.Ecto.Repo.get/3
.
-
Ecto.Repo.get!/3
.Ecto.Repo.get!/3
.
-
Ecto.Repo.get_by/3
.Ecto.Repo.get_by/3
.
-
Ecto.Repo.get_by!/3
.Ecto.Repo.get_by!/3
.
-
Ecto.Repo.get_dynamic_repo/0
.Ecto.Repo.get_dynamic_repo/0
.
-
Ecto.Repo.in_transaction?/0
.Ecto.Repo.in_transaction?/0
.
-
Ecto.Repo.insert/2
.Ecto.Repo.insert/2
.
-
Ecto.Repo.insert!/2
.Ecto.Repo.insert!/2
.
-
Ecto.Repo.insert_all/3
.Ecto.Repo.insert_all/3
.
-
Ecto.Repo.insert_or_update/2
.Ecto.Repo.insert_or_update/2
.
-
Ecto.Repo.insert_or_update!/2
.Ecto.Repo.insert_or_update!/2
.
-
Ecto.Repo.load/2
.Ecto.Repo.load/2
.
-
Ecto.Repo.one/2
.Ecto.Repo.one/2
.
-
Ecto.Repo.one!/2
.Ecto.Repo.one!/2
.
-
Ecto.Repo.preload/3
.Ecto.Repo.preload/3
.
-
Ecto.Repo.prepare_query/3
.Ecto.Repo.prepare_query/3
.
-
Ecto.Repo.put_dynamic_repo/1
.Ecto.Repo.put_dynamic_repo/1
.
-
Ecto.Repo.reload/2
.Ecto.Repo.reload/2
.
-
Ecto.Repo.reload!/2
.Ecto.Repo.reload!/2
.
-
Ecto.Repo.rollback/1
.Ecto.Repo.rollback/1
.
-
Ecto.Repo.start_link/1
.Ecto.Repo.start_link/1
.
-
Ecto.Repo.stop/1
.Ecto.Repo.stop/1
.
-
Ecto.Repo.stream/2
.Ecto.Repo.stream/2
.
-
Ecto.Repo.transaction/2
.Ecto.Repo.transaction/2
.
-
Ecto.Repo.update/2
.Ecto.Repo.update/2
.
-
Ecto.Repo.update!/2
.Ecto.Repo.update!/2
.
-
Ecto.Repo.update_all/3
.Ecto.Repo.update_all/3
.aggregate(queryable, aggregate, opts \\ [])
Ecto.Repo.aggregate/3
.Ecto.Repo.aggregate/3
.aggregate(queryable, aggregate, field, opts
Ecto.Repo.aggregate/4
.Ecto.Repo.aggregate/4
.all(queryable, opts \\ [])
Ecto.Repo.all/2
.Ecto.Repo.all/2
.checked_out?()
Ecto.Repo.checked_out?/0
.Ecto.Repo.checked_out?/0
.checkout(fun, opts \\ [])
Ecto.Repo.checkout/2
.Ecto.Repo.checkout/2
.config()
Ecto.Repo.config/0
.Ecto.Repo.config/0
.default_options(operation)
Ecto.Repo.default_options/1
.Ecto.Repo.default_options/1
.delete(struct, opts \\ [])
Ecto.Repo.delete/2
.Ecto.Repo.delete/2
.delete!(struct, opts \\ [])
Ecto.Repo.delete!/2
.Ecto.Repo.delete!/2
.delete_all(queryable, opts \\ [])
Ecto.Repo.delete_all/2
.Ecto.Repo.delete_all/2
.disconnect_all(interval, opts \\ [])
Ecto.Adapters.SQL.disconnect_all/3
for more information.
See Ecto.Adapters.SQL.disconnect_all/3
for more information.
Callback implementation for Ecto.Repo.exists?/2
.
Callback implementation for Ecto.Repo.exists?/2
.
A convenience function for SQL-based repositories that executes an EXPLAIN statement or similar -depending on the adapter to obtain statistics for the given query.
See Ecto.Adapters.SQL.explain/4
for more information.
See Ecto.Adapters.SQL.explain/4
for more information.
Callback implementation for Ecto.Repo.get/3
.
Callback implementation for Ecto.Repo.get/3
.
Callback implementation for Ecto.Repo.get!/3
.
Callback implementation for Ecto.Repo.get!/3
.
Callback implementation for Ecto.Repo.get_by/3
.
Callback implementation for Ecto.Repo.get_by/3
.
Callback implementation for Ecto.Repo.get_by!/3
.
Callback implementation for Ecto.Repo.get_by!/3
.
Callback implementation for Ecto.Repo.get_dynamic_repo/0
.
Callback implementation for Ecto.Repo.get_dynamic_repo/0
.
Callback implementation for Ecto.Repo.in_transaction?/0
.
Callback implementation for Ecto.Repo.in_transaction?/0
.
Callback implementation for Ecto.Repo.insert/2
.
Callback implementation for Ecto.Repo.insert/2
.
Callback implementation for Ecto.Repo.insert!/2
.
Callback implementation for Ecto.Repo.insert!/2
.
Callback implementation for Ecto.Repo.insert_all/3
.
Callback implementation for Ecto.Repo.insert_all/3
.
Callback implementation for Ecto.Repo.insert_or_update/2
.
Callback implementation for Ecto.Repo.insert_or_update/2
.
Callback implementation for Ecto.Repo.insert_or_update!/2
.
Callback implementation for Ecto.Repo.insert_or_update!/2
.
Callback implementation for Ecto.Repo.load/2
.
Callback implementation for Ecto.Repo.load/2
.
Callback implementation for Ecto.Repo.one/2
.
Callback implementation for Ecto.Repo.one/2
.
Callback implementation for Ecto.Repo.one!/2
.
Callback implementation for Ecto.Repo.one!/2
.
Callback implementation for Ecto.Repo.preload/3
.
Callback implementation for Ecto.Repo.preload/3
.
Callback implementation for Ecto.Repo.prepare_query/3
.
Callback implementation for Ecto.Repo.prepare_query/3
.
Callback implementation for Ecto.Repo.put_dynamic_repo/1
.
Callback implementation for Ecto.Repo.put_dynamic_repo/1
.
A convenience function for SQL-based repositories that executes the given query.
See Ecto.Adapters.SQL.query/4
for more information.
A convenience function for SQL-based repositories that executes the given query.
See Ecto.Adapters.SQL.query/4
for more information.
A convenience function for SQL-based repositories that executes the given query.
See Ecto.Adapters.SQL.query!/4
for more information.
A convenience function for SQL-based repositories that executes the given query.
See Ecto.Adapters.SQL.query!/4
for more information.
A convenience function for SQL-based repositories that executes the given multi-result query.
See Ecto.Adapters.SQL.query_many/4
for more information.
A convenience function for SQL-based repositories that executes the given multi-result query.
See Ecto.Adapters.SQL.query_many/4
for more information.
A convenience function for SQL-based repositories that executes the given multi-result query.
See Ecto.Adapters.SQL.query_many!/4
for more information.
A convenience function for SQL-based repositories that executes the given multi-result query.
See Ecto.Adapters.SQL.query_many!/4
for more information.
Callback implementation for Ecto.Repo.reload/2
.
Callback implementation for Ecto.Repo.reload/2
.
Callback implementation for Ecto.Repo.reload!/2
.
Callback implementation for Ecto.Repo.reload!/2
.
Callback implementation for Ecto.Repo.rollback/1
.
Callback implementation for Ecto.Repo.rollback/1
.
Callback implementation for Ecto.Repo.start_link/1
.
Callback implementation for Ecto.Repo.start_link/1
.
Callback implementation for Ecto.Repo.stop/1
.
Callback implementation for Ecto.Repo.stop/1
.
Callback implementation for Ecto.Repo.stream/2
.
Callback implementation for Ecto.Repo.stream/2
.
A convenience function for SQL-based repositories that translates the given query to SQL.
See Ecto.Adapters.SQL.to_sql/3
for more information.
A convenience function for SQL-based repositories that translates the given query to SQL.
See Ecto.Adapters.SQL.to_sql/3
for more information.
Callback implementation for Ecto.Repo.transaction/2
.
Callback implementation for Ecto.Repo.transaction/2
.
Callback implementation for Ecto.Repo.update/2
.
Callback implementation for Ecto.Repo.update/2
.
Callback implementation for Ecto.Repo.update!/2
.
Callback implementation for Ecto.Repo.update!/2
.
Callback implementation for Ecto.Repo.update_all/3
.
Callback implementation for Ecto.Repo.update_all/3
.
@spec change_disabled(Ecto.Changeset.t()) :: Ecto.Changeset.t()+
@spec change_disabled(Ecto.Changeset.t()) :: Ecto.Changeset.t()
@spec change_muted(Ecto.Changeset.t()) :: Ecto.Changeset.t()+
@spec change_muted(Ecto.Changeset.t()) :: Ecto.Changeset.t()
@spec change_public(Ecto.Changeset.t()) :: Ecto.Changeset.t()+
@spec change_public(Ecto.Changeset.t()) :: Ecto.Changeset.t()
@spec validate_email(Ecto.Changeset.t(), atom()) :: Ecto.Changeset.t()+
@spec validate_email(Ecto.Changeset.t(), atom()) :: Ecto.Changeset.t()
@spec validate_email_domain(Ecto.Changeset.t(), atom()) :: Ecto.Changeset.t()
+ @spec validate_email_domain(Ecto.Changeset.t(), atom()) :: Ecto.Changeset.t()
diff --git a/Bonfire.Common.Repo.html b/Bonfire.Common.Repo.html
index cdeff5e9e60..0584197c648 100644
--- a/Bonfire.Common.Repo.html
+++ b/Bonfire.Common.Repo.html
@@ -13,7 +13,7 @@
-
+
@@ -159,7 +159,7 @@ Callback implementation for Ecto.Repo.aggregate/3
.
Callback implementation for Ecto.Repo.aggregate/3
.
Callback implementation for Ecto.Repo.aggregate/4
.
Callback implementation for Ecto.Repo.aggregate/4
.
Callback implementation for Ecto.Repo.all/2
.
Callback implementation for Ecto.Repo.all/2
.
Callback implementation for Ecto.Repo.checked_out?/0
.
Callback implementation for Ecto.Repo.checked_out?/0
.
Callback implementation for Ecto.Repo.checkout/2
.
Callback implementation for Ecto.Repo.checkout/2
.
Callback implementation for Ecto.Repo.config/0
.
Callback implementation for Ecto.Repo.config/0
.
Callback implementation for Ecto.Repo.default_options/1
.
Callback implementation for Ecto.Repo.default_options/1
.
Callback implementation for Ecto.Repo.delete/2
.
Callback implementation for Ecto.Repo.delete/2
.
Callback implementation for Ecto.Repo.delete!/2
.
Callback implementation for Ecto.Repo.delete!/2
.
Callback implementation for Ecto.Repo.delete_all/2
.
Callback implementation for Ecto.Repo.delete_all/2
.
Callback implementation for Ecto.Repo.exists?/2
.
Callback implementation for Ecto.Repo.exists?/2
.
Callback implementation for Ecto.Repo.get/3
.
Callback implementation for Ecto.Repo.get/3
.
Callback implementation for Ecto.Repo.get!/3
.
Callback implementation for Ecto.Repo.get!/3
.
Callback implementation for Ecto.Repo.get_by/3
.
Callback implementation for Ecto.Repo.get_by/3
.
Callback implementation for Ecto.Repo.get_by!/3
.
Callback implementation for Ecto.Repo.get_by!/3
.
Callback implementation for Ecto.Repo.get_dynamic_repo/0
.
Callback implementation for Ecto.Repo.get_dynamic_repo/0
.
Callback implementation for Ecto.Repo.in_transaction?/0
.
Callback implementation for Ecto.Repo.in_transaction?/0
.
Callback implementation for Ecto.Repo.insert/2
.
Callback implementation for Ecto.Repo.insert/2
.
Callback implementation for Ecto.Repo.insert!/2
.
Callback implementation for Ecto.Repo.insert!/2
.
Callback implementation for Ecto.Repo.insert_all/3
.
Callback implementation for Ecto.Repo.insert_all/3
.
Callback implementation for Ecto.Repo.insert_or_update/2
.
Callback implementation for Ecto.Repo.insert_or_update/2
.
Callback implementation for Ecto.Repo.insert_or_update!/2
.
Callback implementation for Ecto.Repo.insert_or_update!/2
.
Callback implementation for Ecto.Repo.load/2
.
Callback implementation for Ecto.Repo.load/2
.
Callback implementation for Ecto.Repo.one/2
.
Callback implementation for Ecto.Repo.one/2
.
Callback implementation for Ecto.Repo.one!/2
.
Callback implementation for Ecto.Repo.one!/2
.
Callback implementation for Ecto.Repo.preload/3
.
Callback implementation for Ecto.Repo.preload/3
.
Callback implementation for Ecto.Repo.prepare_query/3
.
Callback implementation for Ecto.Repo.prepare_query/3
.
Callback implementation for Ecto.Repo.put_dynamic_repo/1
.
Callback implementation for Ecto.Repo.put_dynamic_repo/1
.
Callback implementation for Ecto.Repo.reload/2
.
Callback implementation for Ecto.Repo.reload/2
.
Callback implementation for Ecto.Repo.reload!/2
.
Callback implementation for Ecto.Repo.reload!/2
.
Callback implementation for Ecto.Repo.rollback/1
.
Callback implementation for Ecto.Repo.rollback/1
.
Callback implementation for Ecto.Repo.start_link/1
.
Callback implementation for Ecto.Repo.start_link/1
.
Callback implementation for Ecto.Repo.stop/1
.
Callback implementation for Ecto.Repo.stop/1
.
Callback implementation for Ecto.Repo.stream/2
.
Callback implementation for Ecto.Repo.stream/2
.
Callback implementation for Ecto.Repo.transaction/2
.
Callback implementation for Ecto.Repo.transaction/2
.
Callback implementation for Ecto.Repo.update/2
.
Callback implementation for Ecto.Repo.update/2
.
Callback implementation for Ecto.Repo.update!/2
.
Callback implementation for Ecto.Repo.update!/2
.
Callback implementation for Ecto.Repo.update_all/3
.
Callback implementation for Ecto.Repo.update_all/3
.
Callback implementation for Ecto.Repo.aggregate/3
.
Callback implementation for Ecto.Repo.aggregate/3
.
Callback implementation for Ecto.Repo.aggregate/4
.
Callback implementation for Ecto.Repo.aggregate/4
.
Callback implementation for Ecto.Repo.all/2
.
Callback implementation for Ecto.Repo.all/2
.
Callback implementation for Ecto.Repo.checked_out?/0
.
Callback implementation for Ecto.Repo.checked_out?/0
.
Callback implementation for Ecto.Repo.checkout/2
.
Callback implementation for Ecto.Repo.checkout/2
.
Callback implementation for Ecto.Repo.config/0
.
Callback implementation for Ecto.Repo.config/0
.
Callback implementation for Ecto.Repo.default_options/1
.
Callback implementation for Ecto.Repo.default_options/1
.
Callback implementation for Ecto.Repo.delete/2
.
Callback implementation for Ecto.Repo.delete/2
.
Callback implementation for Ecto.Repo.delete!/2
.
Callback implementation for Ecto.Repo.delete!/2
.
Callback implementation for Ecto.Repo.delete_all/2
.
Callback implementation for Ecto.Repo.delete_all/2
.
A convenience function for SQL-based repositories that forces all connections in the -pool to disconnect within the given interval.
See Ecto.Adapters.SQL.disconnect_all/3
for more information.
See Ecto.Adapters.SQL.disconnect_all/3
for more information.
Callback implementation for Ecto.Repo.exists?/2
.
Callback implementation for Ecto.Repo.exists?/2
.
A convenience function for SQL-based repositories that executes an EXPLAIN statement or similar -depending on the adapter to obtain statistics for the given query.
See Ecto.Adapters.SQL.explain/4
for more information.
See Ecto.Adapters.SQL.explain/4
for more information.
Callback implementation for Ecto.Repo.get/3
.
Callback implementation for Ecto.Repo.get/3
.
Callback implementation for Ecto.Repo.get!/3
.
Callback implementation for Ecto.Repo.get!/3
.
Callback implementation for Ecto.Repo.get_by/3
.
Callback implementation for Ecto.Repo.get_by/3
.
Callback implementation for Ecto.Repo.get_by!/3
.
Callback implementation for Ecto.Repo.get_by!/3
.
Callback implementation for Ecto.Repo.get_dynamic_repo/0
.
Callback implementation for Ecto.Repo.get_dynamic_repo/0
.
Callback implementation for Ecto.Repo.in_transaction?/0
.
Callback implementation for Ecto.Repo.in_transaction?/0
.
Callback implementation for Ecto.Repo.insert/2
.
Callback implementation for Ecto.Repo.insert/2
.
Callback implementation for Ecto.Repo.insert!/2
.
Callback implementation for Ecto.Repo.insert!/2
.
Callback implementation for Ecto.Repo.insert_all/3
.
Callback implementation for Ecto.Repo.insert_all/3
.
Callback implementation for Ecto.Repo.insert_or_update/2
.
Callback implementation for Ecto.Repo.insert_or_update/2
.
Callback implementation for Ecto.Repo.insert_or_update!/2
.
Callback implementation for Ecto.Repo.insert_or_update!/2
.
Callback implementation for Ecto.Repo.load/2
.
Callback implementation for Ecto.Repo.load/2
.
Callback implementation for Ecto.Repo.one/2
.
Callback implementation for Ecto.Repo.one/2
.
Callback implementation for Ecto.Repo.one!/2
.
Callback implementation for Ecto.Repo.one!/2
.
Callback implementation for Ecto.Repo.preload/3
.
Callback implementation for Ecto.Repo.preload/3
.
Callback implementation for Ecto.Repo.prepare_query/3
.
Callback implementation for Ecto.Repo.prepare_query/3
.
Callback implementation for Ecto.Repo.put_dynamic_repo/1
.
Callback implementation for Ecto.Repo.put_dynamic_repo/1
.
A convenience function for SQL-based repositories that executes the given query.
See Ecto.Adapters.SQL.query/4
for more information.
A convenience function for SQL-based repositories that executes the given query.
See Ecto.Adapters.SQL.query/4
for more information.
A convenience function for SQL-based repositories that executes the given query.
See Ecto.Adapters.SQL.query!/4
for more information.
A convenience function for SQL-based repositories that executes the given query.
See Ecto.Adapters.SQL.query!/4
for more information.
A convenience function for SQL-based repositories that executes the given multi-result query.
See Ecto.Adapters.SQL.query_many/4
for more information.
A convenience function for SQL-based repositories that executes the given multi-result query.
See Ecto.Adapters.SQL.query_many/4
for more information.
A convenience function for SQL-based repositories that executes the given multi-result query.
See Ecto.Adapters.SQL.query_many!/4
for more information.
A convenience function for SQL-based repositories that executes the given multi-result query.
See Ecto.Adapters.SQL.query_many!/4
for more information.
Callback implementation for Ecto.Repo.reload/2
.
Callback implementation for Ecto.Repo.reload/2
.
Callback implementation for Ecto.Repo.reload!/2
.
Callback implementation for Ecto.Repo.reload!/2
.
Callback implementation for Ecto.Repo.rollback/1
.
Callback implementation for Ecto.Repo.rollback/1
.
Callback implementation for Ecto.Repo.start_link/1
.
Callback implementation for Ecto.Repo.start_link/1
.
Callback implementation for Ecto.Repo.stop/1
.
Callback implementation for Ecto.Repo.stop/1
.
Callback implementation for Ecto.Repo.stream/2
.
Callback implementation for Ecto.Repo.stream/2
.
A convenience function for SQL-based repositories that translates the given query to SQL.
See Ecto.Adapters.SQL.to_sql/3
for more information.
A convenience function for SQL-based repositories that translates the given query to SQL.
See Ecto.Adapters.SQL.to_sql/3
for more information.
Callback implementation for Ecto.Repo.transaction/2
.
Callback implementation for Ecto.Repo.transaction/2
.
Callback implementation for Ecto.Repo.update/2
.
Callback implementation for Ecto.Repo.update/2
.
Callback implementation for Ecto.Repo.update!/2
.
Callback implementation for Ecto.Repo.update!/2
.
Callback implementation for Ecto.Repo.update_all/3
.
Callback implementation for Ecto.Repo.update_all/3
.
fcwatch | mix test --stale --listen-on-stdin
to watch for
code changes and run stale tests, but with more control and
without the starting time penalty.Note that watching requires fswatch on your system.
-Eg on Mac run brew install fswatch
.
To use it, in your project's .iex
file add:
unless GenServer.whereis(Bonfire.Common.Test.Interactive) do
- {:ok, pid} = Bonfire.Common.Test.Interactive.start_link()
+Eg on Mac run brew install fswatch
.To use it, in your project's .iex
file add:
unless GenServer.whereis(Bonfire.Common.Test.Interactive) do
+ {:ok, pid} = Bonfire.Common.Test.Interactive.start_link()
# Process will not exit when the iex goes out
- Process.unlink(pid)
-end
+ Process.unlink(pid)
+end
import Bonfire.Common.Test.Interactive.Helpers
Then to call iex
and run tests just do:
MIX_ENV=test iex -S mix
The Bonfire.Common.Test.Interactive.Helpers
allows to call f
and s
and a
to run failed, stale and all tests respectively.
You can call w
to watch tests and uw
to unwatch.
diff --git a/Bonfire.Common.TestInstanceRepo.html b/Bonfire.Common.TestInstanceRepo.html
index 81aaaf811e7..ddf2c5214ba 100644
--- a/Bonfire.Common.TestInstanceRepo.html
+++ b/Bonfire.Common.TestInstanceRepo.html
@@ -13,7 +13,7 @@
-
+
@@ -155,7 +155,7 @@
- Callback implementation for Ecto.Repo.aggregate/3
.
+ Callback implementation for Ecto.Repo.aggregate/3
.
@@ -165,7 +165,7 @@
- Callback implementation for Ecto.Repo.aggregate/4
.
+ Callback implementation for Ecto.Repo.aggregate/4
.
@@ -175,7 +175,7 @@
- Callback implementation for Ecto.Repo.all/2
.
+ Callback implementation for Ecto.Repo.all/2
.
@@ -193,7 +193,7 @@
- Callback implementation for Ecto.Repo.checked_out?/0
.
+ Callback implementation for Ecto.Repo.checked_out?/0
.
@@ -203,7 +203,7 @@
- Callback implementation for Ecto.Repo.checkout/2
.
+ Callback implementation for Ecto.Repo.checkout/2
.
@@ -221,7 +221,7 @@
- Callback implementation for Ecto.Repo.config/0
.
+ Callback implementation for Ecto.Repo.config/0
.
@@ -239,7 +239,7 @@
- Callback implementation for Ecto.Repo.default_options/1
.
+ Callback implementation for Ecto.Repo.default_options/1
.
@@ -265,7 +265,7 @@
- Callback implementation for Ecto.Repo.delete/2
.
+ Callback implementation for Ecto.Repo.delete/2
.
@@ -275,7 +275,7 @@
- Callback implementation for Ecto.Repo.delete!/2
.
+ Callback implementation for Ecto.Repo.delete!/2
.
@@ -285,7 +285,7 @@
- Callback implementation for Ecto.Repo.delete_all/2
.
+ Callback implementation for Ecto.Repo.delete_all/2
.
@@ -316,7 +316,7 @@
- Callback implementation for Ecto.Repo.exists?/2
.
+ Callback implementation for Ecto.Repo.exists?/2
.
@@ -377,7 +377,7 @@
- Callback implementation for Ecto.Repo.get/3
.
+ Callback implementation for Ecto.Repo.get/3
.
@@ -387,7 +387,7 @@
- Callback implementation for Ecto.Repo.get!/3
.
+ Callback implementation for Ecto.Repo.get!/3
.
@@ -397,7 +397,7 @@
- Callback implementation for Ecto.Repo.get_by/3
.
+ Callback implementation for Ecto.Repo.get_by/3
.
@@ -407,7 +407,7 @@
- Callback implementation for Ecto.Repo.get_by!/3
.
+ Callback implementation for Ecto.Repo.get_by!/3
.
@@ -417,7 +417,7 @@
- Callback implementation for Ecto.Repo.get_dynamic_repo/0
.
+ Callback implementation for Ecto.Repo.get_dynamic_repo/0
.
@@ -427,7 +427,7 @@
- Callback implementation for Ecto.Repo.in_transaction?/0
.
+ Callback implementation for Ecto.Repo.in_transaction?/0
.
@@ -437,7 +437,7 @@
- Callback implementation for Ecto.Repo.insert/2
.
+ Callback implementation for Ecto.Repo.insert/2
.
@@ -447,7 +447,7 @@
- Callback implementation for Ecto.Repo.insert!/2
.
+ Callback implementation for Ecto.Repo.insert!/2
.
@@ -457,7 +457,7 @@
- Callback implementation for Ecto.Repo.insert_all/3
.
+ Callback implementation for Ecto.Repo.insert_all/3
.
@@ -491,7 +491,7 @@
- Callback implementation for Ecto.Repo.insert_or_update/2
.
+ Callback implementation for Ecto.Repo.insert_or_update/2
.
@@ -501,7 +501,7 @@
- Callback implementation for Ecto.Repo.insert_or_update!/2
.
+ Callback implementation for Ecto.Repo.insert_or_update!/2
.
@@ -511,7 +511,7 @@
- Callback implementation for Ecto.Repo.load/2
.
+ Callback implementation for Ecto.Repo.load/2
.
@@ -578,7 +578,7 @@
- Callback implementation for Ecto.Repo.one/2
.
+ Callback implementation for Ecto.Repo.one/2
.
@@ -588,7 +588,7 @@
- Callback implementation for Ecto.Repo.one!/2
.
+ Callback implementation for Ecto.Repo.one!/2
.
@@ -608,7 +608,7 @@
- Callback implementation for Ecto.Repo.preload/3
.
+ Callback implementation for Ecto.Repo.preload/3
.
@@ -638,7 +638,7 @@
- Callback implementation for Ecto.Repo.prepare_query/3
.
+ Callback implementation for Ecto.Repo.prepare_query/3
.
@@ -667,7 +667,7 @@
- Callback implementation for Ecto.Repo.put_dynamic_repo/1
.
+ Callback implementation for Ecto.Repo.put_dynamic_repo/1
.
@@ -727,7 +727,7 @@
- Callback implementation for Ecto.Repo.reload/2
.
+ Callback implementation for Ecto.Repo.reload/2
.
@@ -737,7 +737,7 @@
- Callback implementation for Ecto.Repo.reload!/2
.
+ Callback implementation for Ecto.Repo.reload!/2
.
@@ -747,7 +747,7 @@
- Callback implementation for Ecto.Repo.rollback/1
.
+ Callback implementation for Ecto.Repo.rollback/1
.
@@ -775,7 +775,7 @@
- Callback implementation for Ecto.Repo.start_link/1
.
+ Callback implementation for Ecto.Repo.start_link/1
.
@@ -785,7 +785,7 @@
- Callback implementation for Ecto.Repo.stop/1
.
+ Callback implementation for Ecto.Repo.stop/1
.
@@ -795,7 +795,7 @@
- Callback implementation for Ecto.Repo.stream/2
.
+ Callback implementation for Ecto.Repo.stream/2
.
@@ -844,7 +844,7 @@
- Callback implementation for Ecto.Repo.transaction/2
.
+ Callback implementation for Ecto.Repo.transaction/2
.
@@ -854,7 +854,7 @@
- Callback implementation for Ecto.Repo.update/2
.
+ Callback implementation for Ecto.Repo.update/2
.
@@ -864,7 +864,7 @@
- Callback implementation for Ecto.Repo.update!/2
.
+ Callback implementation for Ecto.Repo.update!/2
.
@@ -874,7 +874,7 @@
- Callback implementation for Ecto.Repo.update_all/3
.
+ Callback implementation for Ecto.Repo.update_all/3
.
@@ -930,7 +930,7 @@ aggregate(queryable, aggregate, opts \\ [])
-Callback implementation for Ecto.Repo.aggregate/3
.
+Callback implementation for Ecto.Repo.aggregate/3
.
Callback implementation for Ecto.Repo.aggregate/4
.
Callback implementation for Ecto.Repo.aggregate/4
.
Callback implementation for Ecto.Repo.all/2
.
Callback implementation for Ecto.Repo.all/2
.
Callback implementation for Ecto.Repo.checked_out?/0
.
Callback implementation for Ecto.Repo.checked_out?/0
.
Callback implementation for Ecto.Repo.checkout/2
.
Callback implementation for Ecto.Repo.checkout/2
.
Callback implementation for Ecto.Repo.config/0
.
Callback implementation for Ecto.Repo.config/0
.
Callback implementation for Ecto.Repo.default_options/1
.
Callback implementation for Ecto.Repo.default_options/1
.
Callback implementation for Ecto.Repo.delete/2
.
Callback implementation for Ecto.Repo.delete/2
.
Callback implementation for Ecto.Repo.delete!/2
.
Callback implementation for Ecto.Repo.delete!/2
.
Callback implementation for Ecto.Repo.delete_all/2
.
Callback implementation for Ecto.Repo.delete_all/2
.
A convenience function for SQL-based repositories that forces all connections in the -pool to disconnect within the given interval.
See Ecto.Adapters.SQL.disconnect_all/3
for more information.
See Ecto.Adapters.SQL.disconnect_all/3
for more information.
Callback implementation for Ecto.Repo.exists?/2
.
Callback implementation for Ecto.Repo.exists?/2
.
A convenience function for SQL-based repositories that executes an EXPLAIN statement or similar -depending on the adapter to obtain statistics for the given query.
See Ecto.Adapters.SQL.explain/4
for more information.
See Ecto.Adapters.SQL.explain/4
for more information.
Callback implementation for Ecto.Repo.get/3
.
Callback implementation for Ecto.Repo.get/3
.
Callback implementation for Ecto.Repo.get!/3
.
Callback implementation for Ecto.Repo.get!/3
.
Callback implementation for Ecto.Repo.get_by/3
.
Callback implementation for Ecto.Repo.get_by/3
.
Callback implementation for Ecto.Repo.get_by!/3
.
Callback implementation for Ecto.Repo.get_by!/3
.
Callback implementation for Ecto.Repo.get_dynamic_repo/0
.
Callback implementation for Ecto.Repo.get_dynamic_repo/0
.
Callback implementation for Ecto.Repo.in_transaction?/0
.
Callback implementation for Ecto.Repo.in_transaction?/0
.
Callback implementation for Ecto.Repo.insert/2
.
Callback implementation for Ecto.Repo.insert/2
.
Callback implementation for Ecto.Repo.insert!/2
.
Callback implementation for Ecto.Repo.insert!/2
.
Callback implementation for Ecto.Repo.insert_all/3
.
Callback implementation for Ecto.Repo.insert_all/3
.
Callback implementation for Ecto.Repo.insert_or_update/2
.
Callback implementation for Ecto.Repo.insert_or_update/2
.
Callback implementation for Ecto.Repo.insert_or_update!/2
.
Callback implementation for Ecto.Repo.insert_or_update!/2
.
Callback implementation for Ecto.Repo.load/2
.
Callback implementation for Ecto.Repo.load/2
.
Callback implementation for Ecto.Repo.one/2
.
Callback implementation for Ecto.Repo.one/2
.
Callback implementation for Ecto.Repo.one!/2
.
Callback implementation for Ecto.Repo.one!/2
.
Callback implementation for Ecto.Repo.preload/3
.
Callback implementation for Ecto.Repo.preload/3
.
Callback implementation for Ecto.Repo.prepare_query/3
.
Callback implementation for Ecto.Repo.prepare_query/3
.
Callback implementation for Ecto.Repo.put_dynamic_repo/1
.
Callback implementation for Ecto.Repo.put_dynamic_repo/1
.
A convenience function for SQL-based repositories that executes the given query.
See Ecto.Adapters.SQL.query/4
for more information.
A convenience function for SQL-based repositories that executes the given query.
See Ecto.Adapters.SQL.query/4
for more information.
A convenience function for SQL-based repositories that executes the given query.
See Ecto.Adapters.SQL.query!/4
for more information.
A convenience function for SQL-based repositories that executes the given query.
See Ecto.Adapters.SQL.query!/4
for more information.
A convenience function for SQL-based repositories that executes the given multi-result query.
See Ecto.Adapters.SQL.query_many/4
for more information.
A convenience function for SQL-based repositories that executes the given multi-result query.
See Ecto.Adapters.SQL.query_many/4
for more information.
A convenience function for SQL-based repositories that executes the given multi-result query.
See Ecto.Adapters.SQL.query_many!/4
for more information.
A convenience function for SQL-based repositories that executes the given multi-result query.
See Ecto.Adapters.SQL.query_many!/4
for more information.
Callback implementation for Ecto.Repo.reload/2
.
Callback implementation for Ecto.Repo.reload/2
.
Callback implementation for Ecto.Repo.reload!/2
.
Callback implementation for Ecto.Repo.reload!/2
.
Callback implementation for Ecto.Repo.rollback/1
.
Callback implementation for Ecto.Repo.rollback/1
.
Callback implementation for Ecto.Repo.start_link/1
.
Callback implementation for Ecto.Repo.start_link/1
.
Callback implementation for Ecto.Repo.stop/1
.
Callback implementation for Ecto.Repo.stop/1
.
Callback implementation for Ecto.Repo.stream/2
.
Callback implementation for Ecto.Repo.stream/2
.
A convenience function for SQL-based repositories that translates the given query to SQL.
See Ecto.Adapters.SQL.to_sql/3
for more information.
A convenience function for SQL-based repositories that translates the given query to SQL.
See Ecto.Adapters.SQL.to_sql/3
for more information.
Callback implementation for Ecto.Repo.transaction/2
.
Callback implementation for Ecto.Repo.transaction/2
.
Callback implementation for Ecto.Repo.update/2
.
Callback implementation for Ecto.Repo.update/2
.
Callback implementation for Ecto.Repo.update!/2
.
Callback implementation for Ecto.Repo.update!/2
.
Callback implementation for Ecto.Repo.update_all/3
.
Callback implementation for Ecto.Repo.update_all/3
.
Runs a function asynchronously in a Task. Simply a shorthand for calling functions in Task
and Task.Supervisor
but with support for multi-tenancy in the spawned process.
Task.async/1
the caller creates a new process links and monitors it. Once the task action finishes, a message is sent to the caller with the result. Task.await/2
is used to read the message sent by the task. When using async
, you must await
a reply as they are always sent.
Task.start_link/1
is suggested instead if you are not expecting a reply. It starts a statically supervised task as part of a supervision tree, linked to the calling process (meaning it will be stopped when the caller stops).
Task.start/1
can be used for fire-and-forget tasks, like side-effects, when you have no interest on its results nor if it completes successfully (because if the server is shut down it won't be restarted).
For more serious tasks, consider using Oban
or apply_task_supervised/3
for supervised tasks when possible:
Task.Supervisor.start_child/2
allows you to start a fire-and-forget task when you don't care about its results or if it completes successfully or not.
Task.Supervisor.async/2
+ Task.await/2
allows you to execute tasks concurrently and retrieve its result. If the task fails, the caller will also fail.
Runs a function asynchronously in a Task. Simply a shorthand for calling functions in Task
and Task.Supervisor
but with support for multi-tenancy in the spawned process.
Task.async/1
the caller creates a new process links and monitors it. Once the task action finishes, a message is sent to the caller with the result. Task.await/2
is used to read the message sent by the task. When using async
, you must await
a reply as they are always sent.
Task.start_link/1
is suggested instead if you are not expecting a reply. It starts a statically supervised task as part of a supervision tree, linked to the calling process (meaning it will be stopped when the caller stops).
Task.start/1
can be used for fire-and-forget tasks, like side-effects, when you have no interest on its results nor if it completes successfully (because if the server is shut down it won't be restarted).
For more serious tasks, consider using Oban
or apply_task_supervised/3
for supervised tasks when possible:
Task.Supervisor.start_child/2
allows you to start a fire-and-forget task when you don't care about its results or if it completes successfully or not.
Task.Supervisor.async/2
+ Task.await/2
allows you to execute tasks concurrently and retrieve its result. If the task fails, the caller will also fail.
A reusable table to link child or related items and also rank sibling items.
Usage (for global ranking, otherwise you should specify scope):
{:ok, first} = Bonfire.Data.Assort.Ranked.changeset(%{item_id: "01FGTH48ZZD08ADBHQ260KYJHW"}) |> repo().insert
-second = Bonfire.Data.Assort.Ranked.changeset(%{item_id: "01FGTH0N3YPBS5MNNAEAEVV54J"}) |> repo().insert
+A reusable table to link child or related items and also rank sibling items.
Usage (for global ranking, otherwise you should specify scope):
{:ok, first} = Bonfire.Data.Assort.Ranked.changeset(%{item_id: "01FGTH48ZZD08ADBHQ260KYJHW"}) |> repo().insert
+second = Bonfire.Data.Assort.Ranked.changeset(%{item_id: "01FGTH0N3YPBS5MNNAEAEVV54J"}) |> repo().insert
import Ecto.Query
-Bonfire.Data.Assort.Ranked |> order_by(:rank) |> repo().all
+Bonfire.Data.Assort.Ranked |> order_by(:rank) |> repo().all
-first |> Bonfire.Data.Assort.Ranked.changeset(%{rank_set: :last}) |> repo().update
+first |> Bonfire.Data.Assort.Ranked.changeset(%{rank_set: :last}) |> repo().update
-Bonfire.Data.Assort.Ranked |> order_by(:rank) |> repo().all
+Bonfire.Data.Assort.Ranked |> order_by(:rank) |> repo().all
Bonfire.Epics
helpers for working with Ecto
Bonfire.Epics
helpers for working with Ecto
@spec hard_delete(atom(), t()) :: :ok | {:error, Ecto.Changeset.t()}+
@spec hard_delete(atom(), t()) :: :ok | {:error, Ecto.Changeset.t()}
@spec soft_delete(t()) :: {:ok, t()} | {:error, Ecto.Changeset.t()}+
@spec soft_delete(t()) :: {:ok, t()} | {:error, Ecto.Changeset.t()}
Bonfire.Files.Definition
is an extension of Waffle.Definition
,
however the allowed_media_types/0
and max_file_size/0
callback are added,
with which you need to define what media types are accepted for these types of uploads.
-(You can also return :all
to accept all media types).To use the uploader:
iex> {:ok, media} = Bonfire.Files.upload(MyUploader, context, %{path: "./150.png"})
+(You can also return :all
to accept all media types).To use the uploader:
iex> {:ok, media} = Bonfire.Files.upload(MyUploader, context, %{path: "./150.png"})
iex> media.media_type
"image/png"
-iex> Bonfire.Files.remote_url(MyUploader, media)
+iex> Bonfire.Files.remote_url(MyUploader, media)
"/uploads/my/01F3AY6JV30G06BY4DR9BTW5EH"
iex> changeset(%AuthSecondFactor{secret: <<...>>}, code: "123456")
-%Ecto.Changeset{data: %AuthSecondFactor{}}
+iex> changeset(%AuthSecondFactor{secret: <<...>>}, code: "123456")
+%Ecto.Changeset{data: %AuthSecondFactor{}}
@spec changeset(changeset_name(), params :: map(), opts :: Keyword.t()) :: - Ecto.Changeset.t()+ Ecto.Changeset.t()
Callback implementation for Oban.Worker.perform/1
.
Callback implementation for Oban.Worker.perform/1
.
Callback implementation for Oban.Worker.perform/1
.
Callback implementation for Oban.Worker.perform/1
.
Callback implementation for Bonfire.Common.ConfigModule.config_module/0
.
Callback implementation for Oban.Worker.perform/1
.
Callback implementation for Oban.Worker.perform/1
.
Callback implementation for Oban.Worker.perform/1
.
Callback implementation for Oban.Worker.perform/1
.
@spec change_synced_timestamp(Ecto.Changeset.t(), atom(), atom()) :: - Ecto.Changeset.t()+
@spec change_synced_timestamp(Ecto.Changeset.t(), atom(), atom()) :: + Ecto.Changeset.t()
@spec change_synced_timestamps(Ecto.Changeset.t(), atom(), atom(), atom(), atom()) :: - Ecto.Changeset.t()+
@spec change_synced_timestamps(Ecto.Changeset.t(), atom(), atom(), atom(), atom()) :: + Ecto.Changeset.t()
@spec validate_http_url(Ecto.Changeset.t(), atom()) :: Ecto.Changeset.t()+
@spec validate_http_url(Ecto.Changeset.t(), atom()) :: Ecto.Changeset.t()
@spec validate_not_expired(Ecto.Changeset.t(), DateTime.t(), atom(), binary()) :: - Ecto.Changeset.t()+
@spec validate_not_expired(Ecto.Changeset.t(), DateTime.t(), atom(), binary()) :: + Ecto.Changeset.t()
A behaviour implemented by our data migrations (generally backfills).
Based on A microframework for backfill migrations in Elixir's Ecto, in turn based on David Bernheisel's template for deterministic backfills.
A data migration using this behaviour may look like this (which you can put simply put in Ecto migrations, eg. priv/repo/migrations/priv/repo/migrations/20231019004944_data_onboarding_step.exs
):
defmodule MyApp.Repo.Migrations.BackfillOnboardingStep do
+A behaviour implemented by our data migrations (generally backfills).
Based on A microframework for backfill migrations in Elixir's Ecto, in turn based on David Bernheisel's template for deterministic backfills.
A data migration using this behaviour may look like this (which you can put simply put in Ecto migrations, eg. priv/repo/migrations/priv/repo/migrations/20231019004944_data_onboarding_step.exs
):
defmodule MyApp.Repo.Migrations.BackfillOnboardingStep do
alias EctoSparkles.DataMigration
use DataMigration
@impl DataMigration
- def base_query do
+ def base_query do
# NOTE: This works in cases where:
# 1. The data can be queried with a condition that not longer applies after the migration ran, so you can repeatedly query the data and update the data until the query result is empty. For example, if a column is currently null and will be updated to not be null, then you can query for the null records and pick up where you left off.
# 2. The migration is written in such a way that it can be ran several times on the same data without causing data loss or duplication (or crashing).
- from(u in "users", # Notice how we do not use Ecto schemas here.
- where: is_nil(u.onboarding_step),
- select: %{id: u.id}
- )
- end
+ from(u in "users", # Notice how we do not use Ecto schemas here.
+ where: is_nil(u.onboarding_step),
+ select: %{id: u.id}
+ )
+ end
@impl DataMigration
- def config do
- %DataMigration.Config{batch_size: 100, throttle_ms: 1_000, repo: MyApp.Repo}
- end
+ def config do
+ %DataMigration.Config{batch_size: 100, throttle_ms: 1_000, repo: MyApp.Repo}
+ end
@impl DataMigration
- def migrate(results) do
- Enum.each(results, fn %{id: user_id} ->
+ def migrate(results) do
+ Enum.each(results, fn %{id: user_id} ->
# hooks into a context module, which is more likely to be kept up to date as the app evolves, to avoid having to update old migrations
user_id
- |> MyApp.Users.set_onboarding_step!()
- end)
- end
-end
+ |> MyApp.Users.set_onboarding_step!()
+ end)
+ end
+end
@callback base_query() :: Ecto.Query.t()+
@callback base_query() :: Ecto.Query.t()
Callback implementation for Ecto.Type.cast/1
.
Callback implementation for Ecto.Type.cast/1
.
Callback implementation for Ecto.Type.embed_as/1
.
Callback implementation for Ecto.Type.embed_as/1
.
Callback implementation for Ecto.Type.equal?/2
.
Callback implementation for Ecto.Type.equal?/2
.
Callback implementation for Ecto.Type.type/0
.
Callback implementation for Ecto.Type.type/0
.
Callback implementation for Ecto.Type.cast/1
.
Callback implementation for Ecto.Type.cast/1
.
Callback implementation for Ecto.Type.embed_as/1
.
Callback implementation for Ecto.Type.embed_as/1
.
Callback implementation for Ecto.Type.equal?/2
.
Callback implementation for Ecto.Type.equal?/2
.
Callback implementation for Ecto.Type.type/0
.
Callback implementation for Ecto.Type.type/0
.
Provides functions for sanitising input on Ecto.Changeset
string fields.
Provides functions for sanitising input on Ecto.Changeset
string fields.
Sanitises all changes in the given changeset that apply to field which are of the :string
Ecto
type.
Sanitises all changes in the given changeset that apply to field which are of the :string
Ecto
type.
Sanitises all changes in the given changeset that apply to field which are of the :string
Ecto
type.
By default it uses the HtmlSanitizeEx.strip_tags/1
function on any change that satisfies all of the following conditions:
:string
.opts
as defined using the :except
key in opts
.
+Sanitises all changes in the given changeset that apply to field which are of the :string
Ecto
type.
By default it uses the HtmlSanitizeEx.strip_tags/1
function on any change that satisfies all of the following conditions:
:string
.opts
as defined using the :except
key in opts
.
Note that this function will change the value in the :changes
map of an
%Ecto.Changeset{}
struct if the given changes are sanitized.iex> attrs = %{string_field: "<script>Bad</script>"}
+iex> attrs = %{string_field: "<script>Bad</script>"}
iex> result_changeset =
...> attrs
-...> |> FakeEctoSchema.changeset()
-...> |> EctoSparkles.SanitiseStrings.strip_all_tags()
+...> |> FakeEctoSchema.changeset()
+...> |> EctoSparkles.SanitiseStrings.strip_all_tags()
iex> result_changeset.changes
-%{string_field: "Bad"}
Fields can be exempted from sanitization via the :except
option.
iex> attrs = %{string_field: "<script>Bad</script>"}
+%{string_field: "Bad"}
Fields can be exempted from sanitization via the :except
option.
iex> attrs = %{string_field: "<script>Bad</script>"}
iex> result_changeset =
...> attrs
-...> |> FakeEctoSchema.changeset()
-...> |> EctoSparkles.SanitiseStrings.strip_all_tags(except: [:string_field])
+...> |> FakeEctoSchema.changeset()
+...> |> EctoSparkles.SanitiseStrings.strip_all_tags(except: [:string_field])
iex> result_changeset.changes
-%{string_field: "<script>Bad</script>"}
+
%{string_field: "<script>Bad</script>"}
ies> attrs
...> |> FakeEctoSchema.changeset()
-...> |> EctoSparkles.SanitiseStrings.sanitise_strings(scrubber: HtmlSanitizeEx.Scrubber.html5/1)
+ies> attrs
...> |> FakeEctoSchema.changeset()
+...> |> EctoSparkles.SanitiseStrings.sanitise_strings(scrubber: HtmlSanitizeEx.Scrubber.html5/1)
query_filter
brings convenience and shortens the boilterplate of ecto queries
Common filters available include:
preload
- Preloads fields onto the query resultsstart_date
- Query for items inserted after this dateend_date
- Query for items inserted before this datebefore
- Get items with IDs before this valueafter
- Get items with IDs after this valueids
- Get items with a list of idsfirst
- Gets the first n itemslast
- Gets the last n itemslimit
- Gets the first n itemsoffset
- Offsets limit by n itemssearch
- Warning: This requires schemas using this to have a &by_search(query, val)
functionYou are also able to filter on any natural field of a model, as well as use
query_filter(User, %{name: %{ilike: "steve"}})
-query_filter(User, %{name: %{ilike: "steve"}}, :last_name, :asc)
-query_filter(User, %{name: %{age: %{gte: 18, lte: 30}}})
-query_filter(User, %{name: %{is_banned: %{!=: nil}}})
-query_filter(User, %{name: %{is_banned: %{==: nil}}})
-
-my_query = query_filter(User, %{name: "Billy"})
-query_filter(my_query, %{last_name: "Joe"})
+query_filter
brings convenience and shortens the boilterplate of ecto queries
Common filters available include:
preload
- Preloads fields onto the query resultsstart_date
- Query for items inserted after this dateend_date
- Query for items inserted before this datebefore
- Get items with IDs before this valueafter
- Get items with IDs after this valueids
- Get items with a list of idsfirst
- Gets the first n itemslast
- Gets the last n itemslimit
- Gets the first n itemsoffset
- Offsets limit by n itemssearch
- Warning: This requires schemas using this to have a &by_search(query, val)
functionYou are also able to filter on any natural field of a model, as well as use
query_filter(User, %{name: %{ilike: "steve"}})
+query_filter(User, %{name: %{ilike: "steve"}}, :last_name, :asc)
+query_filter(User, %{name: %{age: %{gte: 18, lte: 30}}})
+query_filter(User, %{name: %{is_banned: %{!=: nil}}})
+query_filter(User, %{name: %{is_banned: %{==: nil}}})
+
+my_query = query_filter(User, %{name: "Billy"})
+query_filter(my_query, %{last_name: "Joe"})
import Ecto.Query
Invoice
-|> join(:left, [i], assoc(i, :customer), as: :customer)
-|> join(:left, [i, c], assoc(c, :account), as: :account)
-|> join(:left, [i], assoc(i, :lines), as: :lines)
-|> preload([lines: v, customers: c, account: a], lines: v, customer: {c, [a: account]})
-|> Repo.all()
import EctoSparkles
Invoice
-|> join_preload([:customer, :account])
-|> join_preload([:lines])
-|> Repo.all()
+|> join_preload([:customer, :account])
+|> join_preload([:lines])
+|> Repo.all()
AKA join_preload++
. It's more powerful, but it does it with more (and different!) syntax.
e.g.
proload(query, activity: [
+AKA join_preload++
. It's more powerful, but it does it with more (and different!) syntax.
e.g.
proload(query, activity: [
:verb, :boost_count, :like_count, :replied,
# relations under object will have their aliases prefixed with object_, i.e.
# :object_message, :object_post, :object_post_content
# the original names will still be used for the associations.
- object: {"object_", [:message, :post, :post_content]}
-])
+ object: {"object_", [:message, :post, :post_content]}
+])
Adds additional associations dynamically from app config.
Reads config for the given OTP application, under the name of the current module. Each key maps to an Ecto.Schema function:
belongs_to
field
has_many
has_one
many_to_many
Each of these keys should map to a keyword list where the key is the -name of the field or association and the value is one of:
Example Schema:
defmodule My.Schema do
+name of the field or association and the value is one of:- A type
- A tuple of type and options (keyword list)
Example Schema:
defmodule My.Schema do
use Ecto.Schema
- import Flexto, only: [flex_schema: 1]
+ import Flexto, only: [flex_schema: 1]
- schema "my_table" do
+ schema "my_table" do
field :name, :string # just normal schema things
- flex_schema(:my_app) # boom! give me the stuff
- end
-end
Example configuration:
config :my_app, My.Schema,
- belongs_to: [
+ flex_schema(:my_app) # boom! give me the stuff
+ end
+end
Example configuration:
config :my_app, My.Schema,
+ belongs_to: [
foo: Foo, # belongs_to :foo, Foo
- bar: {Bar, type: :integer}, # belongs_to :bar, Bar, type: :integer
- ],
- field: [
+ bar: {Bar, type: :integer}, # belongs_to :bar, Bar, type: :integer
+ ],
+ field: [
foo: :string, # field :foo, :string
- bar: {:integer, default: 4}, # field :foo, :integer, default: 4
- ],
- has_one: [
+ bar: {:integer, default: 4}, # field :foo, :integer, default: 4
+ ],
+ has_one: [
foo: Foo, # has_one :foo, Foo
- bar: {Bar, foreign_key: :the_bar_id}, # has_one :bar, Bar, foreign_key: :the_bar_id
- ]
- has_many: [
+ bar: {Bar, foreign_key: :the_bar_id}, # has_one :bar, Bar, foreign_key: :the_bar_id
+ ]
+ has_many: [
foo: Foo, # has_many :foo, Foo
- bar: {Bar, foreign_key: :the_bar_id}, # has_many :bar, Bar, foreign_key: :the_bar_id
- ]
- many_to_many: [
+ bar: {Bar, foreign_key: :the_bar_id}, # has_many :bar, Bar, foreign_key: :the_bar_id
+ ]
+ many_to_many: [
foo: Foo, # many_to_many :foo, Foo
- bar: {Bar, join_through: FooBar}, # many_to_many :bar, Bar, :join_through: FooBar
- ]
This one won't work very well because we define foo
and bar
5
+
bar: {Bar, join_through: FooBar}, # many_to_many :bar, Bar, :join_through: FooBar
+ ]
This one won't work very well because we define foo
and bar
5
times each, but I think you get the point.
Reading of configuration is done during compile time. The relations will be baked in during compilation, thus:
mix bonfire.account.new [email@address]
You will be prompted for a password and an email if it was not provided.
+mix bonfire.account.new [email@address]
You will be prompted for a password and an email if it was not provided.
diff --git a/Mix.Tasks.Bonfire.Deps.Compile.html b/Mix.Tasks.Bonfire.Deps.Compile.html index b98c47bcd43..73db9a3a505 100644 --- a/Mix.Tasks.Bonfire.Deps.Compile.html +++ b/Mix.Tasks.Bonfire.Deps.Compile.html @@ -13,7 +13,7 @@ - + diff --git a/Mix.Tasks.Bonfire.Localise.Extract.html b/Mix.Tasks.Bonfire.Localise.Extract.html index aa5979a621f..494c4125175 100644 --- a/Mix.Tasks.Bonfire.Localise.Extract.html +++ b/Mix.Tasks.Bonfire.Localise.Extract.html @@ -13,7 +13,7 @@ - + @@ -137,12 +137,12 @@Extracts translations by recompiling the Elixir source code.
mix gettext.extract [OPTIONS]
Translations are extracted into POT (Portable Object Template) files (with a +
Extracts translations by recompiling the Elixir source code.
mix gettext.extract [OPTIONS]
Translations are extracted into POT (Portable Object Template) files (with a
.pot
extension). The location of these files is determined by the :otp_app
and :priv
options given by Gettext modules when they call use Gettext
. One
POT file is generated for each translation domain.
It is possible to give the --merge
option to perform merging
for every Gettext backend updated during merge:
mix gettext.extract --merge
All other options passed to gettext.extract
are forwarded to the
-gettext.merge
task (Mix.Tasks.Gettext.Merge
), which is called internally
+gettext.merge
task (Mix.Tasks.Gettext.Merge
), which is called internally
by this task. For example:
mix gettext.extract --merge --no-fuzzy
Generates secrets and prints to the terminal.
mix bonfire.secrets [length]
By default, it generates keys 64 characters long. +
Generates secrets and prints to the terminal.
mix bonfire.secrets [length]
By default, it generates keys 64 characters long.
The minimum value for length
is 32.
Defines a paginator.
This module adds a paginate/3
function to your Ecto.Repo
so that you can
+
Defines a paginator.
This module adds a paginate/3
function to your Ecto.Repo
so that you can
paginate through results using opaque cursors.
defmodule MyApp.Repo do
+defmodule MyApp.Repo do
use Ecto.Repo, otp_app: :my_app
use Paginator
-end
+
end
defmodule MyApp.Repo do
+defmodule MyApp.Repo do
use Ecto.Repo, otp_app: :my_app
use Paginator,
limit: 10, # sets the default limit to 10
maximum_limit: 100, # sets the maximum limit to 100
include_total_count: true, # include total count by default
total_count_primary_key_field: :uuid # sets the total_count_primary_key_field to uuid for calculate total_count
-end
Note that these values can be still be overriden when paginate/3
is called.
+
end
Note that these values can be still be overriden when paginate/3
is called.
If you wish to avoid use of macros or you wish to use a different name for -the pagination function you can define your own function like so:
defmodule MyApp.Repo do
+the pagination function you can define your own function like so:defmodule MyApp.Repo do
use Ecto.Repo, otp_app: :my_app
- def my_paginate_function(queryable, opts \ [], repo_opts \ []) do
- defaults = [limit: 10] # Default options of your choice here
- opts = Keyword.merge(defaults, opts)
- Paginator.paginate(queryable, opts, __MODULE__, repo_opts)
- end
-end
+ def my_paginate_function(queryable, opts \ [], repo_opts \ []) do
+ defaults = [limit: 10] # Default options of your choice here
+ opts = Keyword.merge(defaults, opts)
+ Paginator.paginate(queryable, opts, __MODULE__, repo_opts)
+ end
+end
@callback paginate( - queryable :: Ecto.Query.t(), + queryable :: Ecto.Query.t(), opts :: Keyword.t(), repo_opts :: Keyword.t() ) :: @@ -317,36 +317,36 @@paginate(queryable, opts, repo_opts)
Simple example -query = from(p in Post, order_by: [asc: p.inserted_at, asc: p.id], select: p) +
query = from(p in Post, order_by: [asc: p.inserted_at, asc: p.id], select: p) -Repo.paginate(query, cursor_fields: [:inserted_at, :id], limit: 50)
+
Repo.paginate(query, cursor_fields: [:inserted_at, :id], limit: 50)Example with using custom sort directions per field
-query = from(p in Post, order_by: [asc: p.inserted_at, desc: p.id], select: p) +
query = from(p in Post, order_by: [asc: p.inserted_at, desc: p.id], select: p) -Repo.paginate(query, cursor_fields: [inserted_at: :asc, id: :desc], limit: 50)
+
Repo.paginate(query, cursor_fields: [inserted_at: :asc, id: :desc], limit: 50)Example with sorting on columns in joined tables
-from( +
from( p in Post, as: :posts, - join: a in assoc(p, :author), + join: a in assoc(p, :author), as: :author, - preload: [author: a], + preload: [author: a], select: p, - order_by: [ - {:asc, a.name}, - {:asc, p.id} - ] -) + order_by: [ + {:asc, a.name}, + {:asc, p.id} + ] +) -Repo.paginate(query, cursor_fields: [{{:author, :name}, :asc}, id: :asc], limit: 50)
When sorting on columns in joined tables it is necessary to use named bindings. In +
Repo.paginate(query, cursor_fields: [{{:author, :name}, :asc}, id: :asc], limit: 50)When sorting on columns in joined tables it is necessary to use named bindings. In this case we name it
author
. In thecursor_fields
we refer to this named binding and its column name.To build the cursor Paginator uses the returned Ecto.Schema. When using a joined column the returned Ecto.Schema won't have the value of the joined column @@ -361,32 +361,32 @@
paginate(queryable, opts, repo_opts)
Example -@@ -441,10 +441,10 @@from( +
+)from( p in Post, as: :posts, - join: a in assoc(p, :author), + join: a in assoc(p, :author), as: :author, - join: c in assoc(a, :company), + join: c in assoc(a, :company), as: :company, - preload: [author: a], + preload: [author: a], select: p, - order_by: [ - {:asc, a.name}, - {:asc, p.id} - ] -) - -Repo.paginate(query, - cursor_fields: [{{:company, :name}, :asc}, id: :asc], - fetch_cursor_value_fun: fn - post, {{:company, name}, _} -> + order_by: [ + {:asc, a.name}, + {:asc, p.id} + ] +) + +Repo.paginate(query, + cursor_fields: [{{:company, :name}, :asc}, id: :asc], + fetch_cursor_value_fun: fn + post, {{:company, name}, _} -> post.author.company.name post, field -> - Paginator.default_fetch_cursor_value(post, field) - end, + Paginator.default_fetch_cursor_value(post, field) + end, limit: 50 -)
cursor_for_record(record, cursor_fields, fe Example -
iex> Paginator.cursor_for_record(%Paginator.Customer{id: 1}, [:id]) +
@@ -483,10 +483,10 @@iex> Paginator.cursor_for_record(%Paginator.Customer{id: 1}, [:id]) "g3QAAAABZAACaWRhAQ==" -iex> Paginator.cursor_for_record(%Paginator.Customer{id: 1, name: "Alice"}, [id: :asc, name: :desc]) +iex> Paginator.cursor_for_record(%Paginator.Customer{id: 1, name: "Alice"}, [id: :asc, name: :desc]) "g3QAAAACZAACaWRhAWQABG5hbWVtAAAABUFsaWNl"
default_fetch_cursor_value(schema, field) Example -
iex> Paginator.default_fetch_cursor_value(%Paginator.Customer{id: 1}, :id) +
diff --git a/Pointers.Changesets.html b/Pointers.Changesets.html index df033df0dc5..898bff84526 100644 --- a/Pointers.Changesets.html +++ b/Pointers.Changesets.html @@ -13,7 +13,7 @@ - + @@ -279,7 +279,7 @@iex> Paginator.default_fetch_cursor_value(%Paginator.Customer{id: 1}, :id) 1 -iex> Paginator.default_fetch_cursor_value(%Paginator.Customer{id: 1, address: %Paginator.Address{city: "London"}}, {:address, :city}) +iex> Paginator.default_fetch_cursor_value(%Paginator.Customer{id: 1, address: %Paginator.Address{city: "London"}}, {:address, :city}) "London"
Like Ecto.Changeset.put_assoc/3
but for Pointables, Virtuals and Mixins.
Like Ecto.Changeset.put_assoc/3
but for Pointables, Virtuals and Mixins.
Like Ecto.Changeset.put_assoc/3
but for Pointables, Virtuals and Mixins.
Copies across keys where possible.
+Like Ecto.Changeset.put_assoc/3
but for Pointables, Virtuals and Mixins.
Copies across keys where possible.
defmodule My.Mixin do
+defmodule My.Mixin do
use Pointers.Mixin,
otp_app: :my_app,
source: "postgres_table_name"
- mixin_schema do
+ mixin_schema do
field :is_awesome, :boolean
- end
-end
+ end
+end
Same as cast/1
but raises Ecto.CastError
on invalid arguments.
Same as cast/1
but raises Ecto.CastError
on invalid arguments.
Callback implementation for Ecto.Type.embed_as/1
.
Callback implementation for Ecto.Type.embed_as/1
.
Callback implementation for Ecto.Type.equal?/2
.
Callback implementation for Ecto.Type.equal?/2
.
Same as cast/1
but raises Ecto.CastError
on invalid arguments.
Same as cast/1
but raises Ecto.CastError
on invalid arguments.
Callback implementation for Ecto.Type.embed_as/1
.
Callback implementation for Ecto.Type.embed_as/1
.
Callback implementation for Ecto.Type.equal?/2
.
Callback implementation for Ecto.Type.equal?/2
.
Generates a reverse router function with the given name based upon a compiled(!) phoenix router module.
Must be used outside of the router module, or else the router won't -be compiled yet and we won't be able to look up the routes.
Generated function wraps the existing phoenix helpers.
defmodule MyAppWeb.Router do
+be compiled yet and we won't be able to look up the routes.Generated function wraps the existing phoenix helpers.
defmodule MyAppWeb.Router do
use MyAppWeb, :router
# ...
-end
-defmodule MyAppWeb.Router.Reverse do
- import Voodoo, only: [def_reverse_router: 2]
+end
+defmodule MyAppWeb.Router.Reverse do
+ import Voodoo, only: [def_reverse_router: 2]
def_reverse_router :path, for: MyAppWeb.Router
-end
+end
Specifies connection options for HTTP requests
Rate limit middleware for Tesla using Hammer
+Based on TeslaExtra.RateLimit
and TeslaExtra.RetryAfter
Helper functions for building HTTP requests
Takes into account the Retry-After header returned by the server when the rate limit is exceeded.
Bonfire.Epics
helpers for working with Ecto
Bonfire.Epics
helpers for working with Ecto
Provides functions for sanitising input on Ecto.Changeset
string fields.
Provides functions for sanitising input on Ecto.Changeset
string fields.
The code is broadly composed namespaces such as these, many of which are packaged as "extensions" which live in separate git repositories, which are included in the app by way of mix dependencies:
Bonfire.*
- Core application logic (very little code).Bonfire.*.*
- Bonfire extensions (eg Bonfire.Social.Posts
) containing mostly context modules, APIs, and routesBonfire.Data.*
- Extensions containing database schemas and migrations Bonfire.UI.*
- UI component extensionsBonfire.*.*.LiveHandler
- Backend logic to handle events in the frontendBonfire.Editor.*
(pluggable text editors, eg. CKEditor for WYSIWYG markdown input)Bonfire.GraphQL.*
- Optional GraphQL APIBonfire.Federate.*
- Optional Federation hooksActivityPub
- ActivityPub S2S models, logic and various helper modules ActivityPub.Web
- ActivityPub S2S REST endpoints, activity ingestion and push federation facilities ValueFlows.*
- economic extensions implementing the ValueFlows vocabularyContexts are were we put any core logic. A context often is circumscribed to providing logic for a particular object type (e. g. Bonfire.Social.Posts
implements Bonfire.Data.Social.Post
).
All Bonfire objects use an ULID as their primary key. We use the Pointers
library (with extra logic in Bonfire.Common.Pointers
) to reference any object by its primary key without knowing what type it is beforehand. This is very useful as it allows for example following or liking many different types of objects (as opposed to say only a user or a post) and this approach allows us to store the context of the like/follow by only storing its primary key (see Bonfire.Data.Social.Follow
) for an example.
Context modules usually have one/2
, many/2
, and many_paginated/1
functions for fetching objects, which in turn call a query/2
function. These take a keyword list as filters (and an optional opts
argument) allowing objects to be fetched by arbitrary criteria.
Examples:
Users.one(username: "bob") # Fetching by username
-Posts.many_paginated(by: "01E9TQP93S8XFSV2ZATX1FQ528") # List a page of posts by its author
-EconomicResources.many(deleted: true) # List any deleted resources
Context modules also have functions for creating, updating and deleting objects, as well as hooks for federating or indexing in the search engine.
Here is an incomplete sample of some of current extensions and modules:
Bonfire.Me.Accounts
(for managing and querying local user accounts)Bonfire.Me.Users
(for managing and querying both local and remote user identities and profiles)Bonfire.Boundaries
(for managing and querying circles, ACLs, permissions...)Bonfire.Social.FeedActivities
, Bonfire.Social.Feeds
and Bonfire.Social.Activities
(for managing and querying activities and feeds)Bonfire.Social.Posts
and Bonfire.Social.PostContents
(for managing and querying posts)Bonfire.Social.Threads
(for managing and querying threads and comments)Bonfire.Social.Flags
(for managing and querying flags)Bonfire.Social.Follows
(for managing and querying follows)Bonfire.Classify
(for managing and querying categories, topics, and the like)Bonfire.Tag
(for managing and querying tags and mentions)Bonfire.Geolocate
(for managing and querying locations and geographical coordinates)Bonfire.Quantify
(for managing and querying units and measures)Bonfire.Common
and Bonfire.Common.Utils
(stuff that gets used everywhere)Bonfire.Application
(OTP application)Bonfire.Me.Characters
(a shared abstraction over users, organisations, categories, and other objects that need to have feeds and behave as an actor in ActivityPub land)Bonfire.Federate.ActivityPub
and ActivityPub
(ActivityPub integration)Bonfire.Search
(local search indexing and search API, powered by Meili)Bonfire.Mailer
, Bonfire.Me.Mails
, and Bamboo
(for rendering and sending emails)Bonfire.Files
, Waffle
, TreeMagic
and TwinkleStar
(for managing uploaded content)Bonfire.GraphQL
(GraphQL API abstractions)Queery
and Bonfire.Repo.Query
(Helpers for making queries on the database)Bonfire.Repo
(Ecto repository)Flexto
(to extend DB schemas in config, especially useful for adding associations)AbsintheClient
(for querying the API from within the server)The code is broadly composed namespaces such as these, many of which are packaged as "extensions" which live in separate git repositories, which are included in the app by way of mix dependencies:
Bonfire.*
- Core application logic (very little code).Bonfire.*.*
- Bonfire extensions (eg Bonfire.Social.Posts
) containing mostly context modules, APIs, and routesBonfire.Data.*
- Extensions containing database schemas and migrations Bonfire.UI.*
- UI component extensionsBonfire.*.*.LiveHandler
- Backend logic to handle events in the frontendBonfire.Editor.*
(pluggable text editors, eg. CKEditor for WYSIWYG markdown input)Bonfire.GraphQL.*
- Optional GraphQL APIBonfire.Federate.*
- Optional Federation hooksActivityPub
- ActivityPub S2S models, logic and various helper modules ActivityPub.Web
- ActivityPub S2S REST endpoints, activity ingestion and push federation facilities ValueFlows.*
- economic extensions implementing the ValueFlows vocabularyContexts are were we put any core logic. A context often is circumscribed to providing logic for a particular object type (e. g. Bonfire.Social.Posts
implements Bonfire.Data.Social.Post
).
All Bonfire objects use an ULID as their primary key. We use the Pointers
library (with extra logic in Bonfire.Common.Pointers
) to reference any object by its primary key without knowing what type it is beforehand. This is very useful as it allows for example following or liking many different types of objects (as opposed to say only a user or a post) and this approach allows us to store the context of the like/follow by only storing its primary key (see Bonfire.Data.Social.Follow
) for an example.
Context modules usually have one/2
, many/2
, and many_paginated/1
functions for fetching objects, which in turn call a query/2
function. These take a keyword list as filters (and an optional opts
argument) allowing objects to be fetched by arbitrary criteria.
Examples:
Users.one(username: "bob") # Fetching by username
+Posts.many_paginated(by: "01E9TQP93S8XFSV2ZATX1FQ528") # List a page of posts by its author
+EconomicResources.many(deleted: true) # List any deleted resources
Context modules also have functions for creating, updating and deleting objects, as well as hooks for federating or indexing in the search engine.
Here is an incomplete sample of some of current extensions and modules:
Bonfire.Me.Accounts
(for managing and querying local user accounts)Bonfire.Me.Users
(for managing and querying both local and remote user identities and profiles)Bonfire.Boundaries
(for managing and querying circles, ACLs, permissions...)Bonfire.Social.FeedActivities
, Bonfire.Social.Feeds
and Bonfire.Social.Activities
(for managing and querying activities and feeds)Bonfire.Social.Posts
and Bonfire.Social.PostContents
(for managing and querying posts)Bonfire.Social.Threads
(for managing and querying threads and comments)Bonfire.Social.Flags
(for managing and querying flags)Bonfire.Social.Follows
(for managing and querying follows)Bonfire.Classify
(for managing and querying categories, topics, and the like)Bonfire.Tag
(for managing and querying tags and mentions)Bonfire.Geolocate
(for managing and querying locations and geographical coordinates)Bonfire.Quantify
(for managing and querying units and measures)Bonfire.Common
and Bonfire.Common.Utils
(stuff that gets used everywhere)Bonfire.Application
(OTP application)Bonfire.Me.Characters
(a shared abstraction over users, organisations, categories, and other objects that need to have feeds and behave as an actor in ActivityPub land)Bonfire.Federate.ActivityPub
and ActivityPub
(ActivityPub integration)Bonfire.Search
(local search indexing and search API, powered by Meili)Bonfire.Mailer
, Bonfire.Me.Mails
, and Bamboo
(for rendering and sending emails)Bonfire.Files
, Waffle
, TreeMagic
and TwinkleStar
(for managing uploaded content)Bonfire.GraphQL
(GraphQL API abstractions)Queery
and Bonfire.Repo.Query
(Helpers for making queries on the database)Bonfire.Repo
(Ecto repository)Flexto
(to extend DB schemas in config, especially useful for adding associations)AbsintheClient
(for querying the API from within the server)Arrows
The Elixir |> ("pipe") operator is one of the things that seems to get people excited about elixir. Probably in part because you then don't have to keep coming up with function names. Unfortunately it's kind of limiting. -The moment you need to pipe a parameter into a position that isn't the first one, it breaks down and you have to drop out of the pipeline format or write a secondary function to handle it.
Not any more! By simply inserting ...
where you would like the value to be inserted, Arrows
will override where it is placed. This allows you to keep on piping while accommodating that function with the annoying argument order. Arrows
was inspired by an existing library. Here is part of the test suite in lieu of examples:
defmodule ArrowsTest do
+The moment you need to pipe a parameter into a position that isn't the first one, it breaks down and you have to drop out of the pipeline format or write a secondary function to handle it.Not any more! By simply inserting ...
where you would like the value to be inserted, Arrows
will override where it is placed. This allows you to keep on piping while accommodating that function with the annoying argument order. Arrows
was inspired by an existing library. Here is part of the test suite in lieu of examples:
defmodule ArrowsTest do
use ExUnit.Case
use Arrows
- def double(x), do: x * 2
- def double_fst(x, _), do: x * 2
- def double_snd(_, x), do: x * 2
- def add_snd_thd(_, x, y), do: x + y
-
- test "|>" do
- assert 4 == (2 |> double)
- assert 4 == (2 |> double())
- assert 4 == (2 |> double(...))
- assert 8 == (2 |> double(double(...)))
- assert 4 == (2 |> double_fst(1))
- assert 4 == (2 |> double_fst(..., 1))
- assert 8 == (2 |> double_fst(double(...), 1))
- assert 4 == (2 |> double_snd(1, ...))
- assert 8 == (2 |> double_snd(1, double(...)))
- assert 3 == (2 |> add_snd_thd(1, ..., 1))
- assert 4 == (2 |> add_snd_thd(1, ..., ...))
- assert 6 == (2 |> add_snd_thd(1, ..., double(...)))
- for x <- [:yes, 2, nil, false] do
- assert {:ok, x} == (x |> {:ok, ...})
- end
- end
-end
A few little extra features you might notice here:
- You can move the parameter into a subexpression, as in
2 |> double_fst(double(...), 1)
where double will be called before the parameter is passed to double_fst
. - You can use
...
multiple times, substituting it in multiple places. - The right hand side need not even be a function call, you can use any expression with
...
.
+
def double(x), do: x * 2
+ def double_fst(x, _), do: x * 2
+ def double_snd(_, x), do: x * 2
+ def add_snd_thd(_, x, y), do: x + y
+
+ test "|>" do
+ assert 4 == (2 |> double)
+ assert 4 == (2 |> double())
+ assert 4 == (2 |> double(...))
+ assert 8 == (2 |> double(double(...)))
+ assert 4 == (2 |> double_fst(1))
+ assert 4 == (2 |> double_fst(..., 1))
+ assert 8 == (2 |> double_fst(double(...), 1))
+ assert 4 == (2 |> double_snd(1, ...))
+ assert 8 == (2 |> double_snd(1, double(...)))
+ assert 3 == (2 |> add_snd_thd(1, ..., 1))
+ assert 4 == (2 |> add_snd_thd(1, ..., ...))
+ assert 6 == (2 |> add_snd_thd(1, ..., double(...)))
+ for x <- [:yes, 2, nil, false] do
+ assert {:ok, x} == (x |> {:ok, ...})
+ end
+ end
+end
A few little extra features you might notice here:
2 |> double_fst(double(...), 1)
where double will be called before the parameter is passed to double_fst
....
multiple times, substituting it in multiple places....
.Untangle
provides replacements for the macros in Elixir's Logger
module and the IO.inspect
function to output code location information. The first argument will be inspect
ed and the second (where provided) will be used as a label:
iex(1)> import Untangle
Untangle
-iex(2)> debug(:no, "the answer is") # log at debug
-11:19:09.915 [debug] [iex:2] the answer is: :no
+iex(2)> debug(:no, "the answer is") # log at debug
+11:19:09.915 [debug] [iex:2] the answer is: :no
:no
-iex(3)> dump(%{a: :map}, "it") # inspect something on stdout
-[iex:3] it: %{a: :map}
-%{a: :map}
When used in a code file, the location information becomes slightly more useful, e.g.:
[lib/test_untangle.ex:15@Test.Untangle.example/2] Here's an empty list: []
You may also notice from the iex output that it returns its first argument. This makes it ideal for -inserting into a pipeline for debugging purposes:
do_something()
-|> debug("output of do_something/0")
When you are done debugging something, the location of the debug statement is already in the output so you know where to remove it or comment it out! Bliss!
You will find the codebase uses this a lot, though the debugs are frequently commented out. Just uncomment the ones that would help you with a particular debugging task and you're off.
When used in a code file, the location information becomes slightly more useful, e.g.:
[lib/test_untangle.ex:15@Test.Untangle.example/2] Here's an empty list: []
You may also notice from the iex output that it returns its first argument. This makes it ideal for +inserting into a pipeline for debugging purposes:
do_something()
+|> debug("output of do_something/0")
When you are done debugging something, the location of the debug statement is already in the output so you know where to remove it or comment it out! Bliss!
You will find the codebase uses this a lot, though the debugs are frequently commented out. Just uncomment the ones that would help you with a particular debugging task and you're off.
GbP?tHYQr|3FFx39c5I=EHLe@E6jJkjC
z{8;-38JcFa6ZqrauP5TNFZ8L9)gn>#J&IkDEDSO{6jG*u^yG9}DK2zI7TW&vfkx=S
zDcK}+mrNb+Qu0`;v}Uw^|9gO5J{NbDR;mX+J {bhdVO!!GnQg_x
zz3)hLAx_f+o{#rC7S(`GZu?fDI|c0aW1{$%9B9@O&qCl%t$D!z8RL@Mx}(0z$^(wC
zBd$960=Y2g6XEeJN78{!7-T?`#FF#zaB({Z8c_s%v$7sSzc#FEw^-!o1<9`r*Da5B
zdg(dm{>`Z}D+%zuko+HH&@?k3y>|sETag0i4(k#aU)4P(<9n}Q472qVE$(K-fz