https://github.com/php-translation/cli
CLI support for translations
https://github.com/php-translation/cli
Last synced: about 1 year ago
JSON representation
CLI support for translations
- Host: GitHub
- URL: https://github.com/php-translation/cli
- Owner: php-translation
- License: mit
- Created: 2017-07-05T06:59:05.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2017-08-20T16:52:28.000Z (almost 9 years ago)
- Last Synced: 2025-03-27T09:22:05.589Z (about 1 year ago)
- Language: PHP
- Homepage:
- Size: 12.4 MB
- Stars: 5
- Watchers: 3
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: Changelog.md
- License: LICENSE
Awesome Lists containing this project
README
# CLI support for translation
[](https://github.com/php-translation/cli/releases)
[](https://travis-ci.org/php-translation/cli)
[](https://scrutinizer-ci.com/g/php-translation/cli)
[](https://scrutinizer-ci.com/g/php-translation/cli)
CLI support for translation. It allows you use the TranslationBundle without installing it in your application. You can
use the WebUI and sync translations with remote storages.
### Use
To use the CLI you need to fetch the binary and add your configuration file.
```bash
wget https://php-translation.github.io/cli/downloads/translation.phar
chmod +x translation.phar
touch translation.yml
```
Example configuration is the same as for the TranslationBundle.
```yaml
# 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]
```
> **Note:** "%translation.project_root%" will be your `cwd()` from where you execute the command.
You may now run the same commands as you do with the TranslationBundle but without
the "translation:" prefix
* download
* extract
* sync
* etc
``` bash
php translation.phar download
```
You may also run PHP's web server with the WebUI with:
``` bash
php translation.phar webui
```
### Build
To build a phar make sure you have [Box project](https://box-project.github.io/box2/) installed and
`phar.readonly = 0` in your php.ini.
Read more at: https://moquet.net/blog/distributing-php-cli/
```
make build
```