Socket
Socket
Sign inDemoInstall

@hi18n/core

Package Overview
Dependencies
3
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @hi18n/core

Message internationalization meets immutability and type-safety - core runtime


Version published
Weekly downloads
998
decreased by-29.12%
Maintainers
1
Created
Weekly downloads
 

Readme

Source

Core library for hi18n

See hi18n's README for general information.

msg

Returns the first argument. Used for type-safe translations.

export default new Catalog<Vocabulary>("en", {
  "example/greeting": msg("Hello, {name}!"),
});

Catalog

Creates a set of translated messages for a specific locale.

export default new Catalog<Vocabulary>("en", {
  "example/greeting": msg("Hello, {name}!"),
});

Book

Creates a set of translated messages for all supported locales.

const book = new Book<Vocabulary>({
  en: catalogEn,
  ja: catalogJa,
});

getTranslator

Retrieves a translation helper from a book and a locale.

const { t } = getTranslator(book, "ja");
t("example/greeting", { name: "太郎" });

Keywords

FAQs

Last updated on 01 Sep 2022

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc