Skip to content

Releases: projectfluent/fluent.js

@fluent/dedent 0.3.0

02 Jul 16:04
Compare
Choose a tag to compare
  • 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 single index.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

01 Jul 13:52
Compare
Choose a tag to compare
  • Rename FluentArgument to FluentVariable. (#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 single index.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

07 Apr 14:03
Compare
Choose a tag to compare
  • 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 called l10n which must be an instance of a ReactLocalization. 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 the vars 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 the withLocalization HOC.

@fluent/bundle 0.15.1

07 Apr 10:54
Compare
Choose a tag to compare
  • Allow only some formatting options to NUMBER and DATETIME. (#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

31 Mar 11:26
Compare
Choose a tag to compare
  • Migrate @fluent/langneg to TypeScript. (#462)

    There are no functional nor API changes in this release.

@fluent/syntax 0.15.0

02 Mar 13:54
Compare
Choose a tag to compare
@fluent/syntax 0.15.0 Pre-release
Pre-release
  • Migrate @fluent/syntax to TypeScript. (#457)

    • FluentSerializer now relies on instanceof checks rather than
      node.type comparisons. Serializing a JSON dump of an AST is not
      supported any more.

@fluent/sequence 0.5.0

02 Mar 13:25
Compare
Choose a tag to compare
Pre-release
  • Migrate @fluent/sequence to TypeScript. (#450)

    There are no functional nor API changes in this release.

@fluent/dedent 0.2.0

02 Mar 13:26
Compare
Choose a tag to compare
@fluent/dedent 0.2.0 Pre-release
Pre-release
  • Migrate @fluent/dedent to TypeScript. (#451)

    There are no functional nor API changes in this release.

@fluent/react 0.11.1

31 Jan 16:28
Compare
Choose a tag to compare
@fluent/react 0.11.1 Pre-release
Pre-release
  • Don't call createParseMarkup too eagerly. (#453)

    Fix a regression from 0.11.0 in which the default FluentContext value
    was an empty ReactLocalization which would call createParseMarkup to
    create its markup parser. In SSR, it's not desirable to call this
    function as it uses the document global

@fluent/react 0.11.0

23 Jan 14:53
Compare
Choose a tag to compare
@fluent/react 0.11.0 Pre-release
Pre-release
  • 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.