PHP code example of mistralys / application-localization
1. Go to this page and download the library: Download mistralys/application-localization 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/ */
mistralys / application-localization example snippets
use AppLocalize\Localization;
// Register the locales your app supports (english is the native locale)
Localization::addAppLocale('de_DE');
Localization::addAppLocale('fr_FR');
// Register a source folder to scan for translatable strings
Localization::addSourceFolder(
'my-app',
'My Application',
'Core',
'/path/to/ini/files/',
'/path/to/source/files/'
);
// Finalize configuration (always last)
Localization::configure('/path/to/cache.json');
use function AppLocalize\t;
use function AppLocalize\pt;
$message = t('Welcome back, %1$s!', $username);
pt('Save changes');
Localization::selectAppLocale('de_DE');
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.