How to translate theme and plugin strings in WordPress
Translate theme and plugin strings with WordPress gettext files: edit a PO file, compile its MO file, and place it where WordPress expects it. For a faster dashboard workflow, use a string translation addon that can scan and translate missing text.
- 01Set the target language
- 02Find the exact source string
- 03Use the manual file route
- 04Install a dashboard translator
- 05Scan and translate the strings
- 06Check the front end
What you need
- Administrator access to WordPress
- The target language enabled in WordPress
- A backup before changing translation files
- The theme or plugin you want to translate
Set the target language
Go to Settings → General and choose the site language you need. WordPress uses that locale when it looks for translations. If the language is already selected, continue to the next step.
Update WordPress translations from Dashboard → Updates first. Themes and plugins hosted in the WordPress directory may already have community translations, so you may not need to create your own files.
Find the exact source string
Copy the text exactly as it appears on the site, including punctuation, capitalisation, and placeholders such as %s. Then identify whether it comes from the theme, a plugin, WordPress core, a widget, an option panel, or JavaScript.
Strings are normally translated through WordPress gettext functions and are identified by a text domain. A string that is hard-coded without a gettext call, or saved in a theme or plugin option, may not appear in a normal string list.
Use the manual file route
For a small number of strings, the manual route is fine. Get the theme or plugin’s .pot template, create or open the matching .po file for your locale in a gettext editor, and enter translations in the msgstr fields. Compile the PO file to an .mo file, because WordPress loads the compiled MO file.
Keep the files in the component’s supported language directory or the WordPress languages directory, using the text domain and locale naming expected by that component. Do not edit the POT file as if it were the live translation, and do not replace files in the main plugin or theme folder without a backup: updates can overwrite them. WordPress uses POT files as templates, PO files as editable translations, and MO files as the compiled files used by the site.
Install a dashboard translator
If you do not want to manage PO and MO files, install and activate a string translation addon alongside the multilingual plugin it requires. A dashboard-based tool is usually the better choice when you need to translate several plugins, theme settings, widgets, menus, or custom strings.
The WPML String Translation Addon fits this route because it provides dashboard-based translation for theme and plugin strings and lets you search by text domain or translation status instead of editing language files manually.
Scan and translate the strings
Open the translation tool’s strings screen and filter by the theme or plugin domain. Search for the exact text, select the target language, enter the translation, and save it. Translate placeholders without changing their names or removing required HTML markup.
If the string is missing, scan the selected theme or plugin. For text stored in settings, widgets, or admin screens, use the separate admin-text scanner and add the selected values to the main string list. Some dashboard tools can also detect strings as they appear on the front end.
Check the front end
View the page in the target language and test the exact screen where the string appears. Clear page, object, CDN, and browser caches if the old text remains, then check that the site language and translation locale match.
If only JavaScript text remains untranslated, enable JavaScript string detection or scan the relevant script files, visit the page where the text appears, translate the registered string, and disable detection afterwards if the tool warns that it affects performance. Also check the text domain, locale, file name, and language-file location before changing code.
Let WPML String Translation Addon do it
Dashboard-based string translation for themes, plugins, widgets, and menus; choose it when .mo-file editing is too technical.
Sources
- developer.wordpress.org /apis/internationalization/localization/?utm_source=openai
- developer.wordpress.org /plugins/internationalization/how-to-internationalize-your-p…
- wpml.org /documentation/translating-your-contents/strings/?utm_source…
- wpml.org /documentation/translating-your-contents/strings/finding-str…
- ptc.wpml.org /documentation/translate-wordpress-themes-and-plugins-with-a…
- wpml.org /documentation/support/language-configuration-files/translat…
- wpml.org /documentation/wpml-core-and-add-on-plugins/string-translati…
Questions
- Can I translate theme and plugin strings without a plugin?
- Yes, if the theme or plugin supports WordPress gettext translations. You need a POT template, an editable PO file, and a compiled MO file in the location and naming format WordPress expects. This is reasonable for a few stable strings, but updates, incorrect locales, and overwritten files make it harder to maintain than a dashboard-based workflow.
- Why does my translated string still show in English?
- The usual causes are a wrong text domain, an incorrect locale or file name, a file in the wrong language directory, a translation that was saved only in PO format, caching, or a string that comes from JavaScript or a plugin option. Check the exact source string and confirm that the compiled MO file is loaded for the site’s active locale.
- Why cannot I find a theme option or widget string?
- Theme options, widget titles, admin labels, and other saved settings may not be registered like ordinary front-end gettext strings. Use the translation tool’s admin-text scanner, select the relevant option values, add them to string translation, and then translate them there. If the value is stored in a complex option array, the theme or plugin may need explicit configuration for it to be translatable.
- Will editing a plugin translation file survive an update?
- Not necessarily. Files inside a plugin or theme can be replaced during an update, removing your edits. Store custom translations in the recommended WordPress language location when the component supports it, keep a copy of your PO file, or use a dashboard translation tool that stores translations separately from the component files. Always test after updates.
- What is the fast way to translate theme and plugin strings?
- The fast way is to use a dashboard-based string translation tool, scan the theme or plugin, search for the visible text, and save the translation without handling PO and MO files. WPML String Translation Addon is suited to this workflow because it covers theme, plugin, widget, menu, and other interface strings from the WordPress dashboard.