2017 © Pedro Peláez
 

library rock-i18n

i18n library for PHP

image

romeoz/rock-i18n

i18n library for PHP

  • Saturday, November 7, 2015
  • by romeOz
  • Repository
  • 1 Watchers
  • 1 Stars
  • 793 Installations
  • PHP
  • 2 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 6 Versions
  • 0 % Grown

The README.md

Internationalization library for PHP

Latest Stable Version Total Downloads Build Status HHVM Status Coverage Status License, (*1)

Features

Installation

From the Command Line:, (*2)

composer require romeoz/rock-i18n

In your composer.json:, (*3)

{
    "require": {
        "romeoz/rock-i18n": "*"
    }
}

Quick Start

use rock\i18n\i18n;

$i18n = new i18n;

$i18n->add('hello', 'Hello {{placeholder}}');

$i18n->translate('hello', ['placeholder' => 'world!']); // output: Hello world!

// or 

i18n::t('hello', ['placeholder' => 'Rock!']); // output: Hello Rock!

Documentation

addMulti(array $data)

Adds list i18-records as array., (*4)

use rock\i18n\i18n;

$i18n = new i18n;

$i18n->addMulti([
    'en' => [                // locale
        'lang' => [         // category
            'hello' => 'Hello world!'
        ]
    ],
    'ru' => [
        'lang' => [
            'hello' => 'Привет мир!'
        ]
    ]
]);

addDicts(array $dicts)

Adds dicts as paths., (*5)

use rock\i18n\i18n;

$config = [
    'pathDicts' => [ 
        'en' => [
                'path/to/en/lang.php',
                'path/to/en/validate.php',
            ]
        ]
     ]   
];
$i18n = new i18n($config);

// or

$paths = [ 
    'en' => [
         'path/to/en/lang.php',
         'path/to/en/validate.php',
     ]
];
$i18n->addDicts($paths);

translate(string|array $keys, array $placeholders = [])

$keys can be a string, composite string (months.nov), or array (['months', 'nov'])., (*6)

$i18n->translate('hello');

static t(string|array$keys, array $placeholders = [], $category = null, $locale = null)

Translation via the static method., (*7)

i18n::t('hello');

locale(string $locale)

Select locale., (*8)

use rock\i18n\i18n;

$i18n = new i18n;
$i18n->locale('fr');
$i18n->translate('hello');

category($category)

Select category., (*9)

use rock\i18n\i18n;

$i18n = new i18n;
$i18n->locale('fr')->category('validate');
$i18n->translate('required');

Requirements

  • PHP 5.4+

License

Rock i18n library is open-sourced software licensed under the MIT license., (*10)

The Versions

07/11 2015

dev-master

9999999-dev

i18n library for PHP

  Sources   Download

MIT

The Requires

 

The Development Requires

by Ruslan

i18n internationalization l10n localized

07/11 2015

0.11.0

0.11.0.0

i18n library for PHP

  Sources   Download

MIT

The Requires

 

The Development Requires

by Ruslan

i18n internationalization l10n localized

11/07 2015

0.10.3

0.10.3.0

i18n library for PHP

  Sources   Download

MIT

The Requires

 

The Development Requires

by Ruslan

i18n internationalization l10n localized

12/06 2015

0.10.2

0.10.2.0

i18n library for PHP

  Sources   Download

MIT

The Requires

 

The Development Requires

by Ruslan

i18n internationalization l10n localized

05/03 2015

0.10.1

0.10.1.0

i18n library for PHP

  Sources   Download

MIT

The Requires

 

The Development Requires

by Ruslan

i18n internationalization l10n localized

05/03 2015

0.10.0

0.10.0.0

i18n library for PHP

  Sources   Download

MIT

The Requires

 

The Development Requires

by Ruslan

i18n internationalization l10n localized