netcore / module-translate
此包最新版本(v1.0.16)没有可用的许可证信息。
v1.0.16
2018-09-05 17:54 UTC
Requires
- netcore/translations: ~1.0.50
- predis/predis: ^1.1
README
该模块允许您管理页面上的可用语言并管理它们的翻译。
预安装
此包是Netcore CMS生态系统的一部分,并且仅在已安装以下包的项目中才能正常工作
https://github.com/netcore/netcore
https://github.com/netcore/module-admin
安装
使用composer安装此包
composer require netcore/module-translate
发布配置、资产、迁移。迁移和初始化
php artisan module:publish-config Translate
php artisan module:publish Translate
php artisan module:publish-migration Translate
php artisan migrate
php artisan module:seed Translate
用法
- 要显示页面中的翻译字符串,您应使用 "lg" 函数,例如
lg('group.key', 'Lorem ipsum')
- 或者如果您想在翻译字符串中使用可替换的属性
lg('group.key', ['attribute' => 'value'], null, 'Lorem ipsum :attribute')
- 并且如果您想在blade文件中使用此函数,只需添加@,例如
@lg('group.key', 'Lorem ipsum')
查找翻译
- 此命令将在项目中查找所有使用 "lg" 函数的翻译,并在resources/seed_translations文件夹中创建Excel表,其中包含键和值(在可用语言中),名称在配置中指定(默认:translations)
php artisan translations:find
导入翻译
- 此命令将导入位于Excel表中的翻译到数据库
php artisan translations:import
有关核心包的更多信息,可以在 (https://github.com/netcore/translations) 中找到