1. Go to this page and download the library: Download maatify/php-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/ */
maatify / php-i18n example snippets
$scopes->create(new CreateScopeCommand('web', 'Website'));
$domains->create(new CreateDomainCommand('home', 'Home page'));
$assignments->assign('web', 'home');
$keyId = $writer->createKey(new CreateKeyCommand('web', 'home', 'title'));
$writer->upsertTranslation(new UpsertTranslationCommand(
languageCode: 'en',
keyId: $keyId,
value: 'Welcome',
type: null,
));
$richKeyId = $writer->createKey(new CreateKeyCommand('web', 'home', 'rich-copy'));
$writer->upsertTranslation(new UpsertTranslationCommand(
languageCode: 'en',
keyId: $richKeyId,
value: '<p>Formatted copy</p>',
type: 'client.rich-copy', // A token defined by this consumer; I18n assigns it no behavior.
));
$reader->getValue('en', 'web', 'home', 'title'); // 'Welcome'
$reader->getValue('ar', 'web', 'home', 'title'); // null: exact miss, no fallback
$reader->getTranslation('en', 'web', 'home', 'rich-copy'); // value + nullable type
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.