PHP code example of publishpress / bundled-translations

1. Go to this page and download the library: Download publishpress/bundled-translations 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/ */

    

publishpress / bundled-translations example snippets


// Include the library
$bundledTranslationsPath = '/publishpress/bundled-translations/core/include.php';

if (file_exists(__DIR__ . '/lib/vendor' . $bundledTranslationsPath)) {
    ionsPath;
}

// Initialize bundled translations
add_action('plugins_loaded', function() {
    if (class_exists('PublishPress\BundledTranslations\BundledTranslations')) {
        $bundledTranslations = new PublishPress\BundledTranslations\BundledTranslations(
            'plugin-text-domain',
            __DIR__ . '/languages',
            __FILE__
        );
        $bundledTranslations->init();
    }
}, 10);

define('PUBLISHPRESS_BUNDLED_TRANSLATIONS_ENABLED', false);

add_filter('publishpress_bundled_translations_enabled', '__return_false');

// Disable for a specific domain/plugin
add_filter('publishpress_bundled_translations_enabled', function($enabled, $domain, $pluginFile) {
    if ($domain === 'plugin-text-domain') {
        return false;
    }
    return $enabled;
}, 10, 3);