The translate_messages model works in conjunction with the messages model. Recall that the messages model is used to define groups of messages that are primarily used in web forms to convey errors and/or informational messages to the user. Generally, the messages model is used to create these messages in your "default" language. This is the language that will be shown to users when the message is not defined in their preferred language. Typically, during the development phase of your project you will just define these messages in your default language. Once you have established all of the messages you will need, you will engage your translation team to translate the messages into other languages that you want to support. This translation into other languages is facilitated by the translate_messages model.

Consider the following messages that have been created using the messages model and stowed under the name general.

General Messages

To translate these messages you would begin by invoking the translate_messages model.

Next you would use the direct command: import general

This will import the above messages for translation. Here we see the screen after the import command:

After importing messages

Notice that the tool tips (if there were any) are shown on a separate row from the message text.

Also notice that the column heading on the last two columns shows language code. You will over type these column headings with the html language codes for the languages you want to support.

If you only want to support one additional language you can delete the last column. If you want to support more than two additional languages you can insert more columns. Here we show the screen after filling in some French and Spanish translations:

French and Spanish translations

When finished, stow the translations using the same name as the original set of messages you are translating. In our example, we would use the command stow general.

This will generate translations for the messages in the indicated languages.

Skipping Messages

You may not know the proper translation for some of the messages. In such a case you can skip the messages you are unable to translate and come back to them later. In the mean time, users will be shown the untranslated messages in the default (base) language associated with the original message.

Updating Translations

Over a period of time new messages may be introduced within a message category that has already been translated. If so, simply edit the translate_messages specification to show the messages that have already been translated then use the import command again. This will insert new rows for any messages that have been added to the original message list.

Translating Placeholders

Notice that messages can contain placeholders such as :1:, :2:, :3:, etc. that will be populated by the program that sets the message. This is done to help reduce the number of messages that need to be created. For example, rather than having several messages such as:

name is required
email is required
phone number is required

We can just create one message with a placeholder. In this case, it is up to the program that uses the message to translate the substitutions if necessary. This would generally be done using the translation model. The important point to be aware of is that the translated messages need to have the same set of placeholders as the original messages. The order of these placeholders does not need to match the order in the original message but the context (meaning) of each specific placeholder must be consistent across all languages.

Importing system Messages

If the messages you wish to import are defined in the system pseudo site, you will need to prefix the name to be imported with ! as in import !general.

Sample translate_messages spec
Sample translated messages