switon/i18n

Translation, locale, and message formatting for Switon (standalone)

Maintainers

Package info

github.com/switon-php/i18n

Documentation

pkg:composer/switon/i18n

Statistics

Installs: 8

Dependents: 1

Suggesters: 0

Stars: 0

Open Issues: 0

v1.0.0 2026-05-10 00:17 UTC

This package is auto-updated.

Last update: 2026-05-10 00:20:33 UTC


README

Translation, locale, and message formatting for Switon Framework.

Installation

composer require switon/i18n

Requirements: PHP 8.3+

Quick Start

use Switon\Core\Attribute\Autowired;
use Switon\I18n\TranslatorInterface;

class WelcomeService
{
    #[Autowired] protected TranslatorInterface $translator;

    public function message(string $name): string
    {
        return $this->translator->translate('hello', ['name' => $name]);
    }
}

// @resources/i18n/en.php
// return [
//     'hello' => 'Hello, {name}!',
// ];

Docs: https://docs.switon.dev/latest/i18n

License

MIT.