PHP code example of andres-ml / cakephp-i18n

1. Go to this page and download the library: Download andres-ml/cakephp-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/ */

    

andres-ml / cakephp-i18n example snippets


__('members'); // outputs members
__d('hospitals', 'members'); // outputs patients

__n('Record', 'Records', 2); // outputs Record or Records
__dn('hospitals', 'Record', 'Records', 2); // outputs Visit or Visits

__x('written communication', 'He read the first letter'); // Adds additional context for use during translation
__dx('hospitals', 'eye chart viewing', 'He read the first letter'); // Adds additional context for use during translation

__xn('character', 'Spy', 'Spies', 2); // Adds additional context for use during translation
__dxn('hospitals', 'to see', 'Spy', 'Spies', 2); // Adds additional context for use during translation

use Aml\I18n\I18n;

__('members');                      // outputs members
__t('members');                     // outputs members
__n('Record', 'Records', 2);        // outputs Records
__tn('Record', 'Records', 1);       // outputs Record

I18n::domain('hospitals');
__('members');                      // still outputs members
__t('members');                     // outputs patients
__n('Record', 'Records', 2);        // outputs Visits
__tn('Record', 'Records', 1);       // outputs Visit

$this->addPlugin('Aml/I18n');