GettextPseudolocalize.Plural (GettextPseudolocalize v0.2.1)

View Source

A Gettext.Plural implementation that teaches Gettext about the xx pseudo-locale produced by gettext_pseudolocalize.

xx is not a real CLDR locale, so the default Gettext.Plural raises Gettext.Plural.UnknownLocaleError for it. That breaks mix gettext.merge, mix compile (once a backend compiles against priv/gettext/xx/), and runtime plural lookups. This module resolves xx to two plural forms — the same shape as English (nplurals=2; plural=(n != 1)) — and delegates every other locale to Gettext.Plural, so it is safe to register as the global pluralizer:

config :gettext, :plural_forms, GettextPseudolocalize.Plural

If you already have a custom pluralizer, add the "xx" clauses to it instead and keep delegating the rest to Gettext.Plural.