owenmelbz / php-to-pot
Creates a .pot file for translations based off a directory of php files
Requires
- gettext/gettext: 4.*
- nategood/commando: 0.2.*
This package is auto-updated.
Last update: 2024-11-29 04:19:59 UTC
README
This is a really simple command line tool which generates a .pot or .po file based off language strings that it finds within the defined directory.
Currently it simply accepts 2 paths, an input - which should be a directory of templates, and an output, which is typically a .pot file.
Installation
composer install owenmelbz/php-to-pot
Optional
Create a composer script to save your little fingers e.g
"scripts": {
"makepot": "./vendor/bin/php-to-pot -i ./my-template-directory -o ./translation-template.pot"
}
You can then just run composer run makepot
to generate your file when needed.
Usage
The tool has only 2 params
- -i/--in (a directory containing files you want to generate translations from)
- -o/--out (the path/filename of the generated .pot)
e.g
./vendor/bin/php-to-pot -i ./my-templates -o translation-template.pot
Support
- Magento 2
- Wordpress
- Laravel Blade
- Anything else that uses .php extension and a list of the following translation functions
__ n__ p__ e d_ dn__ dp__ np__ dnp__ noop__ gettext ngettext pgettext dgettext dngettext dpgettext npgettext dnpgettext noop
Disclaimer
Under the hood, this just interfaces with https://github.com/oscarotero/Gettext to allow developers to generate .pot files to send to translators to create the actual .po and .mo files.