TranslatePress
New in 3.19.0 (Pro). Two dispatcher tools work with TranslatePress (the free edition is enough):
| Tool | Default | Purpose |
|---|---|---|
translatepress-read | On | The language setup, every string of a page with its context, string search, theme and plugin strings, progress |
translatepress-write | Off | Write and review translations, and add, update, remove or make default the translation language |
Enable the write tool under Tools > Plugins > TranslatePress. Only users with TranslatePress’s own translating capability (administrators, unless the site changes it) can read or write strings.
How TranslatePress translates
Section titled “How TranslatePress translates”TranslatePress translates the page as it is shown, not a copy of it. Every piece of text on a page is a string in its dictionary, and the same text is one string for the whole site: translating a menu item or the footer once translates it on every page.
Translate a page
Section titled “Translate a page”- Read its strings.
get-page-stringswith{post_id, lang: "fr_FR"}renders the page in TranslatePress’s preview and returns every string in page order, with the header, menus and footer, plus the theme and plugin text on it. Drafts work too. - Translate whole sentences. TranslatePress splits a sentence at every link or bold word, so “We build fast websites for small teams.” arrives as four strings. Each carries a
contextwith the whole sentence, so the agent can translate it as one sentence and give each fragment its part. - Write them back.
translate-stringstakes up to 200 translations in one call. Each names the version of the string it read: a string someone else changed in the meantime is a conflict, and nothing is written. One bad entry writes nothing. - Check the page. Open it in the translation language (
/fr/...).
Translations are saved as machine translated so a person can review them in TranslatePress’s visual editor. review-strings marks them reviewed, and reviewed: true saves them reviewed straight away. A reviewed translation is never overwritten unless the call says so.
Theme and plugin text
Section titled “Theme and plugin text”search-strings with gettext: true finds text that themes and plugins print, such as “Add to cart”, and translate-strings with gettext: true translates it. get-progress shows how many strings are untranslated, machine translated and reviewed.
Automatic translation stays off
Section titled “Automatic translation stays off”Reading a page never starts TranslatePress’s automatic translation, even when an engine is switched on: EMCP’s render blocks it for that one request, and TranslatePress’s own settings stay as they are.
Languages
Section titled “Languages”add-language, update-language and set-default-language run TranslatePress’s own settings code. The free edition allows one translation language. Changing the default language and removing a language need confirm: true.
History
Section titled “History”Every write is recorded in History and can be undone there, except removing a language. An undo of string translations puts every string back in one step, and is refused when any of them changed again since.
Not available in the free edition, and so not through these tools: image alt text, URL slugs, SEO titles and descriptions, more than one translation language, and merging a paragraph into one translation block.
