PHPackages                             iqomp/locale - 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. iqomp/locale

ActiveComposer-plugin[Localization &amp; i18n](/categories/localization)

iqomp/locale
============

Simple module text translation

1.1.1(5y ago)022MITPHP

Since Nov 26Pushed 5y ago1 watchersCompare

[ Source](https://github.com/iqomp/locale)[ Packagist](https://packagist.org/packages/iqomp/locale)[ RSS](/packages/iqomp-locale/feed)WikiDiscussions master Synced 6d ago

READMEChangelogDependencies (4)Versions (5)Used By (0)

iqomp/locale
============

[](#iqomplocale)

Simple module text translation. This module catch all translation text from all installed composer module with special rule, and make them globally available to use. The purpose of this module is to make it possible each composer module bring their own translation text, and overwrite by application without editing module translation data.

The cache of language is generated during `composer update`. You can call `composer update` anytime after updating translation file.

Installation
------------

[](#installation)

```
composer require iqomp/locale
```

Configuration
-------------

[](#configuration)

If your composer module has translation, add config as below on the composer.json file of the module:

```
{
    "extra": {
        "iqomp/locale": "iqomp/locale/"
    }
}
```

The extra key should be `iqomp/locale`, with string value pointing to a folder in module main directory.

All php file inside the folder will be taken and combine with one application make and make them usable globally.

The file name will be used as translation domain.

The `extra->iqomp/locale` from application `composer.json` will also loaded.

Translation File
----------------

[](#translation-file)

Each translation file should return array of the translation, where the filename is the translation domain, array key is translation key, and the value is translation result with format [ICU MessageFormat](https://www.php.net/manual/en/class.messageformatter.php).

```
