Features
- Handles arbitrary nesting of pluralization and select rules
- Supports all ~466 languages included in the Unicode CLDR
- Works on the server and the client
- Remarkably useful even for single-language use
- Speed & efficiency: Can pre-compile messages to JavaScript code
- Great for speed: message formatting is just string concatenation
- Compatible with other MessageFormat implementations
- Extendable with custom formatting functions
- Very whitespace tolerant
- Supports Unicode, including RTL and mixed LTR/RTL strings
License
You may use this software under the MIT License:
Copyright 2012-2018 Alex Sexton, Eemeli Aro, and Contributors
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Contributor License Agreement
We require all contributions to be covered under the JS Foundation's Contributor License Agreement. This can be done electronically and essentially ensures that you are making it clear that your contributions are your contributions, you have the legal right to contribute and you are transferring the copyright of your works to the JavaScript Foundation.
If you are an unfamiliar contributor to the committer assessing your pull request, it is best to make it clear how you are covered by a CLA in the notes of the pull request. The committer will verify your status.
If your GitHub user id you are submitting your pull request from differs from the e-mail address which you have signed your CLA under, you should specifically note what you have your CLA filed under (and for CCLA that you are listed under your company's authorised contributors).
Authors
- Alex Sexton - @SlexAxton - alexsexton.com
- Eemeli Aro - @eemeli_aro - github.com/eemeli
Credits
Thanks to:
- Vincit - Eemeli's current employer - for letting him do cool stuff like this.
- Bazaarvoice - Alex's previous employer - for letting him do cool stuff like this.
- Google has an implementation that is similar in Google Closure, the code has been vetted against many of their tests.
- Norbert Lindenberg for showing Alex how good it can be.