PHP code example of audero / audero-shared-gettext
1. Go to this page and download the library: Download audero/audero-shared-gettext 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/ */
audero / audero-shared-gettext example snippets
// Include the Composer autoloader
$language = 'it_IT';
$domain = 'audero';
putenv('LC_ALL=' . $language);
setlocale(LC_ALL, $language);
try {
$sharedGettext = new Audero\SharedGettext\SharedGettext($translationsPath, $language, $domain);
// Create the mirror copy of the translation and return the new domain
$newDomain = $sharedGettext->updateTranslation();
// Sets the path for the current domain
bindtextdomain($newDomain, $translationsPath);
// Specifies the character encoding
bind_textdomain_codeset($newDomain, 'UTF-8');
// Choose domain
textdomain($newDomain);
} catch(\Exception $ex) {
echo $ex->getMessage();
}
// Update include path
set_include_path(get_include_path() . PATH_SEPARATOR . __DIR__ . '/../src');
$sharedGettext = new Audero\SharedGettext\SharedGettext($translationsPath, $language, $domain);
// Delete old translations for the current language
$sharedGettext->deleteOldTranslations();
} catch(\Exception $ex) {
echo $ex->getMessage();
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.