Releases: projectfluent/fluent.js
@fluent/dedent 0.3.0
-
Remove the
compat.js
build and compile everything to ES2018. (#472)TypeScript source code is now compiled to ES2018 files in the
esm/
directory. These files are then bundled into a singleindex.js
UMD file
without any further transpilation.The
compat.js
build (available as@fluent/dedent/compat
) was removed.
Please use your own transpilation pipeline if ES2018 is too recent for
your project.Refer to https://github.com/projectfluent/fluent.js/wiki/Compatibility
for more information
@fluent/bundle 0.16.0
-
Rename
FluentArgument
toFluentVariable
. (#499)FluentVariable
is a TypeScript-only type definition used to describe
value types which can be passed as variables to translations. -
Remove
compat.js
builds and compile everything to ES2018. (#472)TypeScript source code is now compiled to ES2018 files in the
esm/
directory. These files are then bundled into a singleindex.js
UMD file
without any further transpilation.The
compat.js
build (available as@fluent/bundle/compat
) was removed.
Please use your own transpilation pipeline if ES2018 is too recent for
your project.Refer to https://github.com/projectfluent/fluent.js/wiki/Compatibility
for more information.
@fluent/react 0.12.0
-
Migrate to TypeScript. (#458)
The source code of
@fluent/react
has been ported to TypeScript. The rewrite required a number of breaking changes to the public API, which are documented below.
Breaking Changes
-
<LocalizationProvider>
now accepts a single prop calledl10n
which must be an instance of aReactLocalization
. See #461 for the rationale behind this change.// The old API <LocalizationProvider bundles={bundlesIterable}> <App /> </LocalizationProvider>
↑ becomes ↓
// The new API let l10n = new ReactLocalization(bundlesIterable); <LocalizationProvider l10n={l10n}> <App /> </LocalizationProvider>
If you'd like to use a custom markup parser you can pass it as the second argument to the
ReactLocalization
constructor:let l10n = new ReactLocalization(bundlesIterable, parseMarkup);
-
The way variables and elements are passed to
<Localized>
has changed. See #458 for more information.Rather than pass variables as
$
-prefixed props, you must now pass them explicitly as a dictionary to thevars
prop.// The old API <Localized id="hello" $userName="Alice"> {"Hello, {$userName}!"} </Localized>
↑ becomes ↓
// The new API <Localized id="hello" vars={{userName: "Alice"}}> {"Hello, {$userName}!"} </Localized>
Rather than pass elements for the React Overlays logic as regular props, you must now pass them explicitly as a dictionary to the
elems
prop.// The old API <Localized id="privacy-policy" a={<a href="…" />}> {"Read the <a>Privacy Policy</a>."} </Localized>
↑ becomes ↓
// The new API <Localized id="privacy-policy" elems={{a: <a href="…" />}}> {"Read the <a>Privacy Policy</a>."} </Localized>
API Additions
-
The
ReactLocalization
class is now exported and must be initialized manually for passing into<LocalizationProvider>
(see above). -
The
LocalizedProps
interface describes the types of props passed to<Localized>
. -
The
WithLocalizationProps
interface describes the types of extra props passed to components decorated with thewithLocalization
HOC.
@fluent/bundle 0.15.1
-
Allow only some formatting options to
NUMBER
andDATETIME
. (#464)The builtin functions available to translations were liberal in terms of the options they accepted. This could lead to undesired results, e.g. when for the same number value, a translation would specify a different currency than the source language.
The
NUMBER
builtin now only recognizes the following options:unitDisplay currencyDisplay useGrouping minimumIntegerDigits minimumFractionDigits maximumFractionDigits minimumSignificantDigits maximumSignificantDigits
The
DATETIME
builtin now only recognizes the following options:dateStyle timeStyle fractionalSecondDigits dayPeriod hour12 weekday era year month day hour minute second timeZoneName
All other options are ignored.
@fluent/langneg 0.4.0
-
Migrate
@fluent/langneg
to TypeScript. (#462)There are no functional nor API changes in this release.
@fluent/syntax 0.15.0
-
Migrate
@fluent/syntax
to TypeScript. (#457)FluentSerializer
now relies oninstanceof
checks rather than
node.type
comparisons. Serializing a JSON dump of an AST is not
supported any more.
@fluent/sequence 0.5.0
-
Migrate
@fluent/sequence
to TypeScript. (#450)There are no functional nor API changes in this release.
@fluent/dedent 0.2.0
-
Migrate
@fluent/dedent
to TypeScript. (#451)There are no functional nor API changes in this release.
@fluent/react 0.11.1
-
Don't call
createParseMarkup
too eagerly. (#453)Fix a regression from 0.11.0 in which the default
FluentContext
value
was an emptyReactLocalization
which would callcreateParseMarkup
to
create its markup parser. In SSR, it's not desirable to call this
function as it uses thedocument
global
@fluent/react 0.11.0
-
Use the official stable React Context API. (#406)
@fluent/react
used to use the legacy React Context API. Thanks to @Gregoor, we now use the official React Context API instead.@fluent/react
bundle size is now around 15% smaller (1.5 KB minified and gzipped). -
Require React 16.8+.
The switch to the new React Context API requires that we drop support for old versions of React, like 0.14 and 15. Additionally,
@fluent/react
uses hooks under the hood now, which require at least React 16.8. -
Accept
@fluent/bundle
0.15 as peer dependency.