phpaml/i18n

JSON-first internationalization for PHPAML and AML View.

Maintainers

Package info

github.com/MR-C0DE/phpaml-i18n

pkg:composer/phpaml/i18n

Transparency log

Statistics

Installs: 1

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v0.1.0-beta.1 2026-08-19 15:01 UTC

This package is auto-updated.

Last update: 2026-08-19 15:12:08 UTC


README

JSON-first internationalization for PHPAML and AML View.

aml install i18n

Translations live under src/locales/{locale}. Every nested JSON path becomes a dot key:

src/locales/fr/pages/home.json → pages.home.title
use AML\I18n\I18n;
use function AML\I18n\t;

I18n::configure(__DIR__ . '/locales', 'fr', 'en');
echo t('pages.home.welcome', ['name' => 'André']);
echo trans_choice('pages.home.tasks', 3);

aml install i18n configures the translator automatically in a PHPAML application. Files can be nested freely below each locale. Missing keys fall back to APP_FALLBACK_LOCALE, then return the key itself so the interface remains diagnosable.

aml i18n:add es
aml i18n:check
aml i18n:missing fr
aml i18n:set-default en

Plural forms use one and other keys. LocaleResolver can select a supported locale from a route, cookie or Accept-Language header while always returning a declared locale.