mrmuminov/php-i18n

A PHP library for internationalization

1.3.2 2022-08-20 19:02 UTC

This package is auto-updated.

Last update: 2024-11-21 00:28:55 UTC


README

Latest Stable Version Total Downloads License

A PHP library for internationalization

Installation

composer require mrmuminov/php-i18n

or add the following to your composer.json:

{
  "require": {
    "mrmuminov/php-i18n": "^v1.0"
  }
}

Usage

<?php

require '../vendor/autoload.php';

$i18n = new \MrMuminov\PhpI18n\I18n([
    'languages' => ['en', 'uz'],
    'language' => 'en',
]);

echo $i18n->get('Home');
// Output: "Home"

echo $i18n->get('Hello %s', 'Bahriddin');
// Output: "Hello Bahriddin"

// Set language to uz
$i18n->setLanguage('uz');

echo $i18n->get('Hello %s', 'Bahriddin');
// Output: "Salom Bahriddin"

Author