著名互动 / 翻译者
允许使用外部服务来更新翻译
v1.6
2017-04-20 13:29 UTC
Requires
- php: >=5.6
This package is not auto-updated.
Last update: 2024-09-15 01:52:43 UTC
README
将laravel项目对外开放翻译
基本安装
-
composer require famousinteractive/translators -
在config/app.php的serviceProvider中添加
Famousinteractive\Translators\TranslatorsServiceProvider::class -
发布配置文件:
php artisan vendor:publish -
运行命令
php artisan famousTranslators:initialize获取clientId和ApiKey并生成配置文件
使用数据库内容管理器
除了翻译者,您还可以使用数据库内容管理器来通过数据库管理更多内容,总是通过API可用
-
运行迁移:
php artisan migrate -
在视图中使用
fitrans($key = 'mypage.section1.title', [optional] $default = '默认值', [optional] $parameters = ['key' => 'value'], [optional] $lang = 'fr', [optional] $useCache = true)
值得了解
如果您想要为本地和生成环境使用不同的API密钥,请确保将famousTranslator.php配置文件添加到您的gitignore中