安装: 0

依赖: 0

建议者: 0

安全: 0

星标: 5

关注者: 4

分支: 2

开放问题: 0

类型:项目

0.3.0 2017-08-20 16:36 UTC

This package is auto-updated.

Last update: 2024-08-25 07:44:21 UTC


README

Latest Version Build Status Code Coverage Quality Score

CLI 支持翻译。它允许您使用 TranslationBundle 而无需在您的应用程序中安装它。您可以使用 WebUI 并与远程存储同步翻译。

使用方法

要使用 CLI,您需要获取二进制文件并添加您的配置文件。

wget https://php-translation.github.io/cli/downloads/translation.phar
chmod +x translation.phar
touch translation.yml

示例配置与 TranslationBundle 相同。

# translation.yml
translation:
  locales: ["en", "sv"]
  configs:
    app:
      project_root: "%translation.project_root%" # This line is important for the CLI config. 
      dirs: ["%translation.project_root%/app/Resources/views", "%translation.project_root%/src"]
      output_dir: "%translation.project_root%/app/Resources/translations"
      excluded_names: ["*TestCase.php", "*Test.php"]
      excluded_dirs: [cache, data, logs]

注意: "%translation.project_root%" 将是您从其中执行命令的 cwd()

您现在可以运行与 TranslationBundle 相同的命令,但不需要 "translation:" 前缀

  • 下载
  • 解压
  • 同步
php translation.phar download

您还可以使用 WebUI 与 PHP 的 web 服务器一起运行

php translation.phar webui

构建

要构建 phar,请确保已安装 Box 项目,并在您的 php.ini 中设置 phar.readonly = 0

更多信息请参阅:https://moquet.net/blog/distributing-php-cli/

make build