Types of Messages

In the WordPress administration interface, there are various messages that must be translated. Some of these messages are seen frequently, while others are only seen occasionally. Each of these message types are documented below, along with examples.

Labels

Labels are often used in the context of HTMLHTML HTML is an acronym for Hyper Text Markup Language. It is a markup language that is used in the development of web pages and websites. <label>, <legend>, <a>, or <select> tags. They are short and precise descriptors of the purpose of a UIUI UI is an acronym for User Interface - the layout of the page the user interacts with. Think ‘how are they doing that’ and less about what they are doing. element. These can be very difficult to translate at times, especially if they are single words, and if the word used in English can be interpreted as either a noun or imperative verb. With most labels you will need to do some searching through the code to find the context of its use before coming up with an appropriate translation.

Because so many of the messages are part of the WordPress administration interface, Labels are probably the most frequent type of message to translate.

Top ↑

Examples

“Post” could be interpreted as an imperative verb, but in this context it’s a noun. The noun form of “post” in English can be difficult to translate, and the most appropriate translation has been difficult for some teams to decide upon. Many translations use their language’s equivalent to the English “Article,” as the one below, from the Finnish (Finland) translation does.

msgid "Post"
msgstr "Artikkeli"

Another example of a label is seen here, from the Hindi translation.

#: wp-login.php:79 wp-login.php:233 wp-register.php:166
#: wp-includes/template-functions-general.php:46
msgid "Register"
msgstr "रजिस्टर"

Labels with surrounding dashes, as in the example below (from the Welsh translation), can be eliminated or replaced if they might be confusing to users in your target localeLocale Locale = language version, often a combination of a language code and a region code, for instance es_MX denotes Spanish as it’s used in Mexico. A list of all locales supported by WordPress in https://make.wordpress.org/polyglots/teams/, or if there are different established conventions for your locale.

#: wp-admin/admin-functions.php:357
msgid "- Select -"
msgstr " - Dewis -"

Top ↑

Informational Messages

Informational message are usually composed of full sentences. They convey information or request an action from a user. Since these tend to be longer than labels, they tend to be slightly easier to translate. However, with the longer messages comes more variation in the level of formality (or informality), which is something translators need to be aware of.

Top ↑

Examples

In the example below – from the Bulgarian translation – the information message contains a modified English formulaic expression (“the check/cheque is in the mail”), which contributes to its informality.

#: wp-login.php:146
msgid "Your new password is in the mail."
msgstr "Вашата нова парола е в електронната ви поща."

Error messages tend to be more formal, simply because they’re short and concise, as seen in this example from the Swedish translation.

#: wp-includes/functions.php:1636
msgid "<strong>Error</strong>: Incorrect password."
msgstr "<strong>FEL</strong>: Felaktigt lösenord."

Of course, not all error messages are formal in the WordPress interface. The below example, from the German translation, shows an error message with an informal tone.

#: wp-includes/functions-post.php:467
msgid "Sorry, you can only post a new comment once every 15 seconds. Slow down cowboy."
msgstr "Leider kannst du nur alle 15 Sekunden einen neuen Kommentar eingeben. Immer locker bleiben."

Top ↑

Strings with description

If a stringString A string is a translatable part of the software. A translation consists of a multitude of localized strings. contains a vertical bar |, the part on the right of | is a description. Its purpose is to help you translate the string, placing it in certain context or providing additional information.

Top ↑

Examples

The description in the below case suggests you look at a web page in order to translate the string.

#: wp-includes/locale.php:186
msgid ""
"number_format_decimal_point|$dec_point argument for http://php.net/number_format, default is ."
msgstr ","

Top ↑

Date and Time Locale Settings

Rather than using PHPPHP PHP (recursive acronym for PHP: Hypertext Preprocessor) is a widely-used open source general-purpose scripting language that is especially suited for web development and can be embedded into HTML. http://php.net/manual/en/intro-whatis.php.’s built-in locale switching features, which is not configured properly for very many languages on most hosts, WordPress uses the gettext translation module to accomplish date and time translations and formatting.

WordPress translates all of the following date and time settings.

Top ↑

Month names

#: wp-includes/locale.php:42 wp-includes/locale.php:57
msgid "May"
msgstr "Květen"

(From the Czech translation.)

Top ↑

Month abbreviations

#: wp-includes/locale.php:57
msgid "May_May_abbreviation"
msgstr "Mag"

Note the unusual msgid in the example above. These messages should not be translated literally. The msgid here is a hack that is used because the full name and abbreviation are the same in English and Gettext would erroneously combine the two into one entry. (From the Italian translation.)

Top ↑

Weekday Names

#: wp-includes/locale.php:7
#: wp-includes/locale.php:18
#: wp-includes/locale.php:31
msgid "Tuesday"
msgstr "火曜日"

(From the Japanese translation.)

Top ↑

Weekday Abbreviations

#: wp-includes/locale.php:31
msgid "Tue"
msgstr "Уто"

(From the Serbian translation.)

Top ↑

Weekday Initials

#: wp-includes/locale.php:18
msgid "T_Tuesday_initial"
msgstr "ti"

