GameServerWeb.Gettext.Stats
(game_server_web v1.0.938)
Copy Markdown
Provides translation completeness statistics for a given locale.
Parses PO files at runtime using Expo (a dependency of Gettext) to count
total vs. translated strings per domain and overall.
Example
iex> GameServerWeb.Gettext.Stats.completeness("es")
%{
locale: "es",
domains: [
%{domain: "auth", translated: 60, total: 60, percent: 100.0},
...
],
translated: 366,
total: 366,
percent: 100.0
}
Summary
Functions
Returns completeness stats for all non-default locales.
Returns translation completeness stats for the given locale.
Returns the list of available domains for a locale.
Returns all translation strings for a given locale.
Returns a list of available non-default locale codes (e.g. ["es"]).
Returns a compact summary string like "es: 366/373 (98.1%)".
Functions
@spec all_completeness() :: [map()]
Returns completeness stats for all non-default locales.
Returns a list of maps (one per locale), same shape as completeness/1.
Returns translation completeness stats for the given locale.
Returns a map with :locale, :domains (list of per-domain stats),
:translated, :total, and :percent keys.
Returns the list of available domains for a locale.
Returns all translation strings for a given locale.
Each entry is a map with :domain, :msgid, :msgstr, and :translated? keys.
Optionally filter by domain and/or search query.
Options:
:domain- filter to a specific domain (e.g."auth"):search- case-insensitive substring search on msgid or msgstr:status-"translated","untranslated", ornilfor all
@spec locales() :: [String.t()]
Returns a list of available non-default locale codes (e.g. ["es"]).
Discovers locales by listing directories in the gettext priv folder,
excluding "en" (the default/source locale).
Returns a compact summary string like "es: 366/373 (98.1%)".