{"id":21662549,"url":"https://github.com/php-gettext/js-scanner","last_synced_at":"2025-10-09T12:05:57.725Z","repository":{"id":35708194,"uuid":"219045740","full_name":"php-gettext/JS-Scanner","owner":"php-gettext","description":"Javascript code scanner for gettext","archived":false,"fork":false,"pushed_at":"2022-02-28T10:29:37.000Z","size":19,"stargazers_count":5,"open_issues_count":1,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-09T12:05:54.638Z","etag":null,"topics":["code-scanning","gettext","i18n","translation"],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/php-gettext.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-11-01T18:59:26.000Z","updated_at":"2023-11-12T13:11:19.000Z","dependencies_parsed_at":"2022-08-08T10:30:25.508Z","dependency_job_id":null,"html_url":"https://github.com/php-gettext/JS-Scanner","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/php-gettext/JS-Scanner","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/php-gettext%2FJS-Scanner","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/php-gettext%2FJS-Scanner/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/php-gettext%2FJS-Scanner/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/php-gettext%2FJS-Scanner/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/php-gettext","download_url":"https://codeload.github.com/php-gettext/JS-Scanner/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/php-gettext%2FJS-Scanner/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279001442,"owners_count":26083078,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-09T02:00:07.460Z","response_time":59,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["code-scanning","gettext","i18n","translation"],"created_at":"2024-11-25T10:16:55.022Z","updated_at":"2025-10-09T12:05:57.699Z","avatar_url":"https://github.com/php-gettext.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# JS Scanner\n\n[![Latest Version on Packagist][ico-version]][link-packagist]\n[![Software License][ico-license]](LICENSE)\n![Build Status][ico-ga]\n[![Quality Score][ico-scrutinizer]][link-scrutinizer]\n[![Total Downloads][ico-downloads]][link-downloads]\n\nCreated by Oscar Otero \u003chttp://oscarotero.com\u003e \u003coom@oscarotero.com\u003e (MIT License)\n\nJavascript code scanner to use with [gettext/gettext](https://github.com/php-gettext/Gettext)\n\n## Installation\n\n```\ncomposer require gettext/js-scanner\n```\n\n## Usage example\n\n```php\nuse Gettext\\Scanner\\JsScanner;\nuse Gettext\\Generator\\PoGenerator;\nuse Gettext\\Translations;\n\n//Create a new scanner, adding a translation for each domain we want to get:\n$jsScanner = new JsScanner(\n    Translations::create('domain1'),\n    Translations::create('domain2'),\n    Translations::create('domain3')\n);\n\n//Scan files\nforeach (glob('*.js') as $file) {\n    $jsScanner-\u003escanFile($file);\n}\n\n//Save the translations in .po files\n$generator = new PoGenerator();\n\nforeach ($jsScanner-\u003egetTranslations() as $translations) {\n    $domain = $translations-\u003egetDomain();\n    $generator-\u003egenerateFile($translations, \"locales/{$domain}.po\");\n}\n```\n\n---\n\nPlease see [CHANGELOG](CHANGELOG.md) for more information about recent changes and [CONTRIBUTING](CONTRIBUTING.md) for contributing details.\n\nThe MIT License (MIT). Please see [LICENSE](LICENSE) for more information.\n\n[ico-version]: https://img.shields.io/packagist/v/gettext/js-scanner.svg?style=flat-square\n[ico-license]: https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square\n[ico-ga]: https://github.com/php-gettext/PHP-Scanner/workflows/testing/badge.svg\n[ico-scrutinizer]: https://img.shields.io/scrutinizer/g/php-gettext/JS-Scanner.svg?style=flat-square\n[ico-downloads]: https://img.shields.io/packagist/dt/gettext/js-scanner.svg?style=flat-square\n\n[link-packagist]: https://packagist.org/packages/gettext/js-scanner\n[link-scrutinizer]: https://scrutinizer-ci.com/g/php-gettext/JS-Scanner\n[link-downloads]: https://packagist.org/packages/gettext/js-scanner\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphp-gettext%2Fjs-scanner","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fphp-gettext%2Fjs-scanner","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphp-gettext%2Fjs-scanner/lists"}