Releases: projectfluent/fluent.js
fluent 0.9.1
-
Forbid messages with
null
values and no attributes. (#299)Fix a parser behavior which caused it to parse messages without values nor attributes as
"message-id": null
. This skewed the return values ofFluentBundle.hasMessage
which would reporttrue
for messages which werenull
. This, in turn, would break code which assumedFluentBundle.getMessage
would always return non-null
values if it was guarded by a call tohasMessage
first.
fluent 0.9.0
This release of fluent
brings support for version 0.7 of the Fluent Syntax spec. The FluentBundle
API remains unchanged. Files written in valid Syntax 0.6 may parse differently in this release. See the compatibility note below.
-
Implement Fluent Syntax 0.7. (#287)
The major new feature of Syntax 0.7 is the relaxation of the indentation requirement for all non-text elements of patterns. It's finally possible to leave the closing brace of select expressions unindented:
emails = { $unread_email_count -> [one] You have one unread email. *[other] You have { $unread_email_count } unread emails. }
Consult the changelog to learn about other changes in Syntax 0.7.
-
Re-write the runtime parser. (#289)
Syntax 0.7 was an opportunity to completely re-write the runtime parser, which was originally created in the pre-0.1 era of Fluent. It's now less than a half of the code size of the old parser and also slightly faster.
The parser takes an optimistic approach to parsing. It focuses on minimizing the number of false negatives at the expense of increasing the risk of false positives. In other words, it aims at parsing valid Fluent messages with a success rate of 100%, but it may also parse a few invalid messages which the reference parser would reject. The parser doesn't perform strict validation of the all productions of the Fluent grammar. It may thus produce entries which wouldn't make sense in the real world. For best results users are advised to validate translations with the
fluent-syntax
parser pre-runtime (e.g. by using Pontoon orcompare-locales
).
Backward-incompatible changes
- Variant keys can now be either numbers (as previously) or identifiers. Variant keys with spaces in them produce syntax errors, e.g.
[New York]
. CR
is not a valid EOL character anymore. Please useLF
orCRLF
.Tab
is not recognized as syntax whitespace. It can only be used in translation content.
fluent-syntax 0.9.0
This release of fluent-syntax
brings support for version 0.7 of the Fluent Syntax spec. The API remains unchanged. Files written in valid Syntax 0.6 may not parse correctly in this release. See the summary of backwards-incompatible changes below.
-
Implement Fluent Syntax 0.7. (#287)
The major new feature of Syntax 0.7 is the relaxation of the indentation requirement for all non-text elements of patterns. It's finally possible to leave the closing brace of select expressions unindented:
emails = { $unread_email_count -> [one] You have one unread email. *[other] You have { $unread_email_count } unread emails. }
Consult the changelog to learn about other changes in Syntax 0.7.
Backward-incompatible changes:
- Variant keys can now be either
NumberLiterals
(as previously) orIdentifiers
. TheVariantName
node class has been removed. Variant keys with spaces in them produce syntax errors, e.g.[New York]
. CR
is not a valid EOL character anymore. Please useLF
orCRLF
.Tab
is not recognized as syntax whitespace. It can only be used in translation content.
fluent 0.8.1
-
Expose
FluentResource
as an export. (#286)FluentResource
is a data structure representing a parsed Fluent document.
It can be used to cache resources which can then be added toFluentBundle
via theaddResource
method. To create aFluentResource
given a string
of Fluent translations, use the staticFluentResource.fromString
method.let resource = FluentResource.fromString(text); bundle.addResource(resource);
The undocumented
_parse
export was also removed in favor of
FluentResource.fromString
.
fluent-react 0.8.1
-
Change the
fluent
peer dependency to 0.8.x.Pin down the version of the
fluent
peer dependency to 0.8.x in case there
are any breaking API changes in its future versions.
fluent-react 0.8.0
-
Rename the
messages
prop tobundles
. (#222)<LocalizationProvider>
now expects an iterable ofFluentBundles
to be
passed as thebundles
prop, rather thanmessages
. -
Allow custom
parseMarkup
functions. (#233)By default,
fluent-react
uses a<template>
element to parse and
sanitize markup in translations. In some scenarios like server-side
rendering (SSR) or apps written in React Native,<template>
is not
available natively. In these situations a custom parseMarkup can be
passed as a prop to<LocalizationProvider>
. It will be used by all
<Localized>
components under it. See the wiki for details. -
Drop support for IE and old evergreen browsers. (#133)
Currently supported are: Firefox 52+, Chrome 55+, Edge 15+, Safari 10.1+,
iOS Safari 10.3+ and node 8.9+. -
Add the
cached-iterable
runtime dependency.CachedSyncIterable
is now available from its own package rather than
from thefluent
package. -
Add the
fluent-sequence
runtime dependency.mapBundleSync
is now available from its own package rather than from
thefluent
package. -
Define
fluent >= 0.8.0
as a peer dependency.
fluent 0.8.0
-
Rename
MessageContext
toFluentBundle
. (#222)The following renames have been made to the public API:
- Rename
MessageContext
toFluentBundle
. - Rename
MessageArgument
toFluentType
. - Rename
MessageNumberArgument
toFluentNumber
. - Rename
MessageDateTimeArgument
toFluentDateTime
.
- Rename
-
Move
mapContext*
functions tofluent-sequence
. (#273)The
mapContextSync
andmapContextAsync
functions previously exported
by thefluent
package have been moved to the newfluent-sequence
package.fluent-sequence
0.1.0 corresponds to the exact
implementation of these functions fromfluent
0.7.0.In later versions of
fluent-sequence
, these functions are called
mapBundleSync
andmapBundleAsync
, which is consistent with the naming
used influent
0.8.0.
fluent-sequence 0.2.0
fluent-sequence 0.1.0 (August 17, 2018)
The initial release based on fluent 0.7.0.
fluent-dom 0.4.0 (August 8, 2018)
-
Drop support for IE and old evergreen browsers. (#133)
Currently supported are: Firefox 52+, Chrome 55+, Edge 15+, Safari 10.1+,
iOS Safari 10.3+ and node 8.9+. -
Add the
cached-iterable
runtime dependency.CachedAsyncIterable
is now available from its own package rather than
from thefluent
package. -
Modify the constructor to not require
window
element to be passed.