Catalog File Editor
This browser is used to manipulate catalog files. It allows the user to modify the locales and the messages they contain.
Open an NlsCatalogBrowser
Open a catalog file editor by selecting the Transcript menu item Tools->NLS Tool->Catalog File Editor or by executing NlsCatalogBrowser open.
The browser has eight main areas:
+------------------------------------------------------------+
|Catalog Viewer - <catalog> 1|
+-----------------------+------------------------------------+
|File Edit Catalog Locale Messages Options 2|
+------------------------------------------------------------+
| 3| 4|
|Locales List |Messages List |
| | |
| | |
| +------------------------------------+
+-----------------------+ 6|
|Display Information 5|(x)Resident ( )Indexed [Edit Object]|
+-----------------------+------------------------------------+
|Compatibilities between locale 7|
| or |
|Text of the selected message |
| |
+------------------------------------------------------------+
|Information on the catalog and on the selected message 8|
+------------------------------------------------------------+
These areas contain:
1. The title of the editor shows the catalog file currently being edited.
2. The menubar contains File, Edit, Catalog, Locale, Messages, and Options.
3. A list of the locales for the currently loaded catalog.
4. A list of the messages for the selected locale.
5. Two toggle buttons which allow the user to see the resident messages or the indexed messages for the messages list. The Edit Object push button is explained below.
6. An information pane which indicates what kind of information is displayed in the text widget.
7. A text widget used to display two kinds of information. If no messages are selected, the compatibilities are displayed; if a single message is selected, the contents of the message are displayed.
8. An information pane which gives various details:
• if a single locale is selected and no messages are selected the details are
• the catalog file path,
• the catalog size,
• the number of resident or indexed messages in that locale according to the toggle button selected,
• if a single message is selected the details are
• the number of characters and lines contained in the message.
NOTE:
• If the selected locale does not match the locale currently used in the image and if a single message is selected, the following line is displayed in theinformation pane:
Message may appear wrong - Locale doesn't match image.
• If the selected message is a double byte string and you are working on a platform using single byte strings, the following line is displayed in the information pane:
Double byte string not shown properly on this locale.
Editing a catalog file
To edit a catalog file, select Catalog->Edit Catalog File.... A file prompter will appear. Select the catalog file. When a valid catalog file has been selected, the locales it contains are displayed in the locales list. The compatibilities are also displayed in the text widget.
Operations on Locales
The format for a locale always has the form: language-territory-characterSet (e.g. english-us-ansi-ascii)
Adding a new Locale
A locale can be created in one of the following ways:
Locales->Add...
The user is prompted for the name of the new locale. The created locale will be completely empty (i.e. it will contain no resident or indexed messages).
Select a locale and Locales->Duplicate As...
The user is prompted for the name of the new locale. The created locale will contain a copy of all the resident and indexed messages in the other locale.
Deleting a Locale
Existing locales can be removed from the catalog by selecting the locale(s) to be removed and then selecting Locales->Delete...
WARNING:
A deleted locale cannot be recovered.
Renaming a Locale
An existing locale can be renamed by selecting the locale to rename and then selecting Locales->Rename...The user will be prompted for the name of the new locale.
Importing/Exporting a Locale
A locale can be imported into a catalog with one of the import options of the Locale->Import submenu. A locale can be exported with one of the export options of the Locale->Export submenu.
Adding the contents of a locale to a NLS pool in the image
To add the resident messages of a locale to a pool in the image, select Locale->Add To Pool.... A dialog showing the NLS pools in the image is displayed. Select the pool into which the locale is to be added. All of the resident messages of the locale are copied into the pool.
WARNING:
Existing messages in the pool are updated with the value of the selected locale. No messages are deleted from the pool.
Operation on the message
Adding a new message
A new message can be added to the selected locale in one of the following ways:
Messages->Add...
The user is prompted for the name of the new message. If the resident toggle button is selected, the name of the message is a string, otherwise it is an integer. If a valid name has been entered, the new message is added to the messages list. The user can now edit the contents of the new message in the text widget.
Selecting an existing message and Messages->Duplicate As...
The user is prompted for the name of the new message. If the resident toggle button is selected, the name is a string, otherwise it is an integer. If a valid name is entered, a new message is created and the content of the previously selected message is copied to the new one. The new message is added to the messages list. The user can now edit the contents of the new message in the text widget.
A new message can be added to all of the locales of the catalog at once. Select Messages->Add To All Locales....
The user is prompted for the name of the new message. If the resident toggle button is selected, a string is expected, otherwise an integer is expected.
NOTE:
If the message already exists in a locale, this locale is not modified (i.e. the contents of the message are not altered). If the message does not already exist in a locale, an empty message is created.
Deleting a message
Existing messages can be removed from a locale by selecting the messages to be removed and then selecting Messages->Delete.... If the selected messages are to be removed from all of the locales, select Messages->Delete From All Locales....
WARNING:
A deleted message cannot be recovered.
Finding all messages containing a particular text
The menu item Messages->Find Messages With Text... searches for messages which contain a particular text. The user is prompted for the text to find. If messages containing this text are found, a list showing them is displayed. The user can then pick one of them. The message is then selected in the list of messages.
Checking the Catalog
Facilities have been provided to help the user check the contents of a catalog.
Browsing the references to a particular message
To browse the references to a particular message in the image, select a message and then Messages->Browse References. If the message is referenced in the image, the methods referencing it are displayed in a browser.
Checking for duplicate messages in a locale
Two messages with the same contents can be referenced in the locale by two (or more) different names or indices. To find duplicates, select a locale and then Locales->Check For Duplicate Messages. If duplicates are found, they are printed in the Transcript.
Checking for empty messages in a locale
This option allows the user to check if there are empty messages (i.e. messages with no content) in a locale. Select a locale and then Locales->Check For Empty Messages. If empty messages are found, they are printed in the Transcript.
Checking for unused messages in a locale
Some messages may have been defined in the locale but not used (referenced) by any method of the image. This option allows the user to find the unused message in a locale. Select a locale and then Locales->Check For Unused Messages. If unused messages are found, they are printed in the Transcript.
Checking the arguments of the messages in a locale
Messages often use arguments (i.e. they contained %i where i is an integer); for example: '%1 cannot become the default application.'. This option checks all of the arguments of the messages (if it contains any) of a locale to see if they are valid. A message using arguments is valid if there are no missing arguments. An argument is missing if it is not used and if it is less than the maximum one of the used arguments (e.g. for '%2 %5' the missing arguments are 1, 3 and 4). Select a locale and then Locales->Check Messages Arguments. If messages with invalid arguments are found, they are printed in the Transcript.
Advanced Topics
Adding an object as contents of a message
Instead of a String, an object can be defined as the contents of a message. To set the contents of a message to be an object:
• A class representing the editor of this object has to be defined.
• A selector sent to this class to edit the contents of the message has to be defined.
• To specify the class of the object editor to be used, execute: NlsCatalogBrowser objectEditorClass: <ClassOfTheEditor>.
• To specify the selector of the method to apply to the object editor class, execute: NlsCatalogBrowser objectEditorSelector: <#selectorToBeUsed>. The method defined by the selector must be able to accept two arguments:
• name of the message to edit (String for named, Integer for indexed message).
• the current object contained in the message. The method must return an object or nil (e.g. if the user cancels).
• When the editor class and the selector has been defined, select a message and click on the Edit Object button.
Adding export options to the export submenu
To add options to the export submenu execute NlsCatalogBrowser exportOptions: <a Collection of Arrays>. Each Array represents the information needed to add an export entry to the export submenu and export the selected locale when the menu is selected. Each Array should contain:
• a string denoting the label for the menu item of the export submenu,
• the class used to export,
• a method of the export class to be used to export a locale. This method should be able to receive two parameters:
• an NlsMessageCatalog (the current catalog edited in the browser),
• the selected locale: an Array containing 3 strings: #(language territory characterSet).
When the new export option has been defined, close the browser and reopen it. The new export options are available.
Adding import options to the import submenu
To add options to the import submenu execute: NlsCatalogBrowser importOptions: <a Collection of Arrays>. Each Array represents the information needed to add an import entry to the import submenu and import the selected locale when the menu is selected. Each Array should contain:
• a string denoting the label for the menu item of the import submenu,
• the class used to import,
• a method of the import class to be used to import a locale. This method should be able to receive two parameters:
• an NlsMessageCatalog (the current catalog edited in the browser),
• the selected locale: an Array containing 3 strings: #(language territory characterSet).
When the new import option has been defined, close the browser and reopen it. The new import options are available.