Use a translation namespace vor mutliple translation files.
zoutapps/laravel-lang-vendornamespace is a Laravel package for use a translation namespace vor mutliple translation files..
It currently has 0 GitHub stars and 401 downloads on Packagist (latest version v1.0.4).
Install it with composer require zoutapps/laravel-lang-vendornamespace.
Discover more Laravel packages by zoutapps
or browse all Laravel packages to compare alternatives.
Last updated
This package is aimed at package developers that want multiple packages translations under one namespace.
It's currently not easily possible to gather all your packages translations under one namespace which can bloat up the calls to your translations as well as your resources/lang/vendor folder when publishing the files.
For example having packages:
zoutapps/awesome-packagezoutapps/nice-packageyou can't register the translations to be able to use them like this:
trans('zoutapps::awesome-package')
trans('zoutapps::nice-package')
With this package you now can do this!
Via Composer
$ composer require zoutapps/laravel-lang-vendornamespace
In your PackageServiceProvider instead of using
$this->loadTranslationsFrom(__DIR__ . '/../resources/lang', '<your-vendor-name>')
make a call to
VendorNamespace::loadTranslationsFrom(__DIR__ . '/../resources/lang', '<your-vendor-name>')
in your boot() method.
Publishing your translations is the same as before:
$this->publishes([
__DIR__ . '/../resources/lang' => resource_path('lang/vendor/<your-vendor-name>'),
], 'lang');
All paths you register will be added to your translation namespace.
For this to happen, we wait for the application booted callback and:
TranslationLoader namespacesWhile your app environment is set to local we will always regenerate the links.
When your app is in any other environment, we will check for existence of the lang folder inside our package
and only generate the links if it is not present.
Please see the changelog for more information on what has changed recently.
$ composer test
Please see contributing.md for details and a todolist.
If you discover any security related issues, please email [email protected] instead of using the issue tracker.
MIT. Please see the license file for more information.