![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
@fluent/sequence
Advanced tools
@fluent/sequence
provides mapping functions from string identifiers to
FluentBundle
instances taken from synchronous or asynchronous sequences.
It's part of Project Fluent.
@fluent/sequence
can be used both on the client-side and the server-side.
You can install it from the npm registry or use it as a standalone script (as
the FluentSequence
global).
npm install @fluent/sequence
An ordered iterable of FluentBundle
instances can represent the current
negotiated fallback chain of languages. This iterable can be used to find the
best existing translation for a given identifier.
@fluent/sequence
provides two mapping functions: mapBundleSync
, and
mapBundleAsync
. They can be used to find the first FluentBundle
in the
given iterable which contains the translation with the given identifier. If
the iterable is ordered according to the result of a language negotiation the
returned FluentBundle
contains the best available translation.
A simple function which formats translations based on the identifier might be implemented as follows:
import { mapBundleSync } from "@fluent/sequence";
function formatString(id, args) {
// contexts is a negotiated iterable of FluentBundle instances.
let ctx = mapBundleSync(contexts, id);
if (ctx === null) {
return id;
}
let msg = ctx.getMessage(id);
return ctx.format(msg, args);
}
When passing a synchronous iterator to mapBundleSync
, wrap it in
CachedSyncIterable
from the cached-iterable
package. When passing an
asynchronous iterator to mapBundleAsync
, wrap it in CachedAsyncIterable
.
This allows multiple calls to mapContext*
without advancing and eventually
depleting the iterator.
The API reference is available at https://projectfluent.org/fluent.js/sequence.
FAQs
Manage ordered sequences of FluentBundles
We found that @fluent/sequence demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 4 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.