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

@galatajs/i18n

v0.1.1

Published

Internationalization packages of galatajs framework

Readme

What Is It?

This package is the i18n package of the galatajs framework.

With this package, you can perform http requests, websocket requests or anything else with i18n support.

Features:

  • %100 support wherever galatajs works. (Websocket, Http, Microservice, Cli and more)
  • Fast and parametric usage
  • Customizable settings
  • %100 support for modular development with dynamic module support.
  • Fully tested, reliable.

Installation

Note: This package is 1st degree dependent on galatajs to work. Please take a look at @galatajs/app first if you haven't.

npm install @galatajs/i18n

or with yarn

yarn add @galatajs/i18n

Basic Usage

import { createApp } from '@galatajs/app';
import { createI18n } from "@galatajs/i18n";

const app = createApp();
const i18n = createI18n();
app.register(i18n);

(async() => {
  await app.start();

  const msg = i18n.translate({
    key: 'hello',
  })
  console.log('msg -> ', msg); // msg -> hello
})()

Usage With Custom Config

The i18n package comes with some default settings that will probably apply to everyone, but you can change this.

Options

type I18nConfigParams = {
  localesDir?: string; // folder path for language files
  separator?: string; // separator to separate each keys
  fallback?: string; // fallback language
  options?: I18nOptions[]; // options for to catch the default language
};

Default Options

const defaultConfig: I18nConfig = {
  fallback: "en",
  localesDir: path.resolve(__dirname, "locales"),
  options: [I18nOptions.AcceptLanguage, I18nOptions.Query, I18nOptions.Cookie],
  separator: ".",
};

Custom Options Example

const i18n = createI18n({
  fallback: 'tr'
})
const i18n = createI18n({
  fallback: 'tr',
  localesDir: path.resolve(__dirname, "i18n"),
})
const i18n = createI18n({
  separator: '_'
})

In this way, examples can be increased.

With Parameters

The i18n package allows you to work parametrically with performance.

Example

json:

// locales/en.json

{
  "greeting": "Hello, {name}!"
}

ts:

import { createApp } from '@galatajs/app';
import { createI18n } from "@galatajs/i18n";

const app = createApp();
const i18n = createI18n();
app.register(i18n);

(async() => {
  await app.start();

  const msg = i18n.translate({
    key: 'greeting',
    params: {
      'name': 'John Doe'
    }
  })
  console.log('msg -> ', msg) // Hello, John Doe!
})()

Load Dynamic Module

The I18n package has been developed for the galatajs framework. galatajs framework supports modular development %100. However, we cannot develop language files modularly in similar modular frameworks. galatajs differs from its competitors here. If you want, you can externally host and load the language files of the product module!

In addition, dynamic loading operations can be performed with this feature. Because no installation is performed until you call the code.

Example

import { createApp } from '@galatajs/app';
import { createI18n } from "@galatajs/i18n";

const app = createApp();
const i18n = createI18n();
app.register(i18n);

(async() => {
  await app.start();

  // product.module.ts
  i18n.loadModule({
      dir: path.resolve(__dirname, "./locales"),
      key: "product",
  })

  const msg = i18n.translate({
    key: 'product.title',
  })
})()