PHP code example of flextype-components / i18n

1. Go to this page and download the library: Download flextype-components/i18n library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

flextype-components / i18n example snippets


use Flextype\Component\I18n\I18n;

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

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

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

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

I18n::$locale = 'en_US';