Menu
Libraries |
Category

svelte-fluent

Overview

Fluent is a localization system designed for natural-sounding translations with grammatical features like gender, plurals, and more. The svelte-fluent package provides Svelte-specific bindings for the Fluent localization system.

Key Features

  • Svelte Integration: Provides Svelte components and stores for easy integration with Fluent
  • Template Syntax: Supports Fluent's powerful template syntax for translations
  • Reactive Updates: Translations update reactively when the locale changes
  • Message Formatting: Handles complex formatting including numbers, dates, and plurals

Target Audience

  • Svelte developers needing advanced localization capabilities
  • Projects requiring natural-sounding translations with grammatical features
  • Applications supporting multiple languages with complex formatting needs

Usage Example

<script>
  import { FluentProvider, Localized } from 'svelte-fluent';
  import { negotiateLanguages } from '@fluent/langneg';
  
  const locales = ['en-US', 'pl'];
  const languages = negotiateLanguages(navigator.languages, locales, { defaultLocale: 'en-US' });
</script>

<FluentProvider languages={languages}>
  <Localized id="hello-world">
    <h1>Hello World!</h1>
  </Localized>
</FluentProvider>

Documentation

For more details, see the Fluent documentation and Svelte-Fluent examples .

fluenti18njavascriptl10nrollupsappersveltesveltejssveltekitviteformattingftlglobalizationinternationalizationlanguagelocalelocalizationtranslation

Comments