Support for message catalogs, including:
- catalog index
- remote and local catalogs
- message lookup from a catalog
- NLS bundles
- message inserts
- catloggedError class that carries catalog message context information
The catalog manager works with a set of json message catalog files contain message text.
These are indexed in a separate catalog index file which is provided to the catalog manager.
For an example of the catalog file format see:
messages.json
For an example of the catalog index fileformat see:
catalog-index.json
var MessageCatalogManager = require("message-catalog").messageCatalogManager;
var catalogManager = new MessageCatalogManager("/catalog-index.json");
var formattedMessage = catalogManager.getMessage("catalog1", "0001", {}, ["myapp"]);
var CatalogedError = require("message-catalog").catalogedError;
var throw new CatalogedError("0001", "An error occurred", ["myapp"], "catalog1");