@hi18n/core
TypeScript icon, indicating that this package has built-in type declarations

0.1.10 • Public • Published

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: "太郎" });

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 0.1.10
    1,269
    • latest

Version History

Package Sidebar

Install

npm i @hi18n/core

Weekly Downloads

1,474

Version

0.1.10

License

MIT

Unpacked Size

395 kB

Total Files

52

Last publish

Collaborators

  • qnighy