Before you start, make sure you have an active license key. You can purchase a license here.
Next, follow the installation instructions available here.
Then, publish the necessary assets with the following command:
php artisan laratranslate:upgrade
To ensure the new assets are automatically published whenever the package is updated, add this command
to your composer.json
scripts:
{
"scripts": {
"post-update-cmd": [
"@php artisan laratranslate:upgrade",
]
}
}
If you're not using laratranslate
in production (which is not recommended), add the
following lines to your .gitignore
file:
.translator.cache
/public/vendor/laratranslate
By default, the Laratranslate UI is accessible at /laratranslate
. You can customize this in
the config file.
The package should work seamlessly with both PHP
and JSON
files, including
files nested in subdirectories such as /spark/en.json
or
vendor/package-name/fr.json
.
If you store your translation strings in a database or use a different method, you can still use this package!
You will need to create a custom driver by extending Elegantly\Translator\Drivers\Driver
.
This allows Laratranslate to understand how to edit your translations.
Laratranslate is built on elegantly/laravel-translator
, another package I've created. Its
documentation is relevant and can be found on GitHub.
You can publish the config file by running:
php artisan vendor:publish --tag="laratranslate-config"
And
php artisan vendor:publish --tag="translator-config"
For setting up OpenAI, OpenAI compatible model, and other services, refer to the elegantly/laravel-translator documentation .
You can customize the prompts for both the 'AI Translation' and 'AI Proofread' features in the
elegantly/laravel-translator
configuration file.
If you think the default prompts should be different, feel free to suggest changes!
By default, this package will attempt to determine the locales defined in your application by scanning
your lang
directory.
You can configure the locales in either the laratranslate
or
elegantly/laravel-translator
configuration file like this:
return [
// ...
'locales' => ['en', 'fr', 'es'],
// ...
];
This site uses cookies to improve your user experience.
Operational Cookies
We need to use certain cookies to make some web pages function. That is why they do not require your consent.
elegantly_cookiesconsent
1 year 1 month 1 day
elegantly_session
2 hours
XSRF-TOKEN
2 hours
Marketing Cookies
These cookies are used to enhance the relevance of our marketing campaigns. They enable us to offer you more targeted advertisements based on your interaction with our website.
_gcl_au
3 months 6 days
This cookie is used by Google AdSense for experimenting with advertisement efficiency across websites using their services.
IDE
1 year 1 month
Used for ad delivery, personalization, and measurement
ANID
1 year 1 month
Used for advertising
AID
1 year 1 month
Links user activity across devices for ads measurement
TAID
2 weeks
Links user activity across devices for ads measurement
DSID
2 weeks
Identifies signed-in users on non-Google sites so personalization settings are respected
__gads
1 year 1 month
Enables sites to show Google ads
NID
6 months
Stores preferences and personalizes ads in Google services (also used for analytics and functionality)