Neonatal Penguin March

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

    Install

    npm i @hi18n/core

    DownloadsWeekly Downloads

    1,071

    Version

    0.1.10

    License

    MIT

    Unpacked Size

    395 kB

    Total Files

    52

    Last publish

    Collaborators

    • qnighy