Download the PHP package samehdoush/lingua without Composer
On this page you can find all versions of the php package samehdoush/lingua. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download samehdoush/lingua
More information about samehdoush/lingua
Files in samehdoush/lingua
Package lingua
Short Description Add your Laravel language translations to your asset pipeline for use in Javascript packages like Vue or React.
License MIT
Informations about the package lingua
Originally based on Zora, but was hard modified.
Generate translations into JS file
This library allows you to generate your Laravel translations to your asset pipeline for use in JavaScript packages like Vue. (React coming soon)
Requirements
- Laravel: ^9.* or higher
- InertiaJS: ^1.*
- VueJS: ^3.*
- ViteJS: ^3.*
Installation
First, install the package via composer:
The package will automatically register itself.
Next add an alias to your vite.config.js
To build your Laravel translation into JS file, use:
You can automate that process as you wish.
But we recommend you a vite plugin called vite-plugin-run
Install it using you package manager and just add this lines to your vite.config.js
plugins section.
Example of usage: (running only at serve process)
VueJS
In your resources/js/app.js
and (if you use SSR) resources/js/ssr.js
add imports
and register LinguaVue plugin
Add locale
key into your HandleInertiaRequest::share
method
That's how your application will know your initial locale.
React
Coming soon
Usage
In your template tag use it in Laravel style, like
You can also use trans in your setup
function by injecting it.
Changelog
All changes made here will be described in Changelog.md file.