🔤Translations

we build a translations loader that loads translations from the database, and you can scan current translations and export them to an excel sheet and import it again to the system.
Install
composer require queents/translations-module
Install Translations Plugin
Add Module to modules_statuses.json
if not exists
{
"Translations": true
}
to install translations plugin you must run this command
php artisan translations:install
it will generate a permission for the translations table and append it to the main admin role.
Make a migration
php artisan migrate
Publish Assets
npm i & npm run build
OR
yarn & yarn build
Active Auto Translation
to active auto translation feature you must go to google cloud and get an api key after allow google translation api and on the .env file
GOOGLE_API=
set this key to your API key, or you can set it on the Google Settings
Use Translation Key On JS
you can now access this translations by key from trans
prop and you can access it like this.$page.props.trans
as a computed method like
computed: {
lang() {
return this.$page.props.data.trans
}
},
and you can build an easy to use method for get translation by key like
methods: {
trans(key){
return this.lang[key] ? this.lang[key] : key;
}
}
Last updated