dorkyboi / laravel-frontend-translations
Frontend translations for Laravel projects
dev-master
2019-09-25 15:26 UTC
Requires
- laravel/laravel: >=5.5
This package is auto-updated.
Last update: 2024-04-29 04:19:37 UTC
README
Installing
- Get this package with
composer require dorkyboi/laravel-frontend-translations
- Publish
translator.js
file to your public folder by runningphp artisan vendor:publish --tag=translator
- Add
@frontendTranslations
blade directive to your master blade. This will add code that will load cached copy of laravel's translation files:<script> window.translations = {!! Cache::get('translations') !!}; </script> <script src="/js/translator.js"></script>
Usage
Use translation function in the same way as you use __()
function,
e.g. translate('auth.failed')