0.1.0 • Published 2 years ago

@novely/i18n v0.1.0

Weekly downloads
-
License
ISC
Repository
github
Last release
2 years ago

@novely/i18n

Примитивный i18n

Использование

import { createI18N } from "@novely/i18n";

const { t } = createI18N({
  ru: {
    pluralization: {
      years: {
        zero: "лет",
        one: "год",
        few: "года",
        many: "лет",
      },
    },
    strings: {
      hi: "Меня зовут {{name}}, мне {{age}} {{age@years}}! 👋",
    },
  },
  en: {
    pluralization: {
      years: {
        zero: "years",
        one: "year",
        few: "years",
        many: "years",
        other: "years",
      },
    },
    strings: {
      hi: "My name is {{name}}, I am {{age}} {{age@years}} old! 👋",
    },
  },
});

const hi = t("hi");
const str = hi("ru", { name: "Артём", age: 16 });

Credits

Части этого программного обеспечения защищены авторским правом соответствующих авторов и выпущены по лицензии MIT:

0.1.0

2 years ago

0.0.1

2 years ago

0.0.0

2 years ago