Translate WooCommerce AI PHP strings

Create and test a translation of WooCommerce AI’s PHP interface strings using the release’s translation template. React and JavaScript screens use separate translation catalogs; see Check JavaScript strings separately.

Note:

This is a Developer level doc. If you are unfamiliar working with code and resolving potential conflicts, we recommend you work with a Woo Agency Partner for larger projects, or find a WooCommerce developer on Codeable for smaller customizations. We are unable to provide support for customizations under our Support Policy.

Before you start

↑ Back to top

Use a test site and a copy of the WooCommerce AI release ZIP. Version 0.8.0 includes languages/woocommerce-ai.pot in that ZIP. The POT file is generated during packaging, so it is not necessarily present in a source checkout. Use a PO/MO editor or WP-CLI’s i18n commands.

Create the translation

↑ Back to top
  1. Create a translation for your target locale from languages/woocommerce-ai.pot in your PO editor.
  2. Translate the strings and save the PO file using the text domain and locale, for example woocommerce-ai-fr_FR.po.
  3. Preserve format placeholders such as %s and %d. Translate each plural form required by the locale.
  4. Compile the PO file into an MO file with the same base name.
wp i18n make-mo woocommerce-ai-fr_FR.po

Install and verify PHP translations

↑ Back to top
  1. Place woocommerce-ai-fr_FR.mo in wp-content/languages/plugins/ so it is outside the plugin directory.
  2. On your test site, go to Settings > General and select the matching site language. Confirm the testing user’s profile language is appropriate for the admin interface being checked.
  3. Open a PHP-rendered WooCommerce AI surface, such as WooCommerce > Status > AI Logs, and check a translated string from your PO file.
  4. If the string remains untranslated, check the locale, file name, compiled MO file, and whether that exact string is in the active release.

Files kept inside the plugin directory can be replaced by a plugin update. Keep your source PO files and custom translations backed up.

Check JavaScript strings separately

↑ Back to top

WooCommerce AI also renders React settings and Intelligence screens. JavaScript translations use JSON catalogs and must be registered with the script handle by the plugin’s integration. See wp i18n make-json and wp_set_script_translations(). The script must have a registered translation catalog for those strings to load.

Check at least one translated PHP string and one React label, such as Enable AI assistant. If PHP translates while the React label does not, report the script/catalog loading gap with the locale and release version.

Update your translation

↑ Back to top

After changing releases, obtain or regenerate the matching POT template and merge it into your PO file. Review new and changed strings, recompile, and repeat the PHP and JavaScript checks.

wp i18n make-pot . languages/woocommerce-ai.pot --domain=woocommerce-ai
wp i18n update-po languages/woocommerce-ai.pot woocommerce-ai-fr_FR.po

WooCommerce.com language packs

↑ Back to top

WooCommerce AI supports language-pack updates from WooCommerce.com. Check whether a pack is available for your locale. If none is available, use the custom translation steps above.

Use of your personal data
We and our partners process your personal data (such as browsing data, IP Addresses, cookie information, and other unique identifiers) based on your consent and/or our legitimate interest to optimize our website, marketing activities, and your user experience.