Skip to content

bvelica/fluent-web

 
 

Repository files navigation

fluent-web

A web component that uses Fluent for localization.

Interactive example.

Locale en-US Locale pl
example result locale en-US example result locale pl

Basic Usage:

yarn add @wolfadex/fluent-web or npm install @wolfadex@fluent-web

import "@wolfadex/fluent-web"
import { FluentResource, FluentBundle } from "@fluent/bundle";

const resource = new FluentResource(`
hello = Hello, Fluent!
`);
const bundle = new FluentBundle("en-US");
bundles.addResource(resource);

const textEl = document.getElementById("my-text-element");

textEl.bundles = [bundle];

HTML:

<fluent-text id="my-text-element" messageid="hello"></fluent-text>

Result:

Hello, Fluent!

For how to build messages, see the Fluent docs.

Examples:

Docs:

See the Docs for more details.

About

A web component for using projectfluent.org/

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 51.3%
  • Elm 29.2%
  • HTML 16.8%
  • CSS 2.7%