Skip to content

I18n Component for messages internationalization in your application.

License

Notifications You must be signed in to change notification settings

flextype-components/i18n

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

I18n Component

version MIT License

I18n Component for messages internationalization of your application.

Installation

composer require flextype-components/i18n

Usage

use Flextype\Component\I18n\I18n;

Add translation keys

I18n::add(['auth_login' => 'Login', 'auth_password' => 'Password'], [],'en_US');

Returns translation of a string. If no translation exists, the original string will be returned. No parameters are replaced.

$translated_string = I18n::find('auth_login');

Global Translation/Internationalization function. Accepts an translation key and returns its translation for selected language. If the given translation key is not available in the current dictionary the translation key will be returned.

// Display a translated message
echo __('auth_login', 'auth');

// With parameter replacement
echo __('auth_welcome_message', [':username' => $username], 'en_US');

Set default locale

I18n::$locale = 'en_US';

License

See LICENSE

About

I18n Component for messages internationalization in your application.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages