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[1 issues](https://github.com/abbadon1334/atk4-i18next-php/issues)[6 PRs](https://github.com/abbadon1334/atk4-i18next-php/pulls)MITPHPPHP &gt;=7.2

Since Jul 10Pushed 3w 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 2w ago

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

2542d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/5801824?v=4)[Francesco Danti](/maintainers/abbadon1334)[@abbadon1334](https://github.com/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

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

1926.6k1](/packages/smmoosavi-php-gettext)[laradevs/spanish

labels translated to spanish

166.7k](/packages/laradevs-spanish)

PHPackages © 2026

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