Dictionary Icon Dictionary Files

Dictionaries are files that store the language specific information that your application uses. Each dictionary consists of a language name (for the user), a language ID (a long to uniquely identify the language), and an array of entries. Each entry consists of an entry ID and text. The text can be used as a ANSI C string, so \n will be translated to newline. The dictionary may also contain an author, although this is for use by Blithe Edit, rather than the Blithe API. Everything in the dictionary file is stored as a resource. The format is:

Resource IDResource TypeDescription
0'CSTR'Language name
entry ID'CSTR'Your string
1'LONG'Language ID
2'LONG'Number of bytes of largest string
0'TEXT'Author

Dictionaries and Your Application

When you use Blithe, you will usually want to create your own dictionary files with Blithe Edit. These files are called application dictionaries. Each language that your application supports gets it's own application dictionary. In order to support add-ons, Blithe allows multiple application dictionaries for the same language.

Language IDs

The language IDs are constants that are defined within Blithe. These IDs are based on ISO 639. Each language consists of a 3 character lower case code. For example, if you're creating a dictionary for your application in English, you should use a language ID of eng. If you are creating a dictionary in Swedish, the language ID should be swe, Language IDs are defined in BlitheConst.h and can be found in Blithe Constants. If there is a language that you want to support which does not have a language ID, e-mail me at deacent@home.com. For consistancy sake, please do not pick these language IDs on your own.

Authoring Credit

Dictionaries now have an Author field. This is just plain text where you can store an authoring credit. It is used by Blithe Edit and is not accessible through the Blithe API.

Common Dictionaries

Blithe provides a core set of common dictionary files. These files contain strings that are frequently used throughout the system. They are kept in /boot/home/config/etc/Blithe and are shared by all Blithe-aware applications. There are a couple of advantages in using the common dictionaries.

1.Applications that only use entries in the common dictionaries do not need to provide their own dictionaries.
2.A central set of strings promotes a consistant terminology that end users can associate with certain behaviour.

You do not need to include the contents of these files in your application dictionaries in order to use them. Blithe will automatically look in these files for your string if it is not found in your dictionaries.

Making Your Application "Safe"

There is a disadvantage in keeping your text separate from your application: it makes it easier for the user to inadvertantly break it by removing the files that your application depends on. You can make your application work as a stand-alone by doing a couple of things:

1.Use the static library blithestatic.o in Blithe Installation/Blithe SDK/Static It will allow your application to work without blithe.so being present on the user's system.
2.Create a special dictionary that has a complete list of entries, including any entries from the common dictionaries. Add this dictionary to your project. Blithestatic.o will use the strings built into your application as a last resort.