00f100 / fcphp-i18n
Internationalization i18n
Installs: 136
Dependents: 0
Suggesters: 0
Security: 0
Stars: 4
Watchers: 1
Forks: 1
Open Issues: 0
Type:package
Requires
- php: >=7.2
Requires (Dev)
- 00f100/phpdbug: *
- phpunit/phpunit: 6.*
This package is auto-updated.
Last update: 2024-11-18 06:12:42 UTC
README
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);