Svelte I18next screenshot

Svelte I18next

Author Avatar Theme by Nishugoel
Updated: 15 Oct 2023
51 Stars

Internationalization for svelte framework. Based on i18next ecosystem

Overview

The svelte-i18next library is a Svelte wrapper for the i18next internationalization library. It provides a convenient way to observe i18next events using Svelte Stores, allowing Svelte components to re-render when the language is changed or a new resource is loaded.

Features

  • Svelte wrapper for i18next
  • Observes i18next events
  • Allows for re-rendering Svelte components when language or resources change

Installation

To use svelte-i18next, follow these steps:

  1. Install the library via npm:
npm install svelte-i18next
  1. Import the library into your Svelte component:
import { initI18n, setI18n } from 'svelte-i18next';
  1. Initialize i18next using the initI18n function:
initI18n();
  1. Set the i18next instance for the Svelte component:
setI18n(i18n);

Summary

The svelte-i18next library is a useful tool for integrating i18next internationalization with Svelte applications. With its Svelte Store integration, it makes it easy to observe i18next events and ensure that Svelte components re-render when necessary. It provides a simple installation process and can be quickly integrated into your Svelte projects.