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

@hmyapps/i18n

v1.1.0

Published

Lightweight i18n for Haaremy apps — reads language from SSO JWT claim

Readme

@hmyapps/i18n

Leichtgewichtige i18n-Lösung für alle Haaremy-Apps. Liest Sprache aus dem SSO-JWT-Claim language (de/en).

Architektur

/opt/hmyI18n/
  locales/
    common/{de,en}.json        # Shared: Buttons, Auth, Footer, Legal
    hmyportal/{de,en}.json     # Portal-spezifisch
    hmysso/{de,en}.json        # SSO-spezifisch
    hmywiki/{de,en}.json       # Wiki-spezifisch
    hmyfiles/{de,en}.json      # Files-spezifisch
    ...
  src/
    index.ts                   # Server/Bun runtime
    browser.ts                 # Browser / statische Apps

Verwendung (Bun/Hono Server)

import { createT, langFromJwt } from "@hmyapps/i18n";

// In Hono Middleware:
app.use("*", async (c, next) => {
  const jwt = c.req.header("Authorization")?.replace("Bearer ", "") || "";
  const lang = langFromJwt(jwt) || "de";
  c.set("t", createT(lang, ["common", "hmywiki"]));
  await next();
});

// In Handler:
const t = c.get("t");
return c.json({ message: t("app.success") });

Verwendung (Browser / statische HTML)

<script type="module">
  import { initI18n, t, langFromJwt } from "/@hmyapps/i18n/browser";
  const lang = langFromJwt(localStorage.getItem("hmy_access_token") || "");
  await initI18n(lang, ["/locales/common/de.json"]);
  document.querySelector("#save-btn").textContent = t("app.save");
</script>

Verwendung (Python/Jinja2 SSO)

# app/i18n.py
import json, functools
from pathlib import Path

LOCALES_DIR = Path("/opt/hmyI18n/locales")

@functools.lru_cache(maxsize=20)
def _load(lang: str, ns: str) -> dict:
    p = LOCALES_DIR / ns / f"{lang}.json"
    try:
        return json.loads(p.read_text())
    except Exception:
        return {}

def make_t(lang: str, namespaces=("common", "hmysso")):
    maps = [_load(lang, ns) for ns in namespaces]
    fallback = [_load("de", ns) for ns in namespaces]
    def t(key: str, **kwargs) -> str:
        for m in maps:
            if key in m:
                return m[key].format(**kwargs)
        for m in fallback:
            if key in m:
                return m[key].format(**kwargs)
        return key
    return t

# In FastAPI:
# lang = getattr(current_user, "language", "de") or "de"
# t = make_t(lang)
# templates.TemplateResponse(..., {"t": t, ...})

JWT-Claim

SSO-JWT enthält language: "de" | "en". Wird bei /me PATCH /preferences gesetzt.

Neue Sprache hinzufügen

  1. JSON-Dateien für neue Sprache erstellen (z.B. fr.json)
  2. SSO language-Validation erweitern: ^(de|en|fr)$
  3. langFromJwt in src/index.ts + src/browser.ts anpassen
  4. Neu bauen + publizieren: cd /opt/hmyI18n && bun run build && npm publish