1.0.0 • Published 8 months ago
@nubolab-ffwd/svelte-fluent v1.0.0
Svelte Fluent

svelte-fluent
is a powerful localization library for
Svelte and SvelteKit
that enables you to integrate translations using Mozilla's natural-sounding Fluent syntax easily.
Installation
npm install --save-dev @nubolab-ffwd/svelte-fluent
npm install --save jsdom
Documentation
Documentation can be found at https://nubolab-ffwd.github.io/svelte-fluent/
Example
<script>
import { FluentBundle, FluentResource } from '@fluent/bundle';
import { Localized, initFluentContext, createSvelteFluent } from '@nubolab-ffwd/svelte-fluent';
export let userName = 'Anna';
export let userGender = 'female';
export let photoCount = 3;
const translations = `
# Simple things are simple.
hello-user = Hello, {$userName}!
# Complex things are possible.
shared-photos =
{$userName} {$photoCount ->
[one] added a new photo
*[other] added {$photoCount} new photos
} to {$userGender ->
[male] his stream
[female] her stream
*[other] their stream
}.
`;
const bundle = new FluentBundle('en');
bundle.addResource(new FluentResource(translations));
initFluentContext(() => createSvelteFluent([bundle]));
</script>
<strong><Localized id="hello-user" args={{ userName }} /></strong>
<p>
<Localized id="shared-photos" args={{ userName, userGender, photoCount }} />
</p>
1.0.0
8 months ago
1.0.0-next.1
1 year ago
1.0.0-next.2
10 months ago
0.8.1
10 months ago
0.8.0
1 year ago
0.7.0
2 years ago
0.6.2
2 years ago
0.6.1
2 years ago
0.6.0
2 years ago
0.5.0
2 years ago
0.4.3
3 years ago
0.4.2
4 years ago
0.4.1
4 years ago
0.4.0
4 years ago
0.3.1
4 years ago
0.2.1
5 years ago
0.2.0
5 years ago
0.1.5
5 years ago
0.1.4
5 years ago
0.1.3
5 years ago
0.1.2
5 years ago
0.1.1
5 years ago
0.1.0
5 years ago