PHPackages                             26b/i18n-midoru - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Localization &amp; i18n](/categories/localization)
4. /
5. 26b/i18n-midoru

ActiveLibrary[Localization &amp; i18n](/categories/localization)

26b/i18n-midoru
===============

Handle translation operation with ease (download and upload).

1.1.3(9mo ago)52.7k↓91.4%[14 issues](https://github.com/26B/i18n-midoru/issues)[3 PRs](https://github.com/26B/i18n-midoru/pulls)1MITPHPPHP &gt;=8.2CI failing

Since Dec 20Pushed 8mo ago2 watchersCompare

[ Source](https://github.com/26B/i18n-midoru)[ Packagist](https://packagist.org/packages/26b/i18n-midoru)[ RSS](/packages/26b-i18n-midoru/feed)WikiDiscussions main Synced yesterday

READMEChangelog (10)Dependencies (3)Versions (20)Used By (1)

Translation Helper
==================

[](#translation-helper)

[![Testing](https://github.com/26B/i18n-midoru/actions/workflows/testing.yml/badge.svg)](https://github.com/26B/i18n-midoru/actions/workflows/testing.yml)[![Codacy Badge](https://camo.githubusercontent.com/1ed535eaaa9d719e5b017c562d68cfe19e5c7dfe908341949a107e57a641f6af/68747470733a2f2f6170702e636f646163792e636f6d2f70726f6a6563742f62616467652f47726164652f3034363138343961336131623432656438356662313764616339636237393734)](https://www.codacy.com/gh/26B/i18n-midoru/dashboard?utm_source=github.com&utm_medium=referral&utm_content=26B/i18n-midoru&utm_campaign=Badge_Grade)[![Codacy Badge](https://camo.githubusercontent.com/d35ddc685983e411894f1417e911c421f39df511f315e036e79ad441be842318/68747470733a2f2f6170702e636f646163792e636f6d2f70726f6a6563742f62616467652f436f7665726167652f3034363138343961336131623432656438356662313764616339636237393734)](https://www.codacy.com/gh/26B/i18n-midoru/dashboard?utm_source=github.com&utm_medium=referral&utm_content=26B/i18n-midoru&utm_campaign=Badge_Coverage)

This library has some helper functions/classes for dealing with exporting and importing translations based on a config file. Right now we're only supporting [Localise](https://localise.biz) as the source for translations.

⚠️ This library is in active development so the API may suffer changes.

How to use?
-----------

[](#how-to-use)

There are essentially three interfaces, they only differ on how they ingest the options to the Translations system.

1. Use a JSON file with all the configuration.

    ```
    {
        "project_name": {
            "export": {
                "ext": "mo",
                "format": "gettext"
            }
        }
    }
    ```

    ```
    use TwentySixB\Translations\Translations;
    use TwentySixB\Translations\Input\File;

    // Make POT
    $translations = new Translations( new File( 'path_to_file.json' ) );

    $translations->make_pots();
    $translations->upload();
    ```
2. Use PHP as your interface and have a PHP data structure with the configuration.

    ```
    use TwentySixB\Translations\Translations;
    use TwentySixB\Translations\Input\Dataset;

    // Make POT
    $translations = new Translations(
    new Dataset(
        [
            'project_name' => [
                'export' => [
                    'ext' => 'mo',
                    'format' => 'gettext',
                ]
            ]
        ]
    )
    );

    $translations->make_pots();
    $translations->upload();
    ```
3. Use a custom command and fetch config from the options passed to it.

    Create your two command files in PHP.

    ```
