alaame / laravel-translations
This package tends to add php and json translations to
Installs: 605
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/alaame/laravel-translations
This package is auto-updated.
Last update: 2025-10-13 04:04:31 UTC
README
A tiny package that enables you to share translations in resources/lang folder with your frontend
Why to use
- Use
.jsontranslation files which has key,value pairs beside original.phpfiles. - Share all translations in
.jsonand.phpfiles with frontend.
Requirements
- PHP 7.4 or higher.
Installation
- run
composer require alaame/laravel-translations - publish config file
php artisan vendor:publish --provider="Alaame\LaravelTranslations\LaravelTranslationsServiceProvider"
usage
- Just add
@translationsdirective in blade file where you want your frontend to read translations from, there will be available javascript variablewindow._translationsthat you can use anywhere in your js files included AFTER this directive. - package will read any
.jsonor.phpwithinresources/langdirectory and make it available to frontend through@translationsdirective . - If your config
supported-localescontains a locale that not present or not created, package will create the folder automatically.