Launch offer
Business website $150 USD Custom plugin $200 USD Ready in 5 days
Get a quote
WordPress Plugin Development

Plugin Localization and Translation

Make plugin strings translatable and load text domains correctly.

Plugin Localization and Translation — a practical guide to WordPress plugin translation with clear examples you can reuse in real projects.

WordPress Plugin Development Series (66/95). Prefer one article? Read the complete WordPress plugin development tutorial.

Short description

Wrap UI strings with translation functions and load `.mo` files on `init`/`plugins_loaded`.

Load text domain

add_action('init', function () {
    load_plugin_textdomain('acme-tools', false, dirname(plugin_basename(__FILE__)) . '/languages');
});
echo esc_html__('Settings saved.', 'acme-tools');

Leave a reply

Your email address will not be published. Required fields are marked *