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

@flusys/ng-localization

v9.5.0

Published

Localization module for multi-language support in FLUSYS Angular apps

Readme

@flusys/ng-localization

Database-driven i18n for FLUSYS Angular apps — translations loaded from the backend at startup, signal-reactive TranslatePipe, RTL/LTR auto-switching, and a built-in language selector for the topbar.

npm version License: MIT


Installation

npm install @flusys/ng-localization

1. Register Providers

Call provideLocalization() once in app.config.ts. It registers ``(consumed byTranslatePipefromng-shared), an APP_INITIALIZER that loads translations before the first render, and optionally the topbar language selector.

// app.config.ts
import { provideLocalization } from "@flusys/ng-localization";

export const appConfig: ApplicationConfig = {
  providers: [
    provideLocalization({
      defaultLanguageCode: "en", // required — fallback when no saved preference
      loadStrategy: "modules", // optional — 'modules' (default) or 'all'
      initialModules: [], // optional — modules to pre-load at startup
      enableLayoutSelector: true, // optional — renders language picker in AppTopbar
    }),
  ],
};

loadStrategy: 'modules' defers loading until a route resolver requests a module. Use 'all' only for small translation sets.

2. Use TranslatePipe in Templates

Import TranslatePipe from @flusys/ng-shared (not from this package). The pipe is signal-reactive and re-renders automatically on language change. language

import { TranslatePipe } from "@flusys/ng-shared";

@Component({
  imports: [TranslatePipe],
  template: `
    <h1>{{ "dashboard.title" | translate }}</h1>
    <button>{{ "shared.save" | translate }}</button>
    <input [placeholder]="'form.search.placeholder' | translate" />

    <!-- With interpolation -->
    <p>{{ "pagination.showing" | translate: { from: 1, to: 10, total: 100 } }}</p>
  `,
})
export class DashboardComponent {}

Translation values stored in the database use {{variableName}} syntax:

Key:   pagination.showing
Value: Showing {{from}}-{{to}} of {{total}} results

3. Load Translations Per Route (Module Strategy)

Use resolveTranslationModule() in your route definition so translations for a feature load before the page renders. Pass fallbackMessages so the UI works even without a backend.

// Inside a feature's routes file
import { resolveTranslationModule } from "@flusys/ng-shared";
import { MY_FEATURE_MESSAGES } from "./constants/messages";

export const MY_ROUTES: Routes = [
  {
    path: "",
    resolve: {
      translations: resolveTranslationModule({
        modules: ["myFeature"], // module name used by the backend
        fallbackMessages: MY_FEATURE_MESSAGES, // static fallback map
      }),
    },
    loadComponent: () => import("./my-feature-container.component").then((m) => m.MyFeatureContainerComponent),
    children: [
      /* ... */
    ],
  },
];

Already-loaded modules are cached — navigating back to the same route does not re-fetch.

4. Translate Imperatively in Services / Components

Inject TranslateService when you need a string outside a template (e.g., toast messages, computed labels).

import { inject } from "@angular/core";
import { TranslateService } from "@flusys/ng-localization";

export class MyComponent {
  private readonly translate = inject(TranslateService);

  // Synchronous — returns fallback key if not found
  getLabel(): string {
    return this.translate.translate("shared.save");
  }

  // With params
  getCountLabel(count: number): string {
    return this.translate.translate("items.count", { count });
  }

  // Signal-based — updates automatically on language change
  readonly pageTitle = this.translate.translateSignal("dashboard.title");

  // Read current language code
  readonly lang = this.translate.languageCode; // Signal<string>
}

5. Add Admin Routes (Language and Key Management)

// app.routes.ts
import { LOCALIZATION_ROUTES } from "@flusys/ng-localization";

export const routes: Routes = [
  {
    path: "localization",
    loadChildren: () => LOCALIZATION_ROUTES,
  },
];

RTL Support

When the user switches to an RTL language, LocalizationStateService sets document.documentElement.dir and lang automatically. Tailwind rtl: utility classes and component RTL support both activate from this single attribute change — no extra configuration needed.

License

MIT © FLUSYS