https://github.com/php-gettext/json
Json format for gettext
https://github.com/php-gettext/json
gettext i18n json
Last synced: 12 months ago
JSON representation
Json format for gettext
- Host: GitHub
- URL: https://github.com/php-gettext/json
- Owner: php-gettext
- License: mit
- Created: 2019-11-02T18:30:07.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2021-01-22T18:00:24.000Z (about 5 years ago)
- Last Synced: 2025-03-25T19:38:00.545Z (about 1 year ago)
- Topics: gettext, i18n, json
- Language: PHP
- Size: 9.77 KB
- Stars: 5
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
# Gettext Json format
[![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)
Json loader and generator to use with [gettext/gettext](https://github.com/php-gettext/Gettext)
## Installation
```
composer require gettext/json
```
## Usage example
```php
use Gettext\Loader\PoLoader;
use Gettext\Loader\JsonLoader;
use Gettext\Generator\JsonGenerator;
use Gettext\Translations;
//Load a .po file and export to .json
$translations = (new PoLoader())->loadFile('locales/translations.po');
(new JsonGenerator())->generateFile($translations, 'locales/translations.json');
//You can load the json file with JsonLoader
$loadedTranslations = (new JsonLoader())->loadFile('locales/translations.json');
```
---
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/json.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/Json/workflows/testing/badge.svg
[ico-scrutinizer]: https://img.shields.io/scrutinizer/g/php-gettext/Json.svg?style=flat-square
[ico-downloads]: https://img.shields.io/packagist/dt/gettext/json.svg?style=flat-square
[link-packagist]: https://packagist.org/packages/gettext/json
[link-scrutinizer]: https://scrutinizer-ci.com/g/php-gettext/Json
[link-downloads]: https://packagist.org/packages/gettext/json