You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
useGettext\Scanner\PhpScanner;
useGettext\Generator\PoGenerator;
useGettext\Translations;
//Create a new scanner, adding a translation for each domain we want to get:$phpScanner = newPhpScanner(
Translations::create('domain1'),
Translations::create('domain2'),
Translations::create('domain3')
);
//Set a default domain, so any translations with no domain specified, will be added to that domain$phpScanner->setDefaultDomain('domain1');
//Extract all comments starting with 'i18n:' and 'Translators:'$phpScanner->extractCommentsStartingWith('i18n:', 'Translators:');
//Scan filesforeach (glob('*.php') as$file) {
$phpScanner->scanFile($file);
}
//Save the translations in .po files$generator = newPoGenerator();
foreach ($phpScanner->getTranslations() as$domain => $translations) {
$generator->generateFile($translations, "locales/{$domain}.po");
}
Please see CHANGELOG for more information about recent changes and CONTRIBUTING for contributing details.
The MIT License (MIT). Please see LICENSE for more information.