Glossary (root) Lexeme
Internal functions for working with glossary lexemes. This module is not part of the public API. It provides utilities to identify, qualify, and resolve localized expressions based on Ecto-style validation metadata.
concepts
attrs
fields
signatures
⨌ safe_to_string / 1 (signature) Signature inference is ambiguous, choose stricter type
Head of safe_to_string/1
⨌ identify / 1 (signature)
Builds a lexeme identifier from Ecto validation options. The result is used to construct the glossary key. It attempts to match the most specific form: `validation.key.kind.type`, then `validation.key.kind`, then `validation.key`. Logs a warning and...
⨌ qualify / 2 (signature)
Prepends a locale prefix to a lexeme to produce a fully qualified glossary key. ## Examples qualify("validation.required", "en") #=> "en.validation.required"
⨌ lookup / 4 (signature)
Looks up a localized expression in the glossary by its fully qualified key. Performs interpolation of placeholders in the form `{{key}}` using values from `bindings`. If the key is not found, returns `fallback` or the key itself, and logs a warning. ...
samples
implements
protocols
defmodule Glossary.Lexeme do
@moduledoc "Internal functions for working with glossary lexemes.\n\nThis module is not part of the public API.\nIt provides utilities to identify, qualify, and resolve localized expressions\nbased on Ecto-style validation metadata.\n"
alias Glossary.Lexeme
@doc "Head of safe_to_string/1"
@spec safe_to_string(any) :: any
def safe_to_string(v)
def safe_to_string(v) when is_list(v) do
end
def safe_to_string(v) do
end
@doc "Prepends a locale prefix to a lexeme to produce a fully qualified glossary key.\n\n## Examples\n\n qualify(\"validation.required\", \"en\")\n #=> \"en.validation.required\"\n"
@spec qualify(String.t(), String.t()) :: String.t()
def qualify(lexeme, locale) do
end
@doc "Looks up a localized expression in the glossary by its fully qualified key.\n\nPerforms interpolation of placeholders in the form `{{key}}` using values from `bindings`.\nIf the key is not found, returns `fallback` or the key itself, and logs a warning.\n..."
@spec lookup(String.t(), map, any, atom) :: String.t()
def lookup(key, glossary, bindings, fallback) do
end
@doc "Builds a lexeme identifier from Ecto validation options.\n\nThe result is used to construct the glossary key. It attempts to match the most\nspecific form: `validation.key.kind.type`, then `validation.key.kind`, then `validation.key`.\n\nLogs a warning and..."
@spec identify(map) :: String.t()
def identify(map)
def identify(%{validation: key, kind: kind, type: type}) do
end
def identify(%{validation: key, kind: kind}) do
end
def identify(%{validation: key}) do
end
def identify(opts) do
end
end
defmodule Glossary.LexemeTest do
use ExUnit.Case, async: true
alias Glossary.Lexeme
describe("identify / 1") do
test "arg #1 is map with validation, kind and type" do
end
test "arg #1 is map with validation and kind" do
end
test "arg #1 is map with only validation key" do
end
test "fallback" do
end
end
describe("lookup / 4") do
test "" do
end
end
describe("qualify / 2") do
test "" do
end
end
describe("safe_to_string / 1") do
test "" do
end
test "" do
end
end
end