PHPackages                             smmoosavi/php-gettext - 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. smmoosavi/php-gettext

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

smmoosavi/php-gettext
=====================

Wrapper for php-gettext by danilo segan. This library provides PHP functions to read MO files even when gettext is not compiled in or when appropriate locale is not present on the system.

v1.0.1(10y ago)1927.0k↓23.7%4[1 issues](https://github.com/smmoosavi/php-gettext/issues)[1 PRs](https://github.com/smmoosavi/php-gettext/pulls)1PHPPHP &gt;=5.3.0

Since Nov 27Pushed 10y ago2 watchersCompare

[ Source](https://github.com/smmoosavi/php-gettext)[ Packagist](https://packagist.org/packages/smmoosavi/php-gettext)[ RSS](/packages/smmoosavi-php-gettext/feed)WikiDiscussions master Synced yesterday

READMEChangelog (3)Dependencies (1)Versions (8)Used By (1)

php-gettext
===========

[](#php-gettext)

Wrapper for php-gettext by danilo segan. This library provides PHP functions to read MO files even when gettext is not compiled in or when appropriate locale is not present on the system.

How to Install
--------------

[](#how-to-install)

#### Using [Composer](http://getcomposer.org/)

[](#using-composer)

Create a composer.json file in your project root:

```
{
    "require": {
        "smmoosavi/php-gettext": "dev-master"
    }
}
```

Then run the following composer command:

```
$ php composer.phar install
```

How to use
----------

[](#how-to-use)

### Create translate files

[](#create-translate-files)

```
.
├── composer.json
├── composer.lock
├── locale
│   ├── en_US
│   │   └── LC_MESSAGES
│   │       ├── messages.mo
│   │       └── messages.po
│   └── fa_IR
│       └── LC_MESSAGES
│           ├── messages.mo
│           └── messages.po
├── test.php
└── vendor
    ├── autoload.php
    ...

```

### php code

[](#php-code)

```
