PHPackages                             abbadon1334/atk4-i18next-php - 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. abbadon1334/atk4-i18next-php

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

abbadon1334/atk4-i18next-php
============================

description

1.0.1(6y ago)347[6 PRs](https://github.com/abbadon1334/atk4-i18next-php/pulls)MITPHPPHP &gt;=7.2

Since Jul 10Pushed 2mo ago1 watchersCompare

[ Source](https://github.com/abbadon1334/atk4-i18next-php)[ Packagist](https://packagist.org/packages/abbadon1334/atk4-i18next-php)[ RSS](/packages/abbadon1334-atk4-i18next-php/feed)WikiDiscussions master Synced today

READMEChangelog (2)Dependencies (12)Versions (11)Used By (0)

PHP Language library
====================

[](#php-language-library)

#### Based on i18next

[](#based-on-i18next-httpi18nextcom)

#### Interpolate direct with ATK4 - Agile Toolkit Models

[](#interpolate-direct-with-atk4---agile-toolkit-models-httpswwwagiletoolkitorg)

[![Build Status](https://camo.githubusercontent.com/e1603c62be4dcc2e94e1f665432211c5316218eccee484634eb927a3fbc7a2a0/68747470733a2f2f7472617669732d63692e6f72672f61626261646f6e313333342f61746b342d6931386e6578742d7068702e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/abbadon1334/atk4-i18next-php)[![Codacy Badge](https://camo.githubusercontent.com/20cb0162f70ee7301db1716d38db0d6612951e2b57661ac2c3d0eeed60267470/68747470733a2f2f6170692e636f646163792e636f6d2f70726f6a6563742f62616467652f47726164652f3339333666313862636632643437633338373133646334396463346364343462)](https://www.codacy.com/app/abbadon1334/atk4-i18next-php?utm_source=github.com&utm_medium=referral&utm_content=abbadon1334/atk4-i18next-php&utm_campaign=Badge_Grade)[![Codacy Badge](https://camo.githubusercontent.com/126515a7882b6bc23c59aa3adf610d73bd42e2e01af6fe3dda5917fba428495d/68747470733a2f2f6170692e636f646163792e636f6d2f70726f6a6563742f62616467652f436f7665726167652f3339333666313862636632643437633338373133646334396463346364343462)](https://www.codacy.com/app/abbadon1334/atk4-i18next-php?utm_source=github.com&utm_medium=referral&utm_content=abbadon1334/atk4-i18next-php&utm_campaign=Badge_Coverage)[![Coverage Status](https://camo.githubusercontent.com/c799c9fb641aeae478470ada7357607fd5e2f93518f8029eaa207123c7245d2a/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f61626261646f6e313333342f61746b342d6931386e6578742d7068702f62616467652e7376673f6272616e63683d6d6173746572)](https://coveralls.io/github/abbadon1334/atk4-i18next-php?branch=master)[![StyleCI](https://camo.githubusercontent.com/38f4b0c4ca9087b412e10e4cc4f9b11d1298e5d8d0e43278ba225e09ac854306/68747470733a2f2f6769746875622e7374796c6563692e696f2f7265706f732f3139363231343639392f736869656c643f6272616e63683d6d6173746572)](https://github.styleci.io/repos/196214699)[![Maintainability](https://camo.githubusercontent.com/09fecab8362b2045c97357ad62f544ffe9d4eb14ec57a7ecc3930c943f962303/68747470733a2f2f6170692e636f6465636c696d6174652e636f6d2f76312f6261646765732f36616136343766376538343637323665346638392f6d61696e7461696e6162696c697479)](https://codeclimate.com/github/abbadon1334/atk4-i18next-php/maintainability)[![Test Coverage](https://camo.githubusercontent.com/17a71d7306f8f585f9516f772b1b3fca593cb57bf97c191b336901015a2dcc9d/68747470733a2f2f6170692e636f6465636c696d6174652e636f6d2f76312f6261646765732f36616136343766376538343637323665346638392f746573745f636f766572616765)](https://codeclimate.com/github/abbadon1334/atk4-i18next-php/test_coverage)

install with composer :

`composer require abbadon1334/atk4-i18next-php`

All documentation about the original library can be found here :

### How to use :

[](#how-to-use-)

```
$this->translator = new Translator();
$this->translator->setTranslationsPath(__DIR__.'/data/locales');

```

Define if filename will be used has namespace :

```
$this->translator->useFilenameAsNamespace(true);

```

Define primary and fallback languages (using names of the folder) :

```
$this->translator->setLanguagePrimary($language);
$this->translator->setLanguageFallback($fallback);

```

Add additional language :

```
$this->translator->addLanguage('it');

```

Translate :

```
interface TranslatorInterface
{
    /**
     * Translates the given message.
     *
     * @param string      $key
     * @param array|null  $parameters Array of parameters used to translate message
     * @param string|null $context
     * @param string|null $locale     The locale or null to use the default
     *
     * @return string The translated string
     */
    public function _(string $key, ?array $parameters = null, ?string $context = null, ?string $locale = null): string;
}

// Usage

$result = $this->translator->_('definitionKey');

$result = $this->translator->_('definitionKey', ['param1' => 'test']);

$result = $this->translator->_('definitionKey', ['param1' => 'test'], 'context');

$result = $this->translator->_('definitionKey', ['param1' => 'test'], 'context', 'specificLanguage');

$result = $this->translator->_('namespace:definitionKey', ['param1' => 'test'], 'context', 'specificLanguage');
```

Support I18Next
---------------

[](#support-i18next)

#####

[](#httpi18nextcom)

- Read translations files from folder, every folder is a language code
    - JSON
    - YAML
    - PHP Array
- Write translations files to a folder, every folder is a language code
    - JSON
    - YAML
    - PHP Array
- Get a defined translation in primary language
    - If not found try in fallback language
        - If not found return original string
- Namespaces
    - Get defined translation based on prioritized fallback namespaces
- Context as {key}\_{context}
- Plurals
    - Singular as {key}
    - Plurals as {key}\_plural
    - Multiple plurals as {key}\_{int $counter}
        - Manage when $counter is bigger than max defined plurals
    - Nested interpolate plurals
    - Intervals
- Interpolate
    - Replace {{key}} with defined $paramater value
        - If {{key}} has a point like {{key.index}} and $parameters\[index\] is an array or object will retrive the value
- Nesting
    - Basic
    - Plurals
- Formatting
- Adding Helper for use method Translator::\_ as global functions \_\_
- Adding Helper for use Translator as a global singleton instance
- Collect missing requested keys
- Adding Helper for search/collect calls to method Translator \_ in code
- Added direct translations using key as translation

Support ATK4 - Agile Toolkit Model
----------------------------------

[](#support-atk4---agile-toolkit-model)

#####

[](#httpswwwagiletoolkitorg)

- Interpolate with \\atk4\\data\\Model

###  Health Score

37

—

LowBetter than 83% of packages

Maintenance56

Moderate activity, may be stable

Popularity11

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity60

Established project with proven stability

 Bus Factor1

Top contributor holds 90.9% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~4 days

Total

2

Last Release

2493d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/54f3bc6465a0f20b47cc7cd7bfe00f607bf80b9de41d5d35fa6740f4b6b3f6c9?d=identicon)[abbadon1334](/maintainers/abbadon1334)

---

Top Contributors

[![abbadon1334](https://avatars.githubusercontent.com/u/5801824?v=4)](https://github.com/abbadon1334 "abbadon1334 (80 commits)")[![renovate-bot](https://avatars.githubusercontent.com/u/25180681?v=4)](https://github.com/renovate-bot "renovate-bot (8 commits)")

---

Tags

agileatk4i18ni18nextlibrarytranslation

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/abbadon1334-atk4-i18next-php/health.svg)

```
[![Health](https://phpackages.com/badges/abbadon1334-atk4-i18next-php/health.svg)](https://phpackages.com/packages/abbadon1334-atk4-i18next-php)
```

###  Alternatives

[symfony/translation

Provides tools to internationalize your application

6.6k836.5M2.1k](/packages/symfony-translation)[nesbot/carbon

An API extension for DateTime that supports 281 different languages.

169661.4M4.8k](/packages/nesbot-carbon)[joedixon/laravel-translation

A tool for managing all of your Laravel translations

717911.4k11](/packages/joedixon-laravel-translation)[illuminate/translation

The Illuminate Translation package.

6936.4M495](/packages/illuminate-translation)[lajax/yii2-translate-manager

Translation management extension for Yii 2

227578.8k13](/packages/lajax-yii2-translate-manager)[larswiegers/laravel-translations-checker

Make sure your laravel translations are checked and are included in all languages.

256423.2k2](/packages/larswiegers-laravel-translations-checker)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
