|
1 | 1 | # Changelog
|
2 | 2 |
|
3 |
| -## Unreleased |
| 3 | +## fluent 0.6.0 (January 31, 2018) |
4 | 4 |
|
5 |
| - - Remove MessageContext.formatToParts. |
| 5 | + - Implement Fluent Syntax 0.5. |
| 6 | + |
| 7 | + - Add support for terms. |
| 8 | + - Add support for `#`, `##` and `###` comments. |
| 9 | + - Remove support for tags. |
| 10 | + - Add support for `=` after the identifier in message and term |
| 11 | + defintions. |
| 12 | + - Forbid newlines in string expressions. |
| 13 | + - Allow trailing comma in call expression argument lists. |
| 14 | + |
| 15 | + In fluent 0.6.x the new Syntax 0.5 is supported alongside the old Syntax |
| 16 | + 0.4. This should make migrations easier. The parser will correctly parse |
| 17 | + Syntax 0.4 comments (prefixed with `//`), sections and message |
| 18 | + definitions without the `=` after the identifier. The one exception are |
| 19 | + tags which are no longer supported. Please use attributed defined on |
| 20 | + terms instead. |
| 21 | + |
| 22 | + - Add `mapContextAsync`. (#125) |
| 23 | + |
| 24 | + This is the async counterpart to mapContextSync. Given an async iterable |
| 25 | + of `MessageContext` instances and an array of ids (or a single id), it |
| 26 | + maps each identifier to the first `MessageContext` which contains the |
| 27 | + message for it. |
| 28 | + |
| 29 | + An ordered interable of `MessageContext` instances can represent the |
| 30 | + current negotiated fallback chain of languages. This iterable can be used |
| 31 | + to find the best existing translation for a given identifier. |
| 32 | + |
| 33 | + The iterable of `MessageContexts` can now be async, allowing code like |
| 34 | + this: |
| 35 | + |
| 36 | + ```js |
| 37 | + async formatString(id, args) { |
| 38 | + const ctx = await mapContextAsync(contexts, id); |
| 39 | + |
| 40 | + if (ctx === null) { |
| 41 | + return id; |
| 42 | + } |
| 43 | + |
| 44 | + const msg = ctx.getMessage(id); |
| 45 | + return ctx.format(msg, args); |
| 46 | + } |
| 47 | + ``` |
| 48 | + |
| 49 | + The iterable of `MessageContexts` should always be wrapped in |
| 50 | + `CachedIterable` to optimize subsequent calls to `mapContextSync` and |
| 51 | + `mapContextAsync`. |
| 52 | + |
| 53 | + Because `mapContextAsync` uses asynchronous iteration you'll likely need |
| 54 | + the regenerator runtime provided by `babel-polyfill` to run the `compat` |
| 55 | + builds of `fluent`. |
| 56 | +
|
| 57 | + - Expose the `ftl` dedent helper. |
| 58 | +
|
| 59 | + The `ftl` template literal tag can be used to conveniently include FTL |
| 60 | + snippets in other code. It strips the common indentation from the snippet |
| 61 | + allowing it to be indented on the level dictated by the current code |
| 62 | + indentation. |
| 63 | +
|
| 64 | + ```js |
| 65 | + ctx.addMessages(ftl` |
| 66 | + foo = Foo |
| 67 | + bar = Bar |
| 68 | + ); |
| 69 | + ``` |
| 70 | +
|
| 71 | + - Remove `MessageContext.formatToParts`. |
6 | 72 |
|
7 | 73 | It's only use-case was passing React elements as arguments to
|
8 | 74 | translations which is now possible thanks to DOM overlays (#101).
|
9 | 75 |
|
10 |
| - - Rename FluentType.valueOf to FluentType.toString. |
| 76 | + - Rename `FluentType.valueOf` to `FluentType.toString1. |
11 | 77 |
|
12 |
| - Without MessageContext.formatToParts, all use-cases for |
13 |
| - FluentType.valueOf boil down to stringification. |
| 78 | + Without `MessageContext.formatToParts`, all use-cases for |
| 79 | + `FluentType.valueOf` boil down to stringification. |
14 | 80 |
|
15 |
| - - Remove FluentType.isTypeOf. |
| 81 | + - Remove `FluentType.isTypeOf`. |
16 | 82 |
|
17 | 83 | fluent-react's markup overlays (#101) removed the dependency on fluent's
|
18 |
| - FluentType which was hardcoded as an import from fluent/compat. Without |
| 84 | + `FluentType` which was hardcoded as an import from fluent/compat. Without |
19 | 85 | this dependency all imports from fluent are in the hands of developers
|
20 | 86 | again and they can decide to use the ES2015+ or the compat builds as they
|
21 | 87 | wish. As long as they do it consistently, regular instanceof checks will
|
|
0 commit comments