The msc module implements a message catalog. The catalog is used to translates a message to another message. It can be used for internationalization of messages and for converting messages. Use the [gmo] module for importing gettexts mo-files in a message catalog.
include ffl/msc.fs
\ Example 1 : translation of english to dutch
\ Create the message catalog in the dictionary
msc-create en>nl
\ Add translations to the catalog
s" yes" s" ja" en>nl msc-add
s" no" s" nee" en>nl msc-add
s" tree" s" boom" en>nl msc-add
s" bike" s" fiets" en>nl msc-add
\ Translate messages
s" yes" en>nl msc-translate type cr
s" bike" en>nl msc-translate type cr
s" house" en>nl msc-translate type cr \ if not in the catalog, the orignal message is returned
\ Example 2 : entity references in html
\ Create the message catalog on the heap
msc-new value entity
\ Add the references in the catalog
s" lt" s" <" entity msc-add
s" gt" s" >" entity msc-add
s" amp" s" &" entity msc-add
s" quot" char " pad c! pad 1 entity msc-add
\ Convert the references
s" lt" entity msc-translate type cr
s" quot" entity msc-translate type cr
\ Free the catalog from the heap
entity msc-free