2017 © Pedro Peláez
 

library language-pack-maker

Library that helps create git sourced WordPress Language Packs

image

afragen/language-pack-maker

Library that helps create git sourced WordPress Language Packs

  • Saturday, December 9, 2017
  • by afragen
  • Repository
  • 2 Watchers
  • 4 Stars
  • 8 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 7 Versions
  • 0 % Grown

The README.md

Language Pack Maker

Requires PHP 7.0 or higher., (*1)

Uses class Language_Pack_Maker installed via composer into your local translation repository to create a directory of zip archives of translation .mo/.po/.json files and a language-pack.json file containing data to pass to GitHub Updater or Translations Updater library., (*2)

Install the package via composer., (*3)

Run the composer command: composer require afragen/language-pack-maker:dev-master, (*4)

Requirements

This library requires all .po files to be in a /languages directory located in the repository root., (*5)

  • It will copy all .po files from /languages to a temporary directory.
  • It will create .mo files from the .po files.
  • It will create .json translation files for your javascript.
  • It will create zipfiles in a /packages directory in the repository root.
  • It will create a language-pack.json file in the repository root.
  • It will cleanup/remove the temporary directory when finished.

The format of the generated JSON file is as follows., (*6)

[
  {
    "{language}": [
      {
        "type": "{plugin|theme} from GitHub Updater",
        "slug": "{$slug}",
        "language": "en_US",
        "version": "from GitHub Updater",
        "updated": "PO-Revision-Date from .po file header",
        "package": "/packages/github-updater-en_US.zip",
        "autoupdate": "1"
      }
    ]
  }
]

The update transient expects the $transient->translations in the following format., (*7)

$transient->translations( array(
    0 => array(
        'type'       => 'plugin',
        'slug'       => 'akismet',
        'language'   => 'de_CH',
        'version'    => '3.1.11',
        'updated'    => '2016-05-12 18:04:38',
        'package'    => 'https://downloads.wordpress.org/translation/plugin/akismet/3.1.11/de_CH.zip',
        'autoupdate' => 1,

    ),
) );

GitHub Updater or the Translations Updater library will merge the correlative plugin or theme data with the data retrieved from the language-pack.json to add data to the update transient. Language updates will appear in the WordPress dashboard., (*8)

To utilize the Language Pack Creator, you will need to open and run http://localhost/<my-translation-repo>/vendor/autoload.php in localhost. This will create the necessary .mo, .json, zipfiles, and language-pack.json., (*9)

If you have translations in javascript files you should also do the following.

With the following added to your composer.json file, it will run the sequence described above on composer update., (*10)

  "scripts": {
    "post-update-cmd": [
      "php ./vendor/autoload.php"
    ]
  }

The Versions

09/12 2017

dev-master

9999999-dev

Library that helps create git sourced WordPress Language Packs

  Sources   Download

MIT

The Requires

  • php >=5.3

 

09/12 2017

1.5.0

1.5.0.0

Library that helps create git sourced WordPress Language Packs

  Sources   Download

MIT

The Requires

  • php >=5.3

 

02/07 2017

1.4.0

1.4.0.0

Library that helps create git sourced WordPress Language Packs

  Sources   Download

MIT

The Requires

  • php >=5.3

 

25/09 2016

1.3.0

1.3.0.0

Library that helps create git sourced WordPress Language Packs

  Sources   Download

MIT

The Requires

  • php >=5.3

 

19/09 2016

1.2.0

1.2.0.0

Library that helps create git sourced WordPress Language Packs

  Sources   Download

MIT

The Requires

  • php >=5.3

 

19/09 2016

1.1.0

1.1.0.0

Library that helps create git sourced WordPress Language Packs

  Sources   Download

MIT

The Requires

  • php >=5.3

 

15/09 2016

1.0.0

1.0.0.0

Library that helps create git sourced WordPress Language Packs

  Sources   Download

MIT

The Requires

  • php >=5.3