Skip to content

Releases: projectfluent/fluent.js

fluent-dom 0.2.0 (April 11, 2018)

11 Apr 20:23
Compare
Choose a tag to compare
Pre-release
  • DOM Overlays v2 (#168)

    Major refactor of DOM Overlays allowing developers to provide node elements as arguments. This is breaking change compared to [email protected].

    In 0.1.0 only text-level elements were allowed in translations. Additionally, if a element of the same type was present in the source HTML, its functional attributes were copied to the translated element. This approach allowed translations to use the <a> element and have its href attribute copied from the source. It was limited, however, to text-semantic elements (<img> or <button> were not supported) and to overlaying child elements in the order defined by the source.

    0.2.0 introduces two separate use-cases:

    • Text-level elements. Localizers may want to use some HTML markup to make the translation correct according to the rules of grammar and spelling. For instance, <em> may be used for words borrowed from foreign languages, <sup> may be used for ordinals or abbreviations, etc.

    • Functional elements. Developers may want to pass elements as arguments to the translation and create rich language-agnostic UIs. For instance, they may define an <img> element which should be placed inline inside of the translation. Each language will need to decide where exactly the <img> should go.

    Text-Level Elements

    For the first use-case, fluent-dom will now always allow a safe set of text-level elements such as <em> and <strong>. Their contents will always be converted to pure text (no nesting is allowed) and their attributes will be sanitized using a well-defined list of safe attributes.

    hello = Hello, <em title="It's a wonderful world.">world</em>!
    

    Functional Elements

    For the latter use-case, developers may put child elements inside of the element which is the target of the translation. These child elements must be annotated with the data-l10n-name attribute. fluent-dom will look for corresponding child elements defined by the translation and clone them into the final translated result. The cloning preserves functional attributes defined in the source (href, class, src) but destroys any event listeners attached to the child element. (We may be able to relax this limitation in the future.) Safe attributes found on the matching child element from the translation will be copied to the resulting child.

    <p data-l10n-id="hello-icon">
        <img data-l10n-name="world" src="world.png">
    </p>
    
    hello-icon = Hello, <img data-l10n-name="world">!
    
  • Refactored error reporting (#160)

  • Fixed a minor bug which caused an extraneous retranslation when data-l10n-id was being removed from an element.

fluent-syntax 0.6.6 (March 19, 2018)

19 Mar 17:01
Compare
Choose a tag to compare
Pre-release
  • Function AST nodes have a span now. (#167)

fluent-syntax 0.6.5 (March 8, 2018)

08 Mar 13:31
Compare
Choose a tag to compare
Pre-release
  • Temporarily relax the engines requirement. (#164)

    Include node 6.9.* LTS in the engines requirement to unblock
    mozilla/addons-linter#1789 and thus unblock langpack signing for
    Firefox 60.

    This is a temporary measure until addons-linter phases out the support
    for node 6 which should happen in May 2018.

fluent-syntax 0.6.4 (March 7, 2018)

07 Mar 10:31
Compare
Choose a tag to compare
Pre-release
  • Whitespace-only values are now correctly parsed as null. (#159)
  • Correctly parse Patterns at EOF. (#159)
  • Serialize values with Select Expression on a new line. (#161)

fluent-react 0.6.1 (February 19, 2018)

19 Feb 17:19
Compare
Choose a tag to compare
Pre-release
  • Preserve children of wrapped components if translation value is null. (#154)

    <Localized> now special-cases translations with null values; it
    preserves the original children of the wrapped element and only sets
    translated attributes.

  • Protect void elements from translations which try to set children. (#155)

    A broken translation may have a value where none is expected.
    <Localized> components now protect wrapped void elements from having
    this unexpected value inserted as children.

  • Add a third argument to getString for fallback. (#147)

    The new third argument to the getString function in withLocalized
    wrapped components allows for definition of a fallback message in case
    the message id is not fount in the message context. The fallback message
    may also be used for extraction of source copy.

fluent 0.6.3 (February 9, 2018)

10 Feb 01:48
Compare
Choose a tag to compare
Pre-release
  • Update sinon to 4.2.2

fluent 0.4.3 (February 9, 2018)

09 Feb 13:26
Compare
Choose a tag to compare
Pre-release

This is a 0.4.x API-compatible version of fluent intended to make the migration to Fluent Syntax 0.5 easier. It includes changes to the MessageContext parser backported from fluent 0.6.0 and fluent 0.6.2.

In particular, this version brings support for Fluent Syntax 0.5:

  • Add support for terms.
  • Add support for #, ## and ### comments.
  • Remove support for tags.
  • Add support for = after the identifier in message and term definitions.
  • Forbid newlines in string expressions.
  • Allow trailing comma in call expression argument lists.

The new Syntax 0.5 is supported alongside Syntax 0.4 in order to aid migrating to the new syntax. The parser will correctly parse Syntax 0.4 comments (prefixed with //), sections and message definitions without the = after the identifier. The one exception are tags which are no longer supported. Please use attributes defined on terms instead.

fluent-dom 0.1.0 (February 9, 2018)

09 Feb 21:43
Compare
Choose a tag to compare
Pre-release

This is the first complete test release. The main change is a limitation of DOM Overlays (we're reworking more advanced features of it like element reordering) and performance improvement when working with DOM mutations.

  • Extend formatWithFallback to accept async iterator (#46)
  • Documented all methods
  • Removed DOMLocalization.prototype.translateRoot method
  • Simplified initial version of DOM Overlays (to be extended in 0.2) (#71)
    • Only children of the white-listed types are allowed now. It's not possible
      anymore to put elements of other types in the source HTML to make exceptions.
    • The identity of the source element's children is explicitly not kept
      anymore. This allows us to treat the translation DocumentFragment as the
      reference for iteration over child nodes.
    • The overlay function is also no longer recursive. Any nested HTML
      will be lost and only its textContent will be preserved.
  • Added data-l10n-attrs to allow for whitelisting localizable attributes (#70)
  • Added a guard to prevent registering nested roots (#72)
  • Added a guard to prevent leaking attributes between translations (#73)
  • Added a performance optimization coalescing all translations from mutations
    per animation frame (#113)

fluent 0.6.2 (February 8, 2018)

08 Feb 16:36
Compare
Choose a tag to compare
Pre-release
  • Correctly parse empty comment lines. (#149)
  • Forbid null attribute and variant values. (part of #150)

fluent-syntax 0.6.2 (February 8, 2018)

08 Feb 16:35
Compare
Choose a tag to compare
Pre-release
  • Inline Patterns may start with any character. (#150)

    }, ., * and [ are only special when they appear at the beginning of indented Pattern lines. When a Pattern starts on the same line as id = or [variant key], its first character doesn't carry any special meaning and it may be one of those four ones as well.

    This also fixes a regression from 0.6.0 where a message at the EOF without value nor attributes was incorrectly parsed as a message with an empty Pattern rather than produce a syntax error.

  • Ensure CallExpression's args are always an array, even if empty.