ShipEasy Docs

WordPress

ShipEasyI18n integration for WordPress — plugin activation, i18n_t() PHP function, Gutenberg block, WooCommerce integration, and wp-config.php constants.

ShipEasyI18n for WordPress is distributed as a drop-in plugin. No composer or npm install needed.

Plugin activation

Download i18n-wordpress.zip from the ShipEasyI18n dashboard, then:

  1. Go to Plugins → Add New → Upload Plugin
  2. Upload i18n-wordpress.zip and activate it
  3. Navigate to Settings → ShipEasyI18n and enter your API key and default profile

Alternatively, define constants in wp-config.php before the plugin loads:

// wp-config.php
define('ShipEasyI18n_KEY', 'i18n_pk_your_key_here');
define('ShipEasyI18n_PROFILE', 'en:prod');
define('ShipEasyI18n_CDN', 'https://cdn.i18n.shipeasy.ai/v1/loader.js');

Script tag

The plugin enqueues the ShipEasyI18n loader automatically when activated. To enqueue it manually in your theme:

// functions.php
add_action('wp_enqueue_scripts', function () {
    wp_enqueue_script(
        'i18n-loader',
        constant('ShipEasyI18n_CDN'),
        [],
        null,
        false
    );
    wp_script_add_data('i18n-loader', 'data-key', constant('ShipEasyI18n_KEY'));
    wp_script_add_data('i18n-loader', 'data-profile', constant('ShipEasyI18n_PROFILE'));
});

i18n_t() PHP function

Use i18n_t() anywhere in PHP templates to render a rewriteable label placeholder:

<?php
// In any theme template file, e.g. header.php
?>
<nav>
  <a href="<?php echo home_url(); ?>"><?php echo i18n_t('nav.home'); ?></a>
  <a href="<?php echo get_permalink(get_option('page_for_posts')); ?>">
    <?php echo i18n_t('nav.blog'); ?>
  </a>
</nav>

<h1><?php echo i18n_t('user.greeting', ['name' => wp_get_current_user()->display_name]); ?></h1>

Gutenberg block

The plugin registers an ShipEasyI18n Label block in the editor. In block.json:

{
  "name": "i18n/label",
  "title": "ShipEasyI18n Label",
  "attributes": {
    "labelKey": { "type": "string", "default": "" }
  }
}

Drag the block into any post or page, type a label key (e.g. cta.hero.title), and the block renders the live label value on the front end.

WooCommerce integration

Override WooCommerce strings by mapping label keys to WooCommerce filter hooks:

// functions.php
add_filter('woocommerce_order_button_text', fn() => i18n_t('checkout.submit'));
add_filter('woocommerce_product_add_to_cart_text', fn() => i18n_t('product.add_to_cart'));
add_filter('woocommerce_checkout_place_order_button_text', fn() => i18n_t('checkout.place_order'));

ShipEasyI18n rewrites happen after page load, so static HTML caching (e.g. WP Super Cache) is fully compatible — cached pages still receive the client-side label rewrite.

For the full implementation spec including package source code and edge cases, see plans/frameworks/wordpress.md in the repository.