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

ng-signal-translate

v0.1.4

Published

Angular 22+ I18N library that uses signals and no depencency on zone.js

Readme

ng-signal-translate

Angular 22+ i18n library built on signals — no Zone.js dependency, no NgModule required.

Translation state (active language, loaded dictionaries) lives in Angular signals, so templates and effects re-render automatically whenever they read from it, independent of zone-based change detection.

Install

npm install ng-signal-translate

Setup

Configure the service once, e.g. in app.config.ts via an APP_INITIALIZER or in your root component:

import { TranslateService, httpDictionaryLoader } from 'ng-signal-translate';

const translate = inject(TranslateService);
translate.configure({
  loader: httpDictionaryLoader('/assets/i18n'), // loads /assets/i18n/{lang}.json
  supportedLangs: ['en', 'fr', 'de'],
  fallbackLang: 'en',
});

On configure(), the active language is resolved in this order: a value saved in localStorage (key "language" by default, override with storageKey), then the browser's language, then fallbackLang.

Dictionaries can also be provided in memory instead of over HTTP:

import { staticDictionaryLoader } from 'ng-signal-translate';

translate.configure({
  loader: staticDictionaryLoader({
    en: { header: { title: 'Welcome' } },
    fr: { header: { title: 'Bienvenue' } },
  }),
  supportedLangs: ['en', 'fr'],
  fallbackLang: 'en',
});

Usage

Pipe

<h1>{{ 'header.title' | translate }}</h1>
<p>{{ 'search.results' | translate: { count: results.length } }}</p>

Keys use dot notation to walk nested dictionary objects. Params are interpolated into {{ paramName }} placeholders in the translated string.

Signals

export class MyComponent {
  private readonly translate = inject(TranslateService);
  readonly title = this.translate.t('header.title');
  readonly greeting = this.translate.t('greeting', { name: 'Ada' });
}

t() returns a Signal<string> computed from the active language and loaded dictionaries, falling back to fallbackLang and then the raw key if no translation is found.

Language switcher component

<ngst-language-switcher
  [languages]="[{ code: 'en', label: 'English' }, { code: 'fr', label: 'Français' }]"
/>

Renders a <select> bound to TranslateService's active language; changing it calls setLanguage().

Changing language programmatically

this.translate.setLanguage('fr');

This persists the choice to localStorage and lazily loads the dictionary for that language (and the fallback language, if not already loaded).

Handling dictionary load failures

export class MyComponent {
  private readonly translate = inject(TranslateService);
  readonly loadErrors = this.translate.loadErrors;
}
@if (loadErrors()['fr']) {
  <div class="i18n-error">Couldn't load French translations.</div>
}

loadErrors is a Signal<Record<string, unknown>> keyed by language code, populated when a TranslationLoader rejects and cleared once a later load for that language succeeds. This exists because a failed dictionary fetch has no other visible symptom — the app just silently falls back. By contrast, an individual missing translation key is self-diagnosing: t() renders the raw key string in its place (see below), so there's no separate error channel for that case — you'll see header.title on screen instead of "Header Title" and know immediately what's wrong.

API

  • TranslateService — configure(), setLanguage(), language (signal), t(key, params?), loadErrors (signal)
  • TranslatePipe — standalone translate pipe
  • LanguageSwitcherComponent — standalone ngst-language-switcher component
  • httpDictionaryLoader(baseUrl) / staticDictionaryLoader(dictionaries) — built-in TranslationLoader implementations
  • TranslationLoader — implement your own by providing a load(lang): Promise<Dictionary> method

License

MIT