2017 © Pedro Peláez
 

wordpress-plugin translations-updater

image

afragen/translations-updater

  • Sunday, July 1, 2018
  • by afragen
  • Repository
  • 2 Watchers
  • 5 Stars
  • 0 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 1 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

Translations Updater

Description

This framework allows for decoupled language pack updates for your WordPress plugins or themes that are hosted on public repositories in GitHub, Bitbucket, GitLab, or Gitea., (*1)

The URI should point to a repository that contains the translations files. Refer to Git Updater Translations as an example. It is created using the Language Pack Maker. The repo must be a public repo., (*2)

Usage

Install via Composer: composer require afragen/translations-updater:^1, (*3)

Prior to release use the following command composer require afragen/translations-updater:dev-<branch> currently dev-master, (*4)

Add require_once __DIR__ . '/vendor/autoload.php'; to the main plugin file or theme's functions.php file., (*5)

A configuration array with the following format is needed. All array elements are required., (*6)

add_action( 'admin_init', function() {
    $config = [
        'git'       => '(github|bitbucket|gitlab|gitea)',
        'type'      => '(plugin|theme)',
        'slug'      => 'my-repo-slug', // Should be lowercase.
        'version'   => 'my-repo-version', // Current version of plugin|theme.
        'languages' => 'https://my-path-to/language-packs',
        'branch'    => 'master', // Default (optional).
    ];

    ( new \Fragen\Translations_Updater\Init() )->run( $config );
} );

If you wish to delete the data stored in the options table associated with this framework you will need to issue the following command., (*7)

( new \Fragen\Translations_Updater\Init() )->delete_cached_data();

EDD Software Licensing Usage

If using this framework with EDD Software Licensing you will need to update to the latest versions of the updaters in the EDD Software Licensing sample code to ensure the appropriate action hooks are present., (*8)

You will need to add two key/value pairs to your setup array similar to the following,, (*9)

'git'       => 'github',
'languages' => 'https://github.com/<USER>/my-language-pack',

You will need to include the following command to your bootstrap file to activate the updater., (*10)

( new \Fragen\Translations_Updater\Init( __NAMESPACE__ ) )->edd_run();

Plugins

You must add two additional key/value pairs to the setup array in your EDD_SL_Plugin_Updater setup. The array will be similar to the following from the edd-sample-plugin.php file., (*11)

    $edd_updater = new EDD_SL_Plugin_Updater( EDD_SAMPLE_STORE_URL, __FILE__, array(
            'version'   => '1.0',                // current version number
            'license'   => $license_key,         // license key (used get_option above to retrieve from DB)
            'item_name' => EDD_SAMPLE_ITEM_NAME, // name of this plugin
            'author'    => 'Pippin Williamson',  // author of this plugin
            'beta'      => false,
            'git'       => 'bitbucket',
            'languages' => 'https://bitbucket.org/afragen/test-language-pack',
        )

Themes

You must add two additional key/value pairs to the setup array in your EDD_Theme_Updater_Admin setup. The array will be similar to the following from the edd-sample-theme/updater/theme-updater.php file., (*12)

$updater = new EDD_Theme_Updater_Admin(

    // Config settings
    $config = array(
        'remote_api_url' => 'https://easydigitaldownloads.com', // Site where EDD is hosted
        'item_name'      => 'Theme Name', // Name of theme
        'theme_slug'     => 'theme-slug', // Theme slug
        'version'        => '1.0.0', // The current version of this theme
        'author'         => 'Easy Digital Downloads', // The author of this theme
        'download_id'    => '', // Optional, used for generating a license renewal link
        'renew_url'      => '', // Optional, allows for a custom license renewal link
        'beta'           => false, // Optional, set to true to opt into beta versions
        'git'            => 'github',
        'languages'      => 'https://github.com/<USER>/my-language-pack',
    ),
    ...

The Versions

01/07 2018

dev-master

9999999-dev

  Sources   Download

MIT

The Requires

 

plugin wordpress translations theme updater

01/07 2018

dev-develop

dev-develop

  Sources   Download

MIT

The Requires

 

plugin wordpress translations theme updater