andreazorzi/laravel-tolgee-translator
Composer 安装命令:
composer require andreazorzi/laravel-tolgee-translator
包简介
Integrate Tolgee with your Laravel project
README 文档
README
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 />
andreazorzi/laravel-tolgee-translator 适用场景与选型建议
andreazorzi/laravel-tolgee-translator 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 1.38k 次下载、GitHub Stars 达 5, 最近一次更新时间为 2025 年 03 月 21 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「laravel」 「tolgee」 「Andrea Zorzi」 「laravel-tolgee-translator」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 andreazorzi/laravel-tolgee-translator 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 andreazorzi/laravel-tolgee-translator 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 andreazorzi/laravel-tolgee-translator 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Symfony Tolgee Translation Provider Bridge
Help with Laravel integration of Tolgee service
Easy to use models table
Helpful laravel model commands
Helpful laravel model commands
Symfony Tolgee Translation Provider Bridge
统计信息
- 总下载量: 1.38k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 5
- 点击次数: 22
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-03-21

