Multilingual Fields

WordPress stores all the site content in a database, which, in a simple way, can be seen as a collection of tables, with rows and columns. Each row stores a unit of information with labels attached to each field. For example, the title of the post or page is stored in the column “post_title” of table “posts”. Each cell of a table is referred as a field. Each field stores a specific value like title, content, excerpt, etc.

A field content is retrieved from the database by WordPress framework to be shown in a specific place on a webpage as theme or plugins design it.

In qTranslate-X, one can declare a field to be “multilingual” or “translatable”, which means that such a field now contains multilingual information. To store multilingual information, qTranslate-X uses language tags like [:en], {:en} or <!--:en-->. For example, multilingual field value may look like this:

[:en]English Text[:xx]Other language Text[:]

or like this

{:en}English Text{:xx}Other language Text{:}

or like this

<!--:en-->English Text<!--:--><!--:xx-->Other language Text Text<!--:-->

The latter encoding from the original qTranslate plugin is now considered obsolete, but still works. Two-letter abbreviation ‘xx’ is a language code, which is assigned to each enabled language at the initial qTranslate-X setup time.

Note that a closing tag [:] placed right before the opening tag is redundant, and gets ignored. For example, the following encoding is equivalent to the example above:

[:en]English Text[:][:xx]Other language Text[:]

You may also embed language-neutral text in-between the language-specific content, like this:

<html-language-neutral-text>[:en]English Text[:]<html-language-neutral-text>[:xx]Other language Text[:]<html-language-neutral-text>

Note that ending tags [:] are generally necessary and you should always use them when entering ML values manually.

To see the raw multilingual values encoded with language tags, one may set option “Editor Mode” to value “Editor Raw Mode” on configuration page /wp-admin/options-general.php?page=qtranslate-x#advanced. Some people may find it convenient to edit the multilingual strings in raw mode, while most admins would prefer to use Language Switching Buttons (LSB) to edit multilingual values.

Option “Highlight Style” allows to visualize which fields are multilingual on admin side.

When LSB is in use, then multilingual values are shown one language at a time depending on which LSB button is active, if a field is integrated. If a field is not integrated, then multilingual values may still be entered in raw format using one of ‘:xx’ tags. Depending on how versatile the theme code is written, the raw multilingual value entered in an unintegrated field on admin side may get properly translated at front end, otherwise the front end integration is necessary, which is normally done through the filters available in the theme’s PHP code. Finding a filter to use requires deep enough knowledge of PHP and WordPress design.