Hollywood allows you to localize your programs by importing text strings from
so-called catalog files which you open using the OpenCatalog() function
or the @CATALOG preprocessor command. For compatibility reasons, these
catalogs can be in the IFF CTLG
format established by Commodore in the early 1990s
but this isn't recommended because IFF CTLG
has no proper Unicode support and will
only work correctly if the system's locale matches the catalog's locale.
Thus, it is recommended to use Hollywood's own catalog format instead. This alternative catalog format is simply a plain text file that contains a list of catalog strings, one per line, in the UTF-8 character encoding. If newline characters occur in a catalog string, you must write them as "\n". Backslashes must be written as "\\". If you need to split a string across multiple lines, append a single backslash at the end of the respective line. Such a single backslash at the end of the line signals Hollywood that the string continues in the next line. If there is no backslash at the end of the line, Hollywood knows that this is the end of the string. Empty lines are ignored completely and can be included for readability reasons.
The text file must be in the UTF-8 character encoding, with or without BOM. Comments can be included by using a semicolon as the very first character in the line. This makes Hollywood ignore the rest of the line. Semicolons at other positions in the line don't have any significance for the parser. If the first character of your string needs to be a semicolon, you need to prefix it with a backslash to tell the parser that this is not a comment.
Here is a simple example of a catalog definition in Hollywood's own catalog format:
; this is a comment This is the first string! ; This is the second string! ; This is the third string\nand it has two lines! ; This is the fourth string \ and it has only one line \ but it is split across four lines \ in the catalog file! ; This is the fifth and last string! |
To get a string from the catalog file, just call GetCatalogString() and pass the index of the string you want to retrieve. For example, to get the fifth string from the catalog file shown above, you'd have to do the following:
Print(GetCatalogString(4, "default string")) |
The string passed in the second argument to GetCatalogString() is the default string and it will be returned only if the requested string index could not be found in the catalog file.