Compression
Deletion of objects from a message catalog file is accomplished by marking objects as unreachable and does not require the message catalog file to be entirely rewritten. Furthermore, the structure of NlsMessageCatalog files allocates extra space to objects stored with the file to allow efficient object modification. For these reasons a compression phase is necessary to reclaim space used by unreachable objects and to remove extra space allocated to live objects.
The compressMinimal: method is used to compress a message catalog file. This method accepts a Boolean argument that indicates whether the file should be compressed to its smallest possible size (at the expense of object modification efficiency). If true is passed as a parameter to compressMinimal: then all space used by unreachable objects is reclaimed and extra space allocated to live objects is also removed. If false is passed, all space used by unreachable objects is reclaimed, but extra space allocated to live objects remains.
"Compress the message catalog file 'demo.cat' first leaving extra
space for future growth, then to its minimum size."
| catalog |
catalog := NlsMessageCatalog on: 'demo.cat'.
(catalog compressMinimal: false) ifFalse: [
^self error: 'Compression error: ',catalog currentErrorString].
(catalog compressMinimal: true) ifFalse: [
^self error: 'Compression error: ',catalog currentErrorString].
 
Note:
When compressing message catalog files during the development cycle, it is desirable to use compressMinimal: false option to ensure that updating message catalog files is as efficient as possible. When all modifications have been done, you can use the compressMinimal: true option to minimize the size of the message catalog file.
Last modified date: 01/29/2015