Download the PHP package casa-parks/extract-translations without Composer
On this page you can find all versions of the php package casa-parks/extract-translations. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download casa-parks/extract-translations
More information about casa-parks/extract-translations
Files in casa-parks/extract-translations
Package extract-translations
Short Description Casa-Parks' Laravel translation extracter.
License MIT
Informations about the package extract-translations
Introduction
Extract Translations is a simple provision of translation listing, designed for providing use to the front end (IE: in JavaScript).
License
Extract Translations is open-sourced software licensed under the MIT license
Installation
To get started with Extract Translations, use Composer to add the package to your project's dependencies:
composer require casa-parks/extract-translations
Configuration
After installing, register the CasaParks\ExtractTranslations\ExtractTranslationsServiceProvider
in your config/app.php
configuration file:
Basic Usage
Create a simple view composer, like so:
Add this view composer, into your app (or composer) service provider's boot
method:
In your common layout
template file:
Then utilise as required in your JavaScript.
Advanced Usage
Personally, I wouldn't want all of this work to occur on every page load. What I would do is have a translation api (we know that if the translations are going to be used on the front end then the user definitely has JavaScript enabled anyway, right?).
I'd have a simple API controller, like so:
A simple API route (in routes/api.php
or your equivalent):
Then in your front end (IE, with axios):
Bonus Usage
You can even do this on a per-language basis, as a hot-swap, something like:
All versions of extract-translations with dependencies
illuminate/contracts Version ^5.4
illuminate/support Version ^5.4
illuminate/translation Version ^5.4