1. Go to this page and download the library: Download qcubed/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/ */
qcubed / i18n example snippets
$cache = new MyCache();
$translator = new \QCubed\I18n\SimpleCacheTranslator($cache);
$translator->bindDomain('package/subpackage', __VENDOR_DIR__ . "/package/subpackage/I18n") // directory of .po files
->bindDomain('project', __PROJECT_DIR__ . "/I18n") // pointer to your specific translations
->setDefaultDomain('project') // get translations from here if no domain is specified
->setCache($cache)
->setTempDir($tempDirPath);
\QCubed\I18n\TranslationService::instance()->setTranslator($translator);
\QCubed\I18n\TranslationService::instance()->setLanguage('es'); //Make a particular language the active language.
$str = _t("Hello"); // translate Hello into the currently active translation using the default domain (that is, the .po file from your project for the default language)
$str = _t("Hello", "package/subpackage", "a context"); // get a translation using a domain and context
$str = _tp("A Hello to your", "Many hellos to you", $n); // Do a plural translation based on the integer $n
$str = _tp("A Hello to your", "Many hellos to you", $n, "package/subpackage", "a context"); // Do a plural translation based on the integer $n with domain and context
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.