fixhub/js-localization
Bridges Laravel's localization system and your JavaScript front end, exposing PHP language files as JS-accessible translations so both sides share the same strings. Keeps messages in sync across locales and avoids duplicating text between server and client.
lang/ files remain the canonical store for all user-facing copy, or whether the product needs a second, JS-side translation pipeline. This package makes the server-side catalog usable in the browser, so the decision "one catalog or two" can credibly be "one."window.Lang or hand-copying strings into JS. It sits between "write it ourselves" and "adopt a TMS + i18next."lang/{locale} files rather than coordinating translators, a PHP deploy, and a separate frontend string release. Directly de-risks localization roadmap items.Consider it when:
lang/, with meaningful JavaScript that needs the same strings.Look elsewhere or apply caution when:
To executives: This is a small, low-cost utility that makes Laravel the single source of truth for customer-facing text, so entering a new market doesn't require re-translating the same copy for the web frontend. The business value is fewer string-drift bugs, faster locale launches, and consistent legal/consent copy across server and browser. The risk is maintenance, not capability: the package is niche (no adoption signals), so we should vendor it or budget a few hours of in-house ownership. Recommendation: adopt as a contained utility, not a platform bet.
To engineering: It's a thin bridge between Laravel's translator and the frontend — it removes ad-hoc window.translations blobs and hardcoded English in JS, keeps a single lang/ tree, and respects the locale Laravel already resolved. Known tradeoffs: per-request payload size, no runtime locale switching, and low upstream activity. Mitigations: wrap it behind our own helper/interface, pin the version or vendor it, add a smoke test that asserts a known key resolves in JS, and set a payload budget. If we later need pluralization rules or runtime locale switching, we swap the implementation without touching call sites.
Framing for the decision: judge it on whether string-drift bugs and duplicate translation entries go down — not on stars. Treat it as a tactical, swappable component with an explicit owner.
How can I help you explore Laravel packages today?