4 Editing Message Catalogs

Creating message catalog files is a snap. You can use skunk.org's SkunkDAV software, which has a built-in message catalog editor. Or you can create an edit these files directly using your favorite text editor.

Message catalogs are just like Python dictionaries. And in message catalog files, the message names and values are expressed exactly as a big Python dictionary. For example, the contents of the simple message catalog my_messages.msg:

{
    'welcome': 'Welcome to Skunk.',
    'unauthorized': 'Go away!'
}

As you can see, the file's contents are a Python dictionary. The keys of the dictionary are the message names (always strings), and the values are the messages themselves (always strings).

Multi-lingual message catalogs are two-level Python dictionaries. The language is the top level, and each language key has a full dictionary of message names and values. Here's the above simple message catalog as a multilingual catalog in the file my_messages.cat:

{
    'eng': {
        'welcome': 'Welcome to Skunk.',
        'unauthorized': 'Go away!'
    },
    'esp': {
        'welcome': 'Bienvenido a Skunk.',
        'unauthorized': 'Que se vaya...'
    }
}

When you edit message catalog files directly, you may type anything that is legal in a Python dictionary literal: any whitespace or indenting you wish, even comments. Please note, however, that editing message catalogs in the SkunkDAV editor results in all of your comments being lost; SkunkDAV reformats the dictionary whenever it saves the message catalog file.