Before you start, make sure you have an active license key. You can purchase a license here.
Next, add the private repository to your composer.json
file:
1"repositories": [2 {3 "type": "composer",4 "url": "https://laratranslate.composer.sh"5 }6]
Now, you can install the package using Composer:
1composer require elegantly/laratranslate --dev
Finally, publish the necessary assets with the following command:
1php artisan laratranslate:upgrade
To ensure the new assets are automatically published whenever the package is updated, add this command
to your composer.json
scripts:
1{2 "scripts": {3 "post-update-cmd": [4 "@php artisan laratranslate:upgrade",5 ]6 }7}
You can also publish the config file by running:
1php artisan vendor:publish --tag="laratranslate-config"
If you're not using laratranslate
in production (which is not recommended), add the
following lines to your .gitignore
file:
1.translator.cache2/public/vendor/laratranslate
By default, the Laratranslate UI is accessible at /laratranslate
. You can customize this in
the config file.
Laratranslate is built on elegantly/laravel-translator
, another package I've created. Its
documentation is relevant and can be found on GitHub.
To configure features like 'AI Translation' and 'AI Proofread', you’ll need to publish the config file
for elegantly/laravel-translator
using:
1php artisan vendor:publish --tag="translator-config"
For setting up OpenAI, DeepL, and other services, refer to the elegantly/laravel-translator documentation.