jlaso / translations-apibundle
https://www.tradukoj.com的客户端API
dev-master
2018-11-14 20:49 UTC
Requires
- php: >=5.3.7
- liuggio/excelbundle: ~2.0
This package is auto-updated.
Last update: 2024-09-15 11:06:11 UTC
README
概览
此bundle允许与https://www.tradukoj.com进行API通信
为了安装此bundle,您需要注意要求
php > 5.3.7
php-lzf extension must be installed (try sudo pecl install lzf)
安装
检出代码副本
// in composer.json
"require": {
// ...
"jlaso/translations-apibundle": "*"
// ...
},
然后使用您的内核注册此bundle
// in AppKernel::registerBundles()
$bundles = array(
// ...
new JLaso\TranslationsApiBundle\TranslationsApiBundle(),
// Excel Bundle
new Liuggio\ExcelBundle\LiuggioExcelBundle(),
// ...
);
配置
// in app/config/parameters.yml
###############################
## TRANSLATIONS API REST ##
###############################
jlaso_translations_api_access:
project_id: 1 # the number that correspond to the project created
key: 1234 # the key that systems assigns
secret: 1234 # the password that you choose when init project in server
url: http://www.tradukoj.com/app.php/api/
// in app/config/config.yml
translations_api:
default_locale: %locale%
managed_locales: ['es', 'en', 'fr', 'ca'] # the languages you want
and remember to enable translator in framework key
framework:
translator: { fallback: %locale% }
用法
首先进行schema:update以初始化带有SCM表的数据库
app/console doctrine:schema:update --force --env=dev
现在,用您的translations/catalog.locale.yml文件的内容填充本地数据库
app/console jlaso:translations:dump
然后,将本地数据库中的消息上传到远程服务器
app/console jlaso:translations:sync --upload-first=yes
when you use the bundle first time is necessary the use the upload-first option in order to generate the remote db
示例
用于同步本地翻译与服务器(远程)翻译
app/console jlaso:translations:sync [--cache-clear] [--backup-files]
在视图中
Currently only be used yaml files in src/Company/bbbBundle/Resource/translations/messages.xx.yml
with xx as locale, and bbb as bundle name,
same for translations resources of app located at app/Resources/messages.xx.yml