PHPackages                             68publishers/i18n - 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. 68publishers/i18n

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

68publishers/i18n
=================

Internationalization and localization your app with a minimum effort.

v0.4.2(1y ago)04.4k—0%[4 issues](https://github.com/68publishers/i18n/issues)MITPHPPHP ^7.3 || ^8.1

Since Jun 5Pushed 1y ago1 watchersCompare

[ Source](https://github.com/68publishers/i18n)[ Packagist](https://packagist.org/packages/68publishers/i18n)[ RSS](/packages/68publishers-i18n/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (8)Dependencies (13)Versions (9)Used By (0)

> ⚠️ Warning! This package does not have active support, it exists only for the historical needs of the author.

i18n
====

[](#i18n)

[![Build Status](https://camo.githubusercontent.com/5469f66256f251eec210dd09737a19f5c7a04b40249d1b200db1676dcb6f4049/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f36387075626c6973686572732f6931386e2f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.com/68publishers/i18n)[![Quality Score](https://camo.githubusercontent.com/468520a60d747637f7c66c3ad415d15862ff484b0bf3cfeaa6a1c224711c7f0e/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f36387075626c6973686572732f6931386e2e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/68publishers/i18n)[![Coverage Status](https://camo.githubusercontent.com/e47e9a2b8e2f576b27f6d9b6f6fba452e2877719d9180c7b01d625ebe0cb91fe/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f636f7665726167652f672f36387075626c6973686572732f6931386e2e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/68publishers/i18n/code-structure)[![Total Downloads](https://camo.githubusercontent.com/97e5b707b1b1480c93e135a28ccad591486dd6829b46362a3a980fd6bbb30e89/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f36387075626c6973686572732f6931386e2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/68publishers/i18n)[![Latest Version on Packagist](https://camo.githubusercontent.com/11aedf13ae176f8c3d52f1239a12107884ef5862cebe6d0dec0a9503f002302c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f36387075626c6973686572732f6931386e2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/68publishers/i18n)

This package helps you to deal with regions with different languages, currencies and countries. It could be helpful even if you have single region project.

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

[](#installation)

The best way to install 68publishers/i18n is using Composer:

```
$ composer require 68publishers/i18n
```

then you can register extension into DIC:

```
extensions:
    68publishers.i18n: SixtyEightPublishers\i18n\DI\I18nExtension(%debugMode%)
```

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

[](#configuration)

```
68publishers.i18n:
    profiles:
        europe:
            language: [ sk_SK, en_GB, de_DE, pl_PL ]
            currency: [ EUR, PLZ, GBP ]
            country: [ SK, GB, DE, PL ]
            domain: [ 'europe\.example\.com' ] # regex
        north_america:
            language: en_US
            currency: USD
            country: US
            domain: 'example\.com\/na'
            enabled: no # default is `yes`
        default: # If the default profile doesn't exists, the first profile is taken as default
            language: cs_CZ
            currency: CZK
            country: CZ
    lists:
        fallback_language: en # default
        default_language: null # default

    translation_bridge:
        locale_resolver:
            enabled: yes # registers custom TranslatorLocaleResolver through 68publishers/translation-bridge extension
            use_default: yes # use language of default's profile if profile is not detected, default is `no`
            priority: 15

    # if you want to use custom profile storage or profile detector:
    storage: My\Custom\ProfileStorage
    detector: My\Custom\Detector
```

### Integration with 68publishers/translation-bridge

[](#integration-with-68publisherstranslation-bridge)

#### Translator Locale Resolving

[](#translator-locale-resolving)

The Translator's locale can be resolved by the currently active profile. That is done with custom `TranslatorLocaleResolver` that is automatically registered if an option `translation_bridge.locale_resolver.enabled` is set to `TRUE`.

#### Synchronization Between Profile's Language and Translator's Locale

[](#synchronization-between-profiles-language-and-translators-locale)

The Translator's locale is automatically changed when the active profile's language is changed.

```
