aeliot-tm/translation-maintain

The package that helps you keep your translations consistent

v2.8.0 2023-02-13 21:32 UTC

README

Package which helps to keep you translations consistent. Compatible with Symfony versions since 3.4.

Installation

Basically, if you use Flex there is enough to execute the command:

composer require --dev aeliot-tm/translation-maintain

See additional information about installation there and description of configuration.

Usage

Testing of translation files

Test your YAML translation files:

php bin/console aeliot_trans_maintain:lint:yaml base

Full information about files transformation see there.

Update YAML files

  1. Update certain YAML file:
    php bin/console aeliot_trans_maintain:yaml:transform <PATH_TO_FILE_TO_BE_UPDATED>
  2. Update all YAML files in the project:
    php bin/console aeliot_trans_maintain:yaml:transform --all
  3. Update some YAML files of the project which belongs to domain(s) and/or locale(s):
    php bin/console aeliot_trans_maintain:yaml:transform --domain=messages --domain=validators --locale=en --locale=de
  4. Update all YAML files in the specific directory (e.g. not standard or not in the project):
    find PATH_TO_DIRECTORY -type f \( -iname \*.yml -o -iname \*.yaml \) | sort | xargs  -I {} -t  php  bin/console aeliot_trans_maintain:yaml:transform $1{}
    You can filter them additionally with grep "some text in the file path" when you add this before, after or instead of sort instruction. And don't forget to separate instructions by the pipe.

Additional information about updating of YAML files see there.

Export missed translations

Example:

php bin/console aeliot_trans_maintain:yaml:export_missed_translations messages en de

Full information about files transformation see there.

Machine Translation via Vendor's API

Full information about machine translation see there.

NOTE: There used standard \Symfony\Component\Yaml\Yaml class for dumping, so it inserts single-word values without escaping.

Additional description

Article on the Habr (ru): https://habr.com/ru/articles/555954/

You can help to implement more features :) See plans there.