PHPackages                             publishpress/bundled-translations - 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. publishpress/bundled-translations

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

publishpress/bundled-translations
=================================

Forces WordPress plugins to use their bundled translations instead of global translations from wordpress.org.

v1.0.3(2mo ago)081[1 issues](https://github.com/publishpress/library-bundled-translations/issues)GPL-3.0-or-laterPHPPHP &gt;=7.2.5CI failing

Since Apr 17Pushed 2mo agoCompare

[ Source](https://github.com/publishpress/library-bundled-translations)[ Packagist](https://packagist.org/packages/publishpress/bundled-translations)[ Docs](http://publishpress.com/)[ RSS](/packages/publishpress-bundled-translations/feed)WikiDiscussions development Synced 3w ago

READMEChangelog (4)Dependencies (2)Versions (7)Used By (0)

PublishPress Bundled Translations
=================================

[](#publishpress-bundled-translations)

Forces WordPress plugins to use their bundled translations instead of the global translations downloaded from translate.wordpress.org.

How It Works
------------

[](#how-it-works)

This library hooks into WordPress's `load_textdomain_mofile` filter. When WordPress tries to load a `.mo` file from the global `wp-content/languages/plugins/` directory, the filter redirects it to the plugin's own bundled `languages/` directory instead.

Requirements
------------

[](#requirements)

- PHP &gt;= 7.2.5
- WordPress

Installation
------------

[](#installation)

Add the package to your plugin's `lib/composer.json`:

```
{
    "require": {
        "publishpress/bundled-translations": "^1.0"
    }
}
```

Then run:

```
composer update
```

Usage
-----

[](#usage)

In your plugin's main PHP file, include the library and instantiate it:

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

if (file_exists(__DIR__ . '/lib/vendor' . $bundledTranslationsPath)) {
    require_once __DIR__ . '/lib/vendor' . $bundledTranslationsPath;
} elseif (defined('MY_PLUGIN_LIB_VENDOR_PATH') && file_exists(MY_PLUGIN_LIB_VENDOR_PATH . $bundledTranslationsPath)) {
    require_once MY_PLUGIN_LIB_VENDOR_PATH . $bundledTranslationsPath;
}

// 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);
```

Disabling
---------

[](#disabling)

The library can be disabled in two ways:

### Via PHP Constant

[](#via-php-constant)

Add to `wp-config.php` or anywhere before the plugin loads:

```
define('PUBLISHPRESS_BUNDLED_TRANSLATIONS_ENABLED', false);
```

### Via WordPress Filter

[](#via-wordpress-filter)

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

Running tests
-------------

[](#running-tests)

1. **Install dependencies** at the repository root:

    ```
    composer install
    ```
2. **Configure the environment** for WPBrowser’s WPLoader: copy `.env.example` to `.env` and set the variables for your local WordPress test install and database (see the comments in `.env.example`).
3. **Link the dummy plugin to this tree** — integration tests load the library from `tests/Support/Data/DummyPlugin/lib/vendor/`. That install must be a Composer **path symlink** so it tracks your edits under `core/`. From the repo root:

    ```
    composer update-dummy
    ```

    …or:

    ```
    cd tests/Support/Data/DummyPlugin/lib && composer install
    ```
4. **Edit code** — change `core/` for the library; add or extend Codeception/WPBrowser specs under `tests/` (integration Cests live in `tests/Integration/`).
5. **Rebuild test actors** if you change suite modules (e.g. `tests/Integration.suite.yml`):

    ```
    composer codecept build
    ```
6. **Run the suite**:

    ```
    composer test Integration
    ```

    Run one Cest file or method, for example:

    ```
    composer test Integration BundledTranslationsCest
    composer test Integration BundledTranslationsCest:constructorTrimsTrailingSlashFromLanguagesDir
    ```

License
-------

[](#license)

GPL-3.0-or-later

###  Health Score

36

—

LowBetter than 79% of packages

Maintenance86

Actively maintained with recent releases

Popularity12

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity33

Early-stage or recently created project

 Bus Factor1

Top contributor holds 61.5% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~8 days

Total

4

Last Release

72d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/407131?v=4)[Anderson Grüdtner Martins](/maintainers/andergmartins)[@andergmartins](https://github.com/andergmartins)

![](https://www.gravatar.com/avatar/3148a98cea6fac13676561c9cc053c35ca8764b9dd39a8e3791352ce4e34b323?d=identicon)[Deji98](/maintainers/Deji98)

---

Top Contributors

[![andergmartins](https://avatars.githubusercontent.com/u/407131?v=4)](https://github.com/andergmartins "andergmartins (32 commits)")[![Deji98](https://avatars.githubusercontent.com/u/105164114?v=4)](https://github.com/Deji98 "Deji98 (20 commits)")

---

Tags

wordpress plugin

### Embed Badge

![Health badge](/badges/publishpress-bundled-translations/health.svg)

```
[![Health](https://phpackages.com/badges/publishpress-bundled-translations/health.svg)](https://phpackages.com/packages/publishpress-bundled-translations)
```

###  Alternatives

[qtranslate/qtranslate-xt

qTranslate-XT (eXTended): Adds user-friendly multilingual content support, stored in single post.

60136.2k](/packages/qtranslate-qtranslate-xt)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
