WordPress contents can be translated from the admin panel but also through computer-assisted translation tools (CAT tools), as either CSV or XLIFF files (pages, posts, categories, etc.) or through PO files (text strings contained in themes or plugins).
One of the main problems when it comes to translating a WordPress website through computer-assisted translation tools (TAO) is how to export contents in a friendly format (XLIFF, CSV, etc.) for these tools.
Texts that need to be translated in WordPress can be of two types: contents (pages, posts, categories, etc.) and text strings (contained in themes and plugins).
Translation of WordPress contents can be performed in two different ways:
- From the WordPress dashboard any experienced translator can perform translation from the text editor (posts, pages, slugs, etc.). The problem with this method is that the translator could not use assisted translation tools enabling you to see texts in parallel, the use of glossaries and translation memories, as well as not having to be aware of the different html tags.
- Through assisted translation tools (Trados, Wordfast, OmegaT, MemoQ, Memsource, etc.). It will be necessary to previously export the contents using a format that is friendly for assisted translation tools: CSV or XLIFF.
Exporting contents in CSV format can be done from the WordPress database using phpMyAdmin (web tool to manage MySQL databases), while exporting contents in XLIFF format can be done using WPML plugin.
Translation of text strings can be performed by using POT and PO files that developers put at users’ disposal.
1. Translation of WordPress contents: CSV and XLIFF files
There are two ways to export (or import) WordPress contents: CSV format using phpMyAdmin or XLIFF format using WPML plugin.
1.1. PhpMyAdmin: export and import CSV files
CSV files (comma-separated values) are a type of document that allows you to represent data in tabular form. Assisted translation tools understand these files perfectly even if they contain HTML code.
WordPress uses PHP language as well as a database to store and retrieve information contained in a series of tables, each of which has a different mission.
For the management of MySQL databases, there is an excellent tool called phpMyAdmin that allows you to export and import the content in different formats: CSV, PDF, XML, Word, YAML, SQL, etc.
For any normal WordPress user, it is not necessary to know the structure of the WordPress database, however to export and import content through phpMyAdmin it is essential to understand the functioning and structure of the tables in the WordPress database.
You can find more information about WordPress tables by following this link:
Some examples of contents found in tables are as follows:
- wp_options contains, for example, site title and tagline
- wp_posts contains posts and pages, titles, slugs, excerpts, etc.
- wp_postmeta contains information about SEO title and SEO meta description of each page or post of the plugin WordPress SEO by Yoast
- wp_terms contains names and slugs of categories and tags
In the following screenshot you can see the data in the wp_options table corresponding to the title, content and slug of the page and post created by WordPress when installed for the first time:
Data can be exported using CSV format to Excel from the option “Export” of phpMyAdmin:
The translator will be able to upload the Excel file to their preferred assisted translation tool (I use Memsource) to perform translations using glossaries and translation memories and forgetting when it comes to translate html tags:
After translation, the CSV Excel file must be imported into the appropriate tables of the WordPress database using phpMyAdmin.
Aspects to take into account:
- Before you export content, it is always important to make a database cleaning (a quick way to do this is with WP Optimize plugin)
- It is also very important to make a backup of the database before performing operations
- If you are using a WordPress Multisite installation in several languages, it is advisable to duplicate the entire site, export the contents of the duplicate site and then import translated contents.
- If you are using a translation plugin in a single WordPress installation, you will have to learn about the structure of tables generated by this plugin. In the following article, you will learn about tables generated by WPML: WPML’s tables
- If you only need to translate one post (or a few), a quick and easy solution is to copy the contents (title, slug, content, SEO options) from the WordPress text editor in an Excel file.
- Another option which also allows to export and import contents in CSV format is using a plugin. There are free plugins (for example, WP CSV) and freemium plugins (WP Ultimate CSV Importer Plugin which also has a free version), which allow export and import CSV files.
1.2. WPML: using XLIFF files
The XLIFF format (Localization Interchange File Format) is an XML-based format created to facilitate interoperability between different localization and translation tools. It is the ideal format for assisted translation tools.
However, if you perform a search in the directory of WordPress plugins you will only get 3 results of plugins, but for very specific tasks:
- WPML to MultilingualPress. Plugin that convert posts from an existing WPML multilingual site via XLIFF Export/Import for MultilingualPress (a translation plugin for WordPress Multisite).
- Zanto WP Translation (For Multisites). A translation plugin for WordPress Multisite, which comes with a premium add-on (called Zanto Translation Manager that costs 54 dollars), that allows to export and import XLIFF files.
- Easyling for WordPress. A translation plugin which connects Easyling, an online tool based on a translation proxy that allows extraction of content using XLIFF files.
If you are looking for other payment plugins, the only one that allows exporting and importing XLIFF files is WPML.
Export and import XLIFF files using WPML requires Multilingual CMS version (79 dollars) and the installation of the following add-ons:
- WPML Multilingual CMS, main plugin.
- WPML Translation Management, which allows translation management
- WPML XLIFF, module that lets you send jobs to translators in XLIFF format.
In addition, you will need to add accounts for translators and enable the option to send XLIFF files.
I am not going to go into detail here since the procedure is explained in WPML website in this article: Using desktop CAT tools with WPML.
2. Translation of text strings in themes and plugins: POT, PO and MO files
In the preceding paragraphs, I have explained how you can translate WordPress contents (pages, posts, taxonomies, etc.) through assisted translation tools.
What about texts strings that appear in themes and plugins?
Themes and plugins include text strings that come in PHP files. These text strings may appear in the WordPress admin panel and in the front-end.
WordPress themes and plugins are designed natively in English. Some examples of text strings that usually appear in English:
- “Read more“
- “Leave a comment“
- “Nothing found“
These text strings come in POT or PO files, which can be found in three different locations:
- wp-content/languages: WordPress core language files
- wp-content/themes/theme-name/languages: theme language files
- wp-content/plugins/plugin-name/languages: plugin language files
Translation of these text strings can be performed from within WordPress dashboard using plugins (such as Loco Translate or Codestyling Localization) or by professional translation tools such as Poedit that allows you to easily translate themes and plugins that are ready to be translated (“translation ready“).
More info in this article: How to translate a WordPress theme (or plugin): Poedit
You can find themes and plugins already translated into other languages. Most popular themes and plugins usually come translated into many other languages using collaborative translation platforms such as GlotPress (platform used for translations of WordPress core), Transifex, Crowdin, Webtransleit, Get Localization, Poeditor, etc. You should take into account that in many cases, translations are made by volunteers and not by professional translators.
WordPress contents can be translated using CSV or XLIFF files, when previously exported. However, there is no “button” in WordPress that allows easy export (or import) of all contents in a user-friendly format for CAT tools.
Contents can be exported in CSV format from the WordPress database using phpMyAdmin. Also, it’s easy to export XLIFF files using WPML without having to access the database. Both CSV and XLIFF files can be used in assisted translation tools such as Memsource. Finally, text strings can be translated easily using Poedit and PO files.
Ultimately, the use of CSV, XLIFF and PO files, allows the translator’s work to be much more efficient, productive and, economical.
Have you ever translated a WordPress site using CSV, XLIFF and PO files?