intl-messageformat-parser
Advanced tools
Comparing version 1.6.8 to 1.7.0
@@ -6,10 +6,12 @@ # Change Log | ||
## [1.6.8](https://github.com/formatjs/formatjs/compare/intl-messageformat-parser@1.6.7...intl-messageformat-parser@1.6.8) (2019-06-18) | ||
# [1.7.0](https://github.com/formatjs/formatjs/compare/intl-messageformat-parser@1.6.8...intl-messageformat-parser@1.7.0) (2019-06-27) | ||
**Note:** Version bump only for package intl-messageformat-parser | ||
### Features | ||
- **intl-utils:** Add intl-utils ([#98](https://github.com/formatjs/formatjs/issues/98)) ([2329c57](https://github.com/formatjs/formatjs/commit/2329c57)) | ||
## [1.6.8](https://github.com/formatjs/formatjs/compare/intl-messageformat-parser@1.6.7...intl-messageformat-parser@1.6.8) (2019-06-18) | ||
**Note:** Version bump only for package intl-messageformat-parser | ||
## [1.6.7](https://github.com/formatjs/formatjs/compare/intl-messageformat-parser@1.6.6...intl-messageformat-parser@1.6.7) (2019-06-18) | ||
@@ -19,6 +21,2 @@ | ||
## [1.6.6](https://github.com/formatjs/formatjs/compare/intl-messageformat-parser@1.6.5...intl-messageformat-parser@1.6.6) (2019-06-12) | ||
@@ -28,6 +26,2 @@ | ||
## [1.6.5](https://github.com/formatjs/formatjs/compare/intl-messageformat-parser@1.6.3...intl-messageformat-parser@1.6.5) (2019-06-03) | ||
@@ -37,6 +31,2 @@ | ||
## [1.6.4](https://github.com/formatjs/formatjs/compare/intl-messageformat-parser@1.6.3...intl-messageformat-parser@1.6.4) (2019-06-03) | ||
@@ -46,6 +36,2 @@ | ||
## [1.6.3](https://github.com/formatjs/formatjs/compare/intl-messageformat-parser@1.6.2...intl-messageformat-parser@1.6.3) (2019-05-28) | ||
@@ -55,6 +41,2 @@ | ||
## [1.6.2](https://github.com/formatjs/formatjs/compare/intl-messageformat-parser@1.6.2...intl-messageformat-parser@1.6.2) (2019-05-28) |
{ | ||
"name": "intl-messageformat-parser", | ||
"version": "1.6.8", | ||
"version": "1.7.0", | ||
"description": "Parses ICU Message strings into an AST via JavaScript.", | ||
@@ -43,3 +43,3 @@ "main": "index.js", | ||
"homepage": "https://github.com/formatjs/formatjs", | ||
"gitHead": "1dc8b1c43fd0704398dffd888d70214558cfb17d" | ||
"gitHead": "8b0baec8eda5002715cf893274fe59782fc2d371" | ||
} |
178
README.md
@@ -1,14 +0,11 @@ | ||
Intl MessageFormat Parser | ||
========================= | ||
# Intl MessageFormat Parser | ||
Parses [ICU Message strings][ICU] into an AST via JavaScript. | ||
Parses [ICU Message strings][icu] into an AST via JavaScript. | ||
[![npm Version][npm-badge]][npm] | ||
## Overview | ||
Overview | ||
-------- | ||
This package implements a parser in JavaScript that parses the industry standard [ICU Message strings][icu] — used for internationalization — into an AST. The produced AST can then be used by a compiler, like [`intl-messageformat`][intl-mf], to produce localized formatted strings for display to users. | ||
This package implements a parser in JavaScript that parses the industry standard [ICU Message strings][ICU] — used for internationalization — into an AST. The produced AST can then be used by a compiler, like [`intl-messageformat`][intl-mf], to produce localized formatted strings for display to users. | ||
This parser is written in [PEG.js][], a parser generator for JavaScript. This parser's implementation was inspired by and derived from Alex Sexton's [messageformat.js][] project. The differences from Alex's implementation are: | ||
@@ -21,6 +18,4 @@ | ||
## Usage | ||
Usage | ||
----- | ||
### Loading in the Browser | ||
@@ -33,3 +28,3 @@ | ||
<script> | ||
IntlMessageFormatParser.parse('...'); | ||
IntlMessageFormatParser.parse('...'); | ||
</script> | ||
@@ -68,96 +63,93 @@ ``` | ||
{ | ||
"type": "messageFormatPattern", | ||
"elements": [ | ||
{ | ||
"type": "messageTextElement", | ||
"value": "On " | ||
}, | ||
{ | ||
"type": "argumentElement", | ||
"id": "takenDate", | ||
"format": { | ||
"type": "dateFormat", | ||
"style": "short" | ||
"type": "messageFormatPattern", | ||
"elements": [ | ||
{ | ||
"type": "messageTextElement", | ||
"value": "On " | ||
}, | ||
{ | ||
"type": "argumentElement", | ||
"id": "takenDate", | ||
"format": { | ||
"type": "dateFormat", | ||
"style": "short" | ||
} | ||
}, | ||
{ | ||
"type": "messageTextElement", | ||
"value": " " | ||
}, | ||
{ | ||
"type": "argumentElement", | ||
"id": "name", | ||
"format": null | ||
}, | ||
{ | ||
"type": "messageTextElement", | ||
"value": " took " | ||
}, | ||
{ | ||
"type": "argumentElement", | ||
"id": "numPhotos", | ||
"format": { | ||
"type": "pluralFormat", | ||
"offset": 0, | ||
"options": [ | ||
{ | ||
"type": "optionalFormatPattern", | ||
"selector": "=0", | ||
"value": { | ||
"type": "messageFormatPattern", | ||
"elements": [ | ||
{ | ||
"type": "messageTextElement", | ||
"value": "no photos." | ||
} | ||
] | ||
} | ||
}, | ||
{ | ||
"type": "messageTextElement", | ||
"value": " " | ||
}, | ||
{ | ||
"type": "argumentElement", | ||
"id": "name", | ||
"format": null | ||
}, | ||
{ | ||
"type": "messageTextElement", | ||
"value": " took " | ||
}, | ||
{ | ||
"type": "argumentElement", | ||
"id": "numPhotos", | ||
"format": { | ||
"type": "pluralFormat", | ||
"offset": 0, | ||
"options": [ | ||
{ | ||
"type": "optionalFormatPattern", | ||
"selector": "=0", | ||
"value": { | ||
"type": "messageFormatPattern", | ||
"elements": [ | ||
{ | ||
"type": "messageTextElement", | ||
"value": "no photos." | ||
} | ||
] | ||
} | ||
}, | ||
{ | ||
"type": "optionalFormatPattern", | ||
"selector": "=1", | ||
"value": { | ||
"type": "messageFormatPattern", | ||
"elements": [ | ||
{ | ||
"type": "messageTextElement", | ||
"value": "one photo." | ||
} | ||
] | ||
} | ||
}, | ||
{ | ||
"type": "optionalFormatPattern", | ||
"selector": "other", | ||
"value": { | ||
"type": "messageFormatPattern", | ||
"elements": [ | ||
{ | ||
"type": "messageTextElement", | ||
"value": "# photos." | ||
} | ||
] | ||
} | ||
} | ||
] | ||
}, | ||
{ | ||
"type": "optionalFormatPattern", | ||
"selector": "=1", | ||
"value": { | ||
"type": "messageFormatPattern", | ||
"elements": [ | ||
{ | ||
"type": "messageTextElement", | ||
"value": "one photo." | ||
} | ||
] | ||
} | ||
} | ||
] | ||
}, | ||
{ | ||
"type": "optionalFormatPattern", | ||
"selector": "other", | ||
"value": { | ||
"type": "messageFormatPattern", | ||
"elements": [ | ||
{ | ||
"type": "messageTextElement", | ||
"value": "# photos." | ||
} | ||
] | ||
} | ||
} | ||
] | ||
} | ||
} | ||
] | ||
} | ||
``` | ||
## License | ||
License | ||
------- | ||
This software is free to use under the Yahoo! Inc. BSD license. | ||
See the [LICENSE file][] for license text and copyright information. | ||
[npm]: https://www.npmjs.org/package/intl-messageformat-parser | ||
[npm-badge]: https://img.shields.io/npm/v/intl-messageformat-parser.svg?style=flat-square | ||
[ICU]: http://userguide.icu-project.org/formatparse/messages | ||
[icu]: http://userguide.icu-project.org/formatparse/messages | ||
[intl-mf]: https://github.com/formatjs/formatjs | ||
[PEG.js]: https://pegjs.org/ | ||
[peg.js]: https://pegjs.org/ | ||
[messageformat.js]: https://github.com/SlexAxton/messageformat.js | ||
[LICENSE file]: https://github.com/formatjs/formatjs/blob/master/LICENSE | ||
[license file]: https://github.com/formatjs/formatjs/blob/master/LICENSE |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
129804
153