UNPKG

6.33 kBMarkdownView Raw
1# Changelog
2
3## 6.0.0
4
5**Breaking Change**
6`formatChildren` is deprecated, since it can easily be confused by parameters that look like tags. Use the new `formatMessage.rich` function instead.
7
8**New Feature**
9`setup()` can now receive a `types` property with custom placeholder type formatters.
10
11`formatMessage.rich(pattern, args [, locale ])` takes a pattern including simple (no attributes) html-like tags as placeholders.
12```js
13formatMessage.rich('Click <a>here</a>!', {
14 a: ({ children }) => <Link>{children}</Link>
15})
16```
17Self-closing tags can be used for rich elements that have no child content:
18```js
19formatMessage.rich('Please enter values for field marked with <icon/>.', {
20 icon: () => <Icon />
21})
22```
23And if you don't need a function to generate the rich value, you can pass it directly.
24```js
25formatMessage.rich('Please enter values for field marked with <icon/>.', {
26 icon: <Icon />
27})
28```
29Or even use a normal placeholder.
30```js
31formatMessage.rich('Please enter values for field marked with {icon}.', {
32 icon: <Icon />
33})
34```
35
36
37## 5.2.6
38
39Fix IE11 compat by removing template literals.
40Test against Inferno v5.
41
42## 5.2.5
43
44Made formatChildren more lenient in parsing.
45
46## 5.2.3
47
48Support inferno v4.
49
50## 5.2.1
51
52Updated CLDR plural rules.
53
54## 5.2.0
55
56Allow non-numeric tag names in messages for `formatChildren`.
57
58## 5.1.0
59
60Added `namespace` function to create a namespaced formatMessage.
61
62## 5.0.0
63
64* **New Feature**
65 * `setup()` returns the current settings
66 * Added localization helpers to public api
67 * `number (value [, style [, locale ]])`
68 * `date (value [, style [, locale ]])`
69 * `time (value [, style [, locale ]])`
70 * `select (value, options)`
71 * `plural (value [, offset ], options [, locale ])`
72 * `selectordinal (value [, offset ], options [, locale ])`
73 * Allow `missingReplacement` to be a function
74 * Added format-message/react module
75* **Breaking Change**
76 * format-message relies on Intl APIs for date an number formatting, if using in an environment without that API, you will need to use the Intl.js polyfill.
77
78## 4.0.0
79
80* **New Feature**
81 * Added id and description by passing an object instead of a string
82* **Breaking Change**
83 * Reworked cli and moved it to format-message-cli
84 * Removed cache option
85
86## 3.2.0
87
88* **New Feature**
89 * Added `formats` option to `setup()`
90* **Bug Fix**
91 * Default `missingTranslation` to `"warning"`
92* **Documentation**
93 * Add `missingTranslation` and `missingReplacement` to README
94
95## 3.1.0
96
97* **New Feature**
98 * Added `--no-instructions` option to suppress instructions in extract output
99 * Added `--yml` option to output extract result as YAML instead of JSON
100* **Bug Fix**
101 * Made `lint` and `extract` tools work with ES6/7 files
102
103## 3.0.1
104
105* **Bug Fix**
106 * Remove some lingering ES6 breaking ES5 environments
107
108## 3.0.0
109
110* **Internal**
111 * Moved core functionality to new repo for better sharing
112 * Move source to ES5 instead of transpiling ES6 source
113
114## 2.5.1
115
116* **Internal**
117 * Update metadata for new github org
118 * Update dependencies
119
120## 2.5.0
121
122* **New Feature**
123 * Added instructions for translators to extracted json.
124 * Sort keys lexically in extracted json.
125 * Added support for missing translation options in runtime.
126* **Internal**
127 * Updated dependencies.
128
129## 2.4.1
130
131* **Bug Fix**
132 * Babel seems to resolve some source map issues. `¯\_(ツ)_/¯`
133* **Internal**
134 * Use babel instead of recast for parsing and traversing.
135
136## 2.4.0
137
138* **New Feature**
139 * `formatMessage.translate` gets the locale-specific pattern.
140
141## 2.3.0
142
143* **New Feature**
144 * `format-message lint` reports errors when required parameters are missing.
145 * `format-meassge inline` added `--missing-translation` and `--missing-replacement`.
146* **Bug Fix**
147 * Ensure `formatMessage` is in scope inside transpiled function declarations.
148* **Polish**
149 * Lots of code cleanup, split linter and extractor out of inliner.
150 * Convert more cases to inline concat instead of a function call.
151* **Documentation**
152 * Added a logo image.
153 * Reformat long paragraphs to single line.
154 * Add more detail to transpilation results.
155* **Internal**
156 * Made test timeouts more forgiving for slow ci environments.
157
158## 2.2.0
159
160* **Spec Compliancy**
161 * Update to CLDR 27 (adds 'as' and 'ce' locales)
162
163## 2.1.1
164
165* **Bug Fix**
166 * Parse error in source code triggers a helpful message and continues instead of dying.
167
168## 2.1.0
169
170* **New Feature**
171 * Auto detect function name based on `require` and `import`.
172* **Internal**
173 * Update dependencies.
174 * Follow [JS Standard Style](https://github.com/feross/standard).
175 * Make test timeouts more lenient because Karma is slow.
176* **Documentation**
177 * Document auto detecting function name.
178 * Update contributing guide to link to JS Standard Style.
179
180## 2.0.0
181
182* **Breaking Change**
183 * Rename package to `format-message`.
184 * Rename bin to `format-message`.
185 * Rename default function-name to `formatMessage`.
186
187## 1.0.4
188
189* **Bug Fix**
190 * Use caret version for glob since they delete old versions breaking npm install.
191* **Internal**
192 * Updated dependencies.
193
194## 1.0.3
195
196* **Polish**
197 * Reduce duplication in replaced calls.
198 * Reduce probability of collisions when inlining multiple files.
199
200## 1.0.2
201
202* **Internal**
203 * Updated dependencies.
204 * Moved built files from `dist` to `lib`.
205 * Added `index.js` for platforms that don't lookup package.json main.
206
207## 1.0.1
208
209* **Documentation**
210 * Removed dragons.
211
212## 1.0.0
213
214* **New Feature**
215 * Added `message-format lint` cli tool.
216 * Added `message-format extract` cli tool.
217 * Added `message-format inline` cli tool.
218* **Breaking Change**
219 * Removed `message-format-inline` cli tool.
220 * Removed `message-format-scrape` cli tool.
221 * Renamed `formatName` option to `functionName` in `Inliner`.
222* **Bug Fix**
223 * Correctly load target locale plural rules when inlining.
224* **Documentation**
225 * Added CLI documentation.
226* **Internal**
227 * Switch from jasmine to mocha.
228 * Add test for inlined format.
229
230## 0.2.0
231
232* **New Feature**
233 * Added `message-format-scrape` script.
234 * Allow `sourceMapName` option in `inline`.
235
236## 0.1.0
237
238* **New Feature**
239 * Added support for `selectordinal`.
240* **Bug Fix**
241 * Format unsupported rbnf types as `number`.
242* **Internal**
243 * Upgrade from `6to5` to `babel`.
244 * Use `eslint` and `jscs` for style checking.