PHPackages                             dikderoy/yii-pophpconvertor - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Localization &amp; i18n](/categories/localization)
4. /
5. dikderoy/yii-pophpconvertor

ActiveLibrary[Localization &amp; i18n](/categories/localization)

dikderoy/yii-pophpconvertor
===========================

yii 1.x command to convert yii::t php source files to gettext and vice-versa

1.0.0(10y ago)0327GPL-2.0

Since Jun 22Compare

[ Source](https://github.com/dikderoy/emessage-command)[ Packagist](https://packagist.org/packages/dikderoy/yii-pophpconvertor)[ Docs](http://www.yiiframework.com/extension/pophpcommand/)[ RSS](/packages/dikderoy-yii-pophpconvertor/feed)WikiDiscussions Synced yesterday

READMEChangelogDependencies (2)Versions (2)Used By (0)

yii-pophpconvertor
==================

[](#yii-pophpconvertor)

[![Latest Version on Packagist](https://camo.githubusercontent.com/379165082075b7fe6bcaaba69c6ed8c1fa10a4c17f09d6c13f05037ffa2b6d37/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f64696b6465726f792f7969692d706f706870636f6e766572746f722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/dikderoy/yii-pophpconvertor)[![Software License](https://camo.githubusercontent.com/f31a9d8a8e9b79e915c3da9c6eb65fb161250aa9ecb7653cb4e0b7299dced6a3/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f64696b6465726f792f7969692d706f706870636f6e766572746f722e7376673f6d61784167653d323539323030303f7374796c653d666c61742d737175617265)](http://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html)[![Total Downloads](https://camo.githubusercontent.com/61d300cfa6c06ff4b88c6e249bbb80714e95aeeb4e4fe8d431fa9df189e0d2bb/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f64696b6465726f792f7969692d706f706870636f6e766572746f722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/dikderoy/yii-pophpconvertor)

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
-------

[](#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)

Usage instructions and examples are available on [official extension page at yiiframework.com](http://www.yiiframework.com/extension/pophpcommand/)

### Actions

[](#actions)

#### duplicates

[](#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

[](#message)

Searches for messages to be translated in the specified source files

```
message [--config=protected/messages/config.php]

```

#### po

[](#po)

Converts messages from gettext .po files to .php files.

```
po [--config=protected/messages/config.php]

```

#### php

[](#php)

Converts messages from .php files to gettext .po files.

```
php [--config=protected/messages/config.php]

```

#### statistics

[](#statistics)

Shows the translation statistics.

```
statistics [--config=protected/messages/config.php]

```

### Configuration File

[](#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:

parameterdescriptionrequireddefault`sourcePath`string, root directory of all source filesyesnone`messagePath`string, root directory containing message translations.yesnone`languages`array, list of language codes that the extracted messages should be translated to.yesnone`autoMerge`boolean, overwrite the .php files with the new extracted messages.no`false``launchpad`boolean, if the .po files must be stored as `protected/messages/launchpad/template/lang.po` or in the same directory of the converted .php file.no`false``skipUnused`boolean, do not mark unused string with `@@` and skip themno`false``fileTypes`array, a list of file extensions (e.g. `php`, `xml`) Only the files whose extension name can be found in this list will be processed. If empty, all files will be processed.yesnone`exclude`array, a list of directory and file exclusions. Each exclusion can be either a name or a path. If a file or directory name or path matches the exclusion, it will not be copied. For example, an exclusion of `.svn` will exclude all files and directories whose name is `.svn`. And an exclusion of `/a/b` will exclude file or directory `sourcePath/a/b`no`array()``translator`the name of the function for translating messages. This is used as a mark to find messages to be translated.no`Yii::t`Example (if located at default path `protected/messages/config.php`):

```
