dikderoy / yii-pophpconvertor
yii 1.x command to convert yii::t php source files to gettext and vice-versa
Requires
- yiisoft/yii: ^1.1
Requires (Dev)
- phpunit/phpunit: ^5.0
This package is not auto-updated.
Last update: 2024-11-21 03:50:26 UTC
README
This is a fork of the EMessageCommand for Yii 1.x
This command:
- searches for messages to be translated in the specified source files and compiles them into PHP arrays as message source;
- converts messages from
.php
files to gettext.po
files and vice; - finds duplicates between all
.php
files; - shows the translation statistics.
Install
Via Composer
$ composer require dikderoy/yii-pophpconvertor
Add the following items for commandMap to your console.php
config file:
'commandMap' => array(
'emessage' => array(
'class' => '\EMessageCommand',
),
),
Usage
Usage instructions and examples are available on official extension page at yiiframework.com
Actions
duplicates
Finds the duplicates between all .php files. The search can be case
insensitive. Run it after a message
execution, as it searches into the
first language.
duplicates [--caseSensitive=true] [--config=protected/messages/config.php]
message
Searches for messages to be translated in the specified source files
message [--config=protected/messages/config.php]
po
Converts messages from gettext .po files to .php files.
po [--config=protected/messages/config.php]
php
Converts messages from .php files to gettext .po files.
php [--config=protected/messages/config.php]
statistics
Shows the translation statistics.
statistics [--config=protected/messages/config.php]
Configuration File
You can specify the path of the configuration file with --config=
argument,
default is protected/messages/config.php
.
The file must be a valid PHP script which returns an array of name-value pairs.
Each name-value pair represents a configuration option. The following options must be specified:
Example (if located at default path protected/messages/config.php
):
<?php return array( 'sourcePath' => dirname(__DIR__), 'messagePath' => __DIR__, 'languages' => array('da', 'de', 'eo', 'fr', 'it', 'nl', 'pl'), 'autoMerge' => true, 'launchpad' => true, 'skipUnused' => true, 'fileTypes' => array('php'), 'exclude' => array( '.svn', '.bzr', '/messages', '/protected/vendor/' ), );
Change log
June 21, 2016
- Repackaged for Composer
June 4, 2012
- Add check action to check the plural forms.
- Add removeEmptyFiles action to delete the untranslated files.
- Corrections by Motin.
January 4, 2012
- Add the caseSensitive option to the duplicates action.
December 14, 2011
- Patch on sorting the string by Attila N.
November 10, 2010
- Third release with more options, among them : creation of the .po files in a launchpad directory.
May 12, 2010
- Second release (renamed to EMessage) with 2 more commands: message and statistics
May 23, 2009
- Initial release.
Contributing
Fork and Pull-Request