Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/php-gettext/js-scanner
Javascript code scanner for gettext
https://github.com/php-gettext/js-scanner
code-scanning gettext i18n translation
Last synced: about 1 month ago
JSON representation
Javascript code scanner for gettext
- Host: GitHub
- URL: https://github.com/php-gettext/js-scanner
- Owner: php-gettext
- License: mit
- Created: 2019-11-01T18:59:26.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2022-02-28T10:29:37.000Z (almost 3 years ago)
- Last Synced: 2024-11-14T15:48:50.004Z (about 2 months ago)
- Topics: code-scanning, gettext, i18n, translation
- Language: PHP
- Size: 18.6 KB
- Stars: 5
- Watchers: 2
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
# JS Scanner
[![Latest Version on Packagist][ico-version]][link-packagist]
[![Software License][ico-license]](LICENSE)
![Build Status][ico-ga]
[![Quality Score][ico-scrutinizer]][link-scrutinizer]
[![Total Downloads][ico-downloads]][link-downloads]Created by Oscar Otero (MIT License)
Javascript code scanner to use with [gettext/gettext](https://github.com/php-gettext/Gettext)
## Installation
```
composer require gettext/js-scanner
```## Usage example
```php
use Gettext\Scanner\JsScanner;
use Gettext\Generator\PoGenerator;
use Gettext\Translations;//Create a new scanner, adding a translation for each domain we want to get:
$jsScanner = new JsScanner(
Translations::create('domain1'),
Translations::create('domain2'),
Translations::create('domain3')
);//Scan files
foreach (glob('*.js') as $file) {
$jsScanner->scanFile($file);
}//Save the translations in .po files
$generator = new PoGenerator();foreach ($jsScanner->getTranslations() as $translations) {
$domain = $translations->getDomain();
$generator->generateFile($translations, "locales/{$domain}.po");
}
```---
Please see [CHANGELOG](CHANGELOG.md) for more information about recent changes and [CONTRIBUTING](CONTRIBUTING.md) for contributing details.
The MIT License (MIT). Please see [LICENSE](LICENSE) for more information.
[ico-version]: https://img.shields.io/packagist/v/gettext/js-scanner.svg?style=flat-square
[ico-license]: https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square
[ico-ga]: https://github.com/php-gettext/PHP-Scanner/workflows/testing/badge.svg
[ico-scrutinizer]: https://img.shields.io/scrutinizer/g/php-gettext/JS-Scanner.svg?style=flat-square
[ico-downloads]: https://img.shields.io/packagist/dt/gettext/js-scanner.svg?style=flat-square[link-packagist]: https://packagist.org/packages/gettext/js-scanner
[link-scrutinizer]: https://scrutinizer-ci.com/g/php-gettext/JS-Scanner
[link-downloads]: https://packagist.org/packages/gettext/js-scanner