laravel-tolgee-translator maintained by andreazorzi
Description
Integrate Tolgee with your Laravel project
Author
Last update
2026/04/24 23:06
(dev-master)
License
Downloads
1 209
Tags
Laravel Tolgee Translator
This package simplifies the integration of Toglee on Laravel by adding commands and blade directives.
Installation
composer require andreazorzi/laravel-tolgee-translator
Getting started
Config
/*
* Tolgee service host
*/
'host' => env('TOLGEE_HOST', 'https://app.tolgee.io'),
/**
* Your tolgee api key
*/
'api_key' => env('TOLGEE_API_KEY'),
/**
* Tolgee project id
*/
'project_id' => env('TOLGEE_PROJECT_ID'),
/**
* Default project language
*/
'locale' => env('TOLGEE_LOCALE', 'en'),
/**
* Overwrite base locale translations files.
*/
'override' => env('TOLGEE_OVERRIDE', false),
/**
* Accepted translation states. Check Tolgee documentation for available states.
* Ex: REVIEWED,DISABLED,UNTRANSLATED,TRANSLATED
*/
'accepted_states' => explode(",", env('TOLGEE_ACCEPTED_STATES', 'REVIEWED')),
/**
* Files to ignore during sync.
*/
'ignore_files' => explode(",", env('TOLGEE_IGNORE_FILES', '')),
/*
* Set a specific subfolder for language files
* Ex: app/lang/{locale}/tolgee -> "tolgee"
*/
'lang_subfolder' => env('TOLGEE_LANG_SUBFOLDER'),
/*
* Set a specific subfolder for language files
* Ex: app/lang/{locale}/tolgee -> "tolgee"
*/
'sync_on_production' => env('TOLGEE_SYNC_ON_PRODUCTION', false),
Commands
Export Keys
php artisan tolgee:export-keys
Export all project translations keys and save them into tolgee project, existing keys will not be overwritten.
Delete Keys
php artisan tolgee:delete-keys
Delete all keys from the tolgee project.
Sync Translations
php artisan tolgee:sync-translations
Sync the translations from Tolgee to your local project
Usage
To insert the translation into your project blade you can use the blade directive @tolgee($key)
@tolgee('pages.index.title')
If you want you can also get the translation by calling the the helper tolgee($key)
tolgee('pages.index.title');
Those methods return the string on production environment and a html string on local environment. The html string provide a direct link to the tolgee translation
Sync Button
It is possible to insert a button to update translations directly on the page under testing
<x-tolgee::sync-translations />