- Is hardchor/expose-translation-bundle a Laravel package or a Symfony bundle?
- No, it is not a Laravel package. hardchor/expose-translation-bundle is a Symfony bundle, forked from willdurand/expose-translation-bundle (later BazingaExposeTranslationBundle). It registers a Symfony route that dumps the Translator's message catalogues into a JavaScript global, and it bootstraps through a Symfony kernel and bundle registration. There is no service provider, no config/expose_translation.php, and no facade, so it does not plug into Laravel's translation layer.
- Can I use hardchor/expose-translation-bundle in a Laravel application?
- Technically the Composer install can resolve because Laravel already ships several Symfony components, but the bundle expects a Symfony kernel to register it and compile its container extension. Making it work means writing a Laravel service provider wrapper around the bundle's controller and duplicating the container-extension logic. A realistic estimate is five to ten engineer-days for an initial port plus permanent fork ownership, to rebuild something Laravel already offers through maintained packages.
- What does hardchor/expose-translation-bundle actually do?
- It exposes your application's translation catalogues to JavaScript by registering a route that serializes the Symfony Translator's messages into a global Translator object. Front-end code can then call Translator.trans('key') instead of hardcoding strings. The concept is sound and simple: ship server-side message catalogues to the browser so templates and scripts share one source of truth. The implementation, however, is tied entirely to Symfony's routing, translation and dependency-injection contracts.
- Does hardchor/expose-translation-bundle support Laravel 10, Laravel 11, PHP 8.2 and PHP 8.3?
- There is no evidence of PHP 8.2, PHP 8.3, Laravel 10 or Laravel 11 compatibility, and the package likely ships as dev-master only. It targets Symfony's bundle contract, and Laravel support was never a design goal. Treat any version claims as unverified without reading the source directly. For a Laravel app, use a package that explicitly declares support for your framework and PHP version.
- What are the best alternatives to this bundle for exposing Laravel translations to JavaScript?
- For Laravel the maintained choices are spatie/laravel-js-translations, which generates JS translation objects and a Blade directive and is the closest conceptual match, and laravel-vue-i18n, which compiles lang/ files into front-end bundles through Vite. A native route with @json returning __('messages') for a locale is adequate for small catalogues. symfony/ux-translator only makes sense if the stack is genuinely Symfony. The decision hinges on build-time versus runtime delivery.
- Is hardchor/expose-translation-bundle still maintained?
- Barely, if at all. The fork has one star and zero dependents, and the parent repository is archived and superseded by Symfony UX and symfony/translation tooling. There is no security advisory channel, no CVE process, and a single unnamed maintainer, which is a bus factor of one. The fork's delta from its parent is unclear, so provenance and patch history are unverifiable.
- How long does it take to port this Symfony bundle to Laravel?
- Plan for five to ten engineer-days for a first working port, and assume ongoing ownership of a fork afterwards. The work involves wrapping the bundle controller in a Laravel service provider, replicating the container extension, and mapping Symfony catalogues onto Laravel's lang files. Given that maintained Laravel packages already solve this, the effort is rarely justified versus reimplementing the contract natively.
- Should I expose translations at runtime via an endpoint or compile them at build time?
- It depends on whether your catalogues are static per deploy or editable at runtime. If they are static, build-time compilation with laravel-vue-i18n or spatie/laravel-js-translations is faster and cacheable. If you need dynamically editable translations from a CMS or admin panel, a cached, CDN-fronted JSON endpoint returning __('messages') for a locale is the simpler runtime approach. This bundle only covers the runtime-endpoint side, and only for Symfony.
- How do I make Laravel translation strings available to Vue, React or Inertia?
- For Vue with Vite or Inertia, laravel-vue-i18n is the usual answer because it compiles lang/ files into front-end bundles at build time. For React, a build step exporting JSON plus react-i18next handles pluralization and interpolation properly. If you only need a handful of strings, a small controller returning __('messages') as JSON, consumed once at boot, is enough. Keep pluralization and ICU message format in the front-end library, because this bundle cannot provide them.
- Is it safe to put an unmaintained translation bundle on a public route in production?
- Avoid it. Putting an unmaintained, single-maintainer package on a request-serving route with no advisory channel or CVE process is unacceptable production risk. If you must expose translations over HTTP, write a small, cached Laravel controller yourself so you control the surface area and can patch it. Review any third-party route that serializes your full catalogue, since it can leak unreleased copy or admin-only strings.