The weekday initials are for WordPress’s calendar feature, and uses the same hack as the month abbreviations above to get around the fact that in English Tuesday and Thursday share the same first letter. Not all localesLocale Locale = language version, often a combination of a language code and a region code, for instance es_MX denotes Spanish as it’s used in Mexico. A list of all locales supported by WordPress in https://make.wordpress.org/polyglots/teams/ use single-letter abbreviations for all days. In the example above, Norwegian Bokmål uses an extra letter to distinguish tirsdag (Tuesday) and torsdag (Thursday).

Top ↑

Date Formatting Strings

These are PHP date() formatting stringsString A string is a translatable part of the software. A translation consists of a multitude of localized strings., and they allow you to change the formatting of the date and time for your locale.

WordPress uses the translations elsewhere in the localizationLocalization Localization (sometimes shortened to "l10n") is the process of adapting a product or service to a particular language, culture, and desired local "look-and-feel." file for month names, weekday names, etc. This special string is for the selection of which elements to include in the date & time, as well as the order in which they’re presented.

Take this msgid from the theme.pot filePOT file POT files are the template files for PO files. They will have all the translation strings left empty. A POT file is essentially an empty PO file without the translations, with just the original strings.:

#: archive.php:40 search.php:19 single.php:22
msgid "l, F jS, Y"
msgstr ""

In English, this gets formatted as:

Sunday, February 27th, 2005

However, different locales format their dates differently. In Danish, for example, dates are written:

søndag, 27. februar 2005

To accomplish this, the msgid above would be translated to:

#: archive.php:40 search.php:19 single.php:22
msgid "l, F jS, Y"
msgstr "l, j. F Y"

To use another example, one way to format dates in Chinese and Japanese is as follows:

2005年2月27日

This would be accomplished in the translation like this:

#: archive.php:40 search.php:19 single.php:22
msgid "l, F jS, Y"
msgstr "Y年n月j日"

Lastly, if you need to include literal alphabetic characters in your date format, as sometimes occurs in Spanish, you can backslash them:

#: archive.php:40 search.php:19 single.php:22
msgid "l, F jS, Y"
msgstr "l j \d\e F \d\e Y "

This would output:

domingo 27 de febrero de 2005

Top ↑

Translation via WordPress-PHP

To translate a date, e.g. inside your pluginPlugin A plugin is a piece of software containing a group of functions that can be added to a WordPress website. They can extend functionality or add new features to your WordPress websites. WordPress plugins are written in the PHP programming language and integrate seamlessly with WordPress. These can be free in the WordPress.org Plugin Directory https://wordpress.org/plugins/ or can be cost-based plugin from a third-party, use mysql2date() or date_i18n(). Your date will be returned in localized format, based on the timestamp.

Top ↑

Messages With Placeholders

Many messages contain special PHP formatting placeholders, which allow the insertion of untranslatable dynamic content into the message after it is translated. The PHP placeholders come in two different formats:

%s: used when only one placeholder is present.
%1$s, %2$s, %3$s, …:  numbered placeholders, which enable translators to rearrange their order. This allows for more flexibility in the translated string while ensuring the dynamic content will still be inserted in the right places.

Top ↑

Examples

In the example below – from the Spanish translation – the message inserts the username of the user to which an email has been sent.

#: wp-login.php:116
msgid "The e-mail was sent successfully to %s's e-mail address."
msgstr "El e-mail fue enviado satisfactoriamente a la dirección e-mail de %s."

Whereas, the example below – from the Chinese translation – uses numbered placeholders and reverses the order in which the filename and type are used.

#: wp-admin/upload.php:96
#, php-format
msgid "File %1$s of type %2$s is not allowed."
msgstr "类型为%2$s的文件%1$s不允许被上传。"

Top ↑

Stop Words

Stop words are very common words that should be excluded from a search, like ‘a’, ‘the’, and ‘and’. You should not simply translate these individual words into your language. Instead, look for and provide commonly accepted stopwords in your language.

Notes:

  • WordPress coreCore Core is the set of software required to run WordPress. The Core Development Team builds WordPress.’s comparison algorithm for stop words is looking for exact matches, so if your language makes use of diacritic marks, be sure to include all possible variation of a stop word in the list (e.g “pravé” and “právě”).
  • There’s no need to add single letter stop words (if those letters are in the A-Z range).

Top ↑

Example

#: wp-includes/query.php:2031
msgctxt "Comma-separated list of search stopwords in your language"
msgid "about,an,are,as,at,be,by,com,for,from,how,in,is,it,of,on,or,that,the,this,to,was,what,when,where,who,will,with,www"
msgstr "le,la,les,de,des,un,uns,une,unes,et,a,à,il,elle,on,ne,je,tu,nous,vous,ils,elles,son,sa,ses,que,quoi,se,qui,ce,cette,dans,en,du,au,aux,pour,pas,sur,y,ou,où,si,ton,ta,te,mon,ma,tout,toute,tous,toutes,ça,ni,www,com,fr,par,sur,par,dans,mais,vos,votre,vôtre,sans,toi,moi,lui,leur,leurs"

Last updated: