npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@lingva/docusaurus

v0.1.0

Published

Docusaurus integration adapter for Lingva localization

Downloads

740

Readme

@lingva/docusaurus

Thin Docusaurus-facing adapter over the framework-agnostic Lingva runtime.

pnpm add @lingva/docusaurus
pnpm add -D @lingva/cli

Local build-time text

pnpm lingva init --mode local --no-auth --sdk vanilla

Use generated resources for build-time labels without a filesystem loader. This root-level module assumes welcome.title is a configured key:

import { createLingvaDocusaurusRuntime } from '@lingva/docusaurus';
import runtimeConfig from './.lingva/generated/runtime';
import project from './.lingva/generated/project';

const runtime = createLingvaDocusaurusRuntime({ ...runtimeConfig, project });
export const siteTitle = runtime.tSync('welcome.title');
runtime.destroy();

Import siteTitle into your Docusaurus configuration or a build-time page generator. A value calculated during the build remains static until rebuilt; this does not change Docusaurus routes or its own locale negotiation.

Hosted build-time labels

This function runs in your trusted build process, not browser code. Copy the deployment API URL, project ID, and environment from Consumer application setup, and inject a delivery:read key through the build's secret store:

import { createLingvaDocusaurusRuntime } from '@lingva/docusaurus';

export async function loadSiteTitle(locale: string) {
  const runtime = createLingvaDocusaurusRuntime({
    mode: 'remote',
    projectId: 'docs',
    environment: 'production',
    apiUrl: process.env.LINGVA_PUBLISH_API_URL,
    apiKey: process.env.LINGVA_API_KEY,
    locale,
    fallbackLocale: 'en',
  });
  try {
    await runtime.loadLocale(locale);
    return runtime.tSync('welcome.title');
  } finally {
    runtime.destroy();
  }
}

Await this function in your build integration and serialize only the translated text, never the key or runtime config. Validate locales against the site's configured locale list. A failed load rejects the build integration unless you explicitly choose a local fallback.

Runtime and integration boundaries

createLingvaDocusaurusRuntime(input) wraps createLingvaJsRuntime(input) and the package re-exports that JS factory and its types. It is not a Docusaurus plugin: it does not configure presets, generate locale routes, translate Markdown content automatically, or inject a React provider. Use @lingva/react for reactive page components and Docusaurus's own configuration for routing.

For browser-hosted delivery, await loadLocale before synchronous translation, show loading/errors, and use only a delivery:read key or an authenticated application proxy. Browser keys are inspectable; never ship write/admin keys. setLocale selects a locale but does not fetch it. The thin factory does not inject a Node filesystem loader; use generated resources or @lingva/node when filesystem delivery is required. Long-lived owners must unsubscribe listeners and call destroy() on cleanup. Keep mutable server runtimes request-scoped.

Read the public documentation.