Introduction
leptos-fluent is a framework for internationalizing Leptos applications using Fluent. It has all the batteries included to handle language switching, translations management, multiple strategies for activating translations at initialization, different modes of persistent storage, and more.
Alternatives
The unique alternative to leptos-fluent currently is Leptos i18n, which follows a different approach. The main differences are:
leptos-fluent
uses Fluent files and the Fluent syntax for translations, whileleptos_i18n
uses JSON files and a custom syntax.leptos-fluent
defines all the configuration in a macro and an optional languages file, whileleptos_i18n
defines the configuration in a[package.metadata.leptos-i18n]
section in Cargo.toml.leptos-fluent
allows to instantiate multiple internationalization contexts, whileleptos_i18n
only allows one.leptos-fluent
has a lot of strategies for activating the initial language of the user at initialization and updating it when the user changes the language, whileleptos_i18n
only follows the cookie strategy.leptos-fluent
automatically builds language names and directions based on language codes, whileleptos_i18n
don't.leptos-fluent
has multiple side effects for updating the language in the client, whileleptos_i18n
only has the<html lang="...">
attribute and is not configurable.
Project goals
The main goals of leptos-fluent are:
- To provide a simple and easy-to-use API for internationalizing Leptos applications.
- Be the most fully featured internationalization framework in any language.
- Be the most performant internationalization framework available.
Defining the internationalization strategy using a macro allows to generate the less code possible for each possible configuration.
Help and support
You can ask for help and support in the #leptos-fluent
channel of
Leptos Discord server, open a discussion in the GitHub repository or
report bugs by opening an issue.
Contributing
See CONTRIBUTING.md file for more information about how to setup the development environment and contribute to the project.