feat(i18n): consume central translations from :escalated_locale#62
Draft
feat(i18n): consume central translations from :escalated_locale#62
Conversation
Wire the Phoenix host plugin to pull its translation catalogs from the
shared `:escalated_locale` Hex package so every Escalated host plugin
ships the same message set.
- Add `{:escalated_locale, "~> 0.1"}` (and explicit `:gettext`) to deps
- Introduce `Escalated.Gettext` backend that re-exports the central
catalogs and reads per-host overrides from `priv/gettext/overrides`
- Add `priv/gettext/overrides/.gitkeep` so the override path exists out
of the box
- README + CHANGELOG document the new translation workflow
Translation contributions should now go to escalated-dev/escalated-locale
rather than this repo. Existing `priv/locales/*.json` catalogs (used by
the shared Vue frontend) remain untouched in this PR.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Wires
escalated-phoenixto consume its translation catalogs from the new central:escalated_localeHex package so every Escalated host plugin (Phoenix, Laravel, Rails, Django, …) ships an identical message set.{:escalated_locale, "~> 0.1"}(and explicit{:gettext, "~> 0.24"}) tomix.exsdeps.Escalated.Gettext— a Gettext backend (use Gettext.Backend) that::escalated_locale, andpriv/gettext/overrides/{locale}/LC_MESSAGES/escalated.po.priv/gettext/overrides/.gitkeepso the override path exists out-of-the-box.Assumption about
:escalated_localeThis PR assumes the central package ships
.pofiles at:…and exposes a Gettext backend module (e.g.
EscalatedLocale.Gettext). TheEscalated.Gettextbackend in this repo is wired so that local overrides take precedence over the central catalog, with no need for the host application to depend on:escalated_localedirectly.If the published package ends up using a different domain name or path, the
priv:option / domain onEscalated.Gettextis the only place that needs to change.Why Gettext when this plugin previously used
priv/locales/*.jsonThe existing
priv/locales/{ar,it,ja,…}.jsonfiles are consumed by the shared@escalated-dev/escalatedVue frontend over Inertia and are intentionally left untouched in this PR. A follow-up will migrate them to be sourced from:escalated_localeas well (likely by exporting JSON alongside.pofrom the central package, or by generating JSON from the.poat compile time).Blocked on
:escalated_localev0.1.0 Hex publishCI is expected to fail at
mix deps.getuntilescalated_localev0.1.0 is published to Hex. Marking as draft until then.Once
:escalated_localeis on Hex:mix deps.update escalated_localeFiles changed
mix.exs— added:gettextand:escalated_localedeps; includedCHANGELOG.mdin package files.lib/escalated/gettext.ex— new Gettext backend with override path.priv/gettext/overrides/.gitkeep— placeholder so the override path exists.README.md— new "Translations" section.CHANGELOG.md— Unreleased / Added entry.Test plan
:escalated_localev0.1.0 to land on Hex.mix deps.getandmix compileshould both succeed.Gettext.gettext(Escalated.Gettext, "Open")resolves to the upstream string.priv/gettext/overrides/en/LC_MESSAGES/escalated.poand confirm it wins over upstream.mix hex.buildincludespriv/gettext/overridesonly (not the upstream catalogs).