unit27/twig-gettext-extractor

The Twig Gettext Extractor is Poedit friendly tool which extracts translations from twig templates.

Installs: 45

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 1

Forks: 32

Type:application

1.1.3 2013-02-14 16:41 UTC

This package is not auto-updated.

Last update: 2024-11-09 14:55:32 UTC


README

The Twig Gettext Extractor is Poedit friendly tool which extracts translations from twig templates.

Installation

The recommended way to install Twig Gettext Extractor is through composer.

{
    "require": {
        "unit27/twig-gettext-extractor": "1.1.*"
    }
}

Setup

By default, Poedit does not have the ability to parse Twig templates. This can be resolved by adding an additional parser (Edit > Preferences > Parsers) with the following options:

  • Language: Twig
  • List of extensions: *.twig
  • Invocation:
    • Parser command: <project>/vendor/bin/twig-gettext-extractor --sort-output --force-po -o %o %C %K -L PHP --files %F
    • An item in keyword list: -k%k
    • An item in input file list: %f
    • Source code charset: --from-code=%c

Now you can update your catalog and Poedit will synchronize it with your twig templates.

Tests

To run the test suite, you need composer and PHPUnit.

$ composer install --dev
$ phpunit

License

Twig Gettext Extractor is licensed under the MIT license.