nl sv ru pl es de fr

Create a script for PlayOnLinux - Chapter 10: Scripts translation

A chapter dedicated to scripts translation, is it that important?

Yes. PlayOnLinux scripts must be translated in all languages so that a maximum of people can use them.

But I do not speak russian!

Don't worry, you won't be doing all the translations, it will be the job of the Launchpad team of translators, that we gratefully thank here for all their work.

But, to make it possible for the Launchpad to translate your script, your script need some arrangements.

All the messages must be written in english!

This is the core requirement for translations to take place (messages being translated from english to the other languages).

Messages reuse

To lessen translators workload, messages should be as much as possible identical among scripts (because if the message has already been translated, it won't need to be translated again for the new script).

Hence, we made a list of the most common messages.

List of messages:

Please select the setup file to run.
Please insert the game media into your disk drive.
Please wait while $TITLE is installed.
$TITLE has been successfully installed.

Quote

Use those whenever you can. If you need some message that is not in this list, go ahead and write it in english. What you must avoid are messages that are not in this list but have the same meaning as one that does.

The eval_gettext command

The command eval_gettext takes an english message as argument, and returns its translation into current user's language (as automatically determined).

Example:

eval_gettext 'Please select the setup file to run.'

Usage:

The problem is, how to simply pass the return value of the eval_gettext function to, say, the POL_SetupWindow_message command? The solution is to evaluate eval_gettext inside arguments.

One can evaluate a function inside an argument? Wow, this is getting complicated!

This is achieve by inserting the function eval_gettext between the symbols: $() meaning that the code between ( and ) is to be executed.

Example:

POL_SetupWindow_message "$(eval_gettext 'Please select the setup file to run.')" "$TITLE"

That may look a bit twisted, but you'll get used to it.

THE END

That is all, the tutorial ends here, you should have enough knowledge to stand on your own feet.

An annex is available in the next chapter, that lists all the variables and all the functions that can be used in PlayOnLinux scripts, because we have seen something like one quarter of existing functions. One of those may come handy in a specific script, so think about having a look to this annex at that time. Note however, that the functions used in this tutorial will be all what you need for most scripts.

If you have any question, do not hesitate to ask it in the forums.

Previous chapter - Next chapter