The minimal runtime i18n half of Kiritan —
t(key, params), with no build-time dependencies (no remark, no CLI). Safe to use on its own, in any project, without pulling in the rest of Kiritan.
npm install @kiritan/runtime// src/components/Button/Button.i18n.ts
export default {
submit: { en: "Submit", ja: "送信" },
cancel: { en: "Cancel", ja: "キャンセル" },
};import messages from "./Button.i18n";
import { createT } from "@kiritan/runtime";
const { t, setLocale } = createT(messages, { locale: "en", fallbackLocale: "en" });
t("submit"); // "Submit"
setLocale("ja");
t("submit"); // "送信"t()'s key argument is typed from whatever object you pass to createT — a typo is a compile error, no code generation needed. See docs/DESIGN.md chapter 9 for the full picture, including the colocated / split / centralized / embedded resource placement strategies and %{name} interpolation.
- Node.js >= 22.7
Contributions are welcome! See CONTRIBUTING.md for details.
Distributed under the WTFPL License.
