00f100/fcphp-i18n

There is no license information available for the latest version (0.1.2) of this package.

Internationalization i18n

0.1.2 2018-08-04 15:27 UTC

This package is auto-updated.

Last update: 2024-04-18 04:51:34 UTC


README

Build Status codecov Total Downloads

How to install

Composer:

$ composer require 00f100/fcphp-i18n

or add in composer.json

{
    "require": {
        "00f100/fcphp-i18n": "*"
    }
}

How to use

<?php

$default = 'pt-br';
$translate = [
    'pt-br' => [
        'My name is %s' => 'Meu nome é %s',
    ],
    'en' => [
        'My name is %s' => 'My name is %s',
    ],
    'es' => [
        'My name is %s' => 'Mi nombre és %s',
    ],
];
__i18n_configure($default, $translate);
$name = 'João';
$text = 'My name is %s';

// Print: Meu nome é João
echo __($text, $name);

// Print: Meu nome é João
echo _i18n_translate($text, $name);