laravel-translations maintained by alaame
Description
This package tends to add php and json translations to
Author
Last update
2021/03/12 18:43
(dev-master)
License
Downloads
608
laravel translations package
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.