PHP code example of 26b / i18n-midoru

1. Go to this page and download the library: Download 26b/i18n-midoru library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

26b / i18n-midoru example snippets


    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();
    

    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();
    

    
    // upload.php

    use TwentySixB\Translations\Translations;
    use TwentySixB\Translations\Input\CLI;

    $translations = new Translations( new CLI() );
    $translations->make_pots();
    $translations->upload();
    

    
    // download.php

    use TwentySixB\Translations\Translations;
    use TwentySixB\Translations\Input\CLI;

    $translations = new Translations( new CLI() );
    $translations->download();
    
bash
    # Make POTs and upload files.
    $ php run upload.php --name="project_name" --ext="mo" --format="gettext"

    # Download translations form the system for two locales.
    $ php run download.php --name="project_name" --ext="mo" --format="jed" --locale="pt_PT" --locale="en"
    

path ?(domain|filename-) locale ?(-js-handle) .ext

path ?(domain|filename-) locale ?(-js-handle) .ext