Don't use anything besides ASCII or UTF-8 in messages

Try to always keep messages marked for translation in the plain 7-bit ASCII or in the UTF-8 character sets. Avoid using any other character sets.

The reason for this is technical. Since the original strings and their translations are stored in the same po files, they need to use a common encoding for gettext to be able to function when accessing the translation of a particular string. Gettext doesn't do any character set conversion itself when accessing a translation. Plain 7-bit ASCII is the only common subset between most encodings, and hence it was traditionally the only choice when writing translatable application strings.

Alternatively, you can as of lately also use UTF-8 in the translatable strings of your application. Since all GNOME translations are supposed to be encoded in UTF-8, this will also solve the need of using a common encoding. Using UTF-8 allows you to use characters like ©, ®, é, ñ, °, € and many others in your application strings when needed. Please note though that there are some things to consider before going the UTF-8 route:

  • Using UTF-8 instead of ASCII in translatable source messages needs intltool versions greater or equal to 0.27 and GNU gettext versions greater or equal to 0.12 to work. In particular, the dependency on a recent GNU gettext can be something that needs consideration if you want to write a portable application.
  • Remember that even though Unicode character sets such as UTF-8 solve the encoding issue and allows use of a seemingly endless set of special characters, the fonts in use do not necessarily always include them. Avoid using exotic special characters unless you are sure the commonly used fonts includes them.
  • If you use UTF-8 in the translatable strings of your application, you need to add the special [encoding: UTF-8] keyword before the list of source files in the file of your application. If this isn't done and there are non-ASCII characters present in the translatable strings, xgettext will exit with a fatal error, and so will the build of your application.

TranslationProject/DevGuidelines/Don't use anything besides ASCII or UTF-8 in messages (last edited 2008-02-03 14:47:14 by localhost)