New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

solid-i18next

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

solid-i18next

i18next integration for Solid.js with reactive hooks, a Trans component, and built-in Suspense support

latest
Source
npmnpm
Version
0.0.3
Version published
Maintainers
1
Created
Source

solid-i18next

Experimental - This library is still in early development. APIs may change and things might be buggy.

i18next integration for Solid.js with reactive hooks, a <Trans> component, and built-in Suspense support.

Install

npm install solid-i18next i18next

Usage

Setup i18next

import i18next from "i18next";

i18next.init({
  lng: "en",
  fallbackLng: "en",
  resources: {
    en: { translation: { welcome: "Welcome, <bold>{{name}}</bold>!" } },
    de: { translation: { welcome: "Willkommen, <bold>{{name}}</bold>!" } },
  },
});

Translate with hooks

import { useTranslation } from "solid-i18next";

function App() {
  const [t, i18n] = useTranslation();

  return (
    <div>
      <p>{t("welcome", { name: "Alice" })}</p>
      <button onClick={() => i18n().changeLanguage("de")}>Deutsch</button>
    </div>
  );
}

Translate with components

Use <Trans> to embed components inside translations:

import { Trans } from "solid-i18next";

<Trans
  key="welcome"
  replace={{ name: "Alice" }}
  components={{
    bold: ({ children }) => <strong>{children}</strong>,
  }}
/>

Provide a custom i18next instance

import { I18nextProvider } from "solid-i18next";

<I18nextProvider i18n={i18next}>
  <App />
</I18nextProvider>

API

ExportDescription
useTranslation(ns?, options?)Returns [t, i18n, ready]. Loads namespaces reactively and supports Suspense.
TransComponent for translations with embedded JSX via components prop.
I18nextProviderContext provider to supply a custom i18next instance.
useI18nAccess the i18next instance from context.

Contributing

Contributions are welcome! Feel free to open an issue or submit a pull request.

License

MIT

Keywords

solid

FAQs

Package last updated on 06 Mar 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts