A .NET library for running messageformat.js on the server.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
.nuget
BB.MessageFormat.Tests
BB.MessageFormat
node_modules
.gitignore
BB.MessageFormat.sln
BB.MessageFormat.sln.DotSettings
LICENSE.md
node-server.js
readme.md

readme.md

BB.MessageFormat

A .NET library for running messageformat.js on the server.

Choose a JavaScript engine

This library supports three different js engines:

  1. node.js (requires that you have a node.js server) via MessageFormat.Instance.ConfigureEngine(new NodeJsEngine("my url"));
  2. ClearScript (requires that you can run native binaries) via MessageFormat.Instance.ConfigureEngine(new ClearScriptEngine());
  3. Jurassic via MessageFormat.Instance.ConfigureEngine(new JurassicEngine());

Use the Message struct for convenience

The Message struct will make working with MessageFormat a bit easier, but requires that you supply some additional configuration via MessageFormat.Instance.ConfigureOther(...);

See the tests for example usages of the Message object.

Running on node.js

If you want to run the version that utilizes node.js:

  1. Install node.js
  2. npm install express
  3. npm install messageformat

Start it by running node node-server.js in a command prompt from the project's root directory.

Issues/Requests

Feel free to request features, report any bugs/issues you find, or make a pull request. I might not get to it as soon as you'd like (I have other projects / a job that also require my attention), but I'll do my best to fix/merge what comes in as soon as I can.

Benchmarks

Machine: i7 950 @ 3.07GHz running Windows 8 (node.js running in Windows as well)

  1. node.js (requires a node.js server): ~3,000 string generations/s
  2. ClearScript (requires running native binaries): ~3,000 string generations/s
  3. Jurassic: ~30 string generations/s (ouch!)