Skip to content

Repository files navigation

JS Scanner

Latest Version on PackagistSoftware LicenseBuild StatusQuality ScoreTotal Downloads

Created by Oscar Otero http://oscarotero.comoom@oscarotero.com (MIT License)

Javascript code scanner to use with gettext/gettext

Installation

composer require gettext/js-scanner

Usage example

useGettext\Scanner\JsScanner;
useGettext\Generator\PoGenerator;
useGettext\Translations;
//Create a new scanner, adding a translation for each domain we want to get:$jsScanner = newJsScanner(
Translations::create('domain1'),
Translations::create('domain2'),
Translations::create('domain3')
);
//Scan filesforeach (glob('*.js') as$file) {
$jsScanner->scanFile($file);
}
//Save the translations in .po files$generator = newPoGenerator();
foreach ($jsScanner->getTranslations() as$translations) {
$domain = $translations->getDomain();
$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.

About

Javascript code scanner for gettext

Topics

Resources

Contributing

Stars

7 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages