@kiritan/runtime
v0.2.1
Published
Minimal runtime i18n (t(key, params)) for Kiritan, with no build-time dependencies / Kiritanの最小ランタイムi18n(t(key, params))。ビルド時依存なし
Maintainers
Readme

@kiritan/runtime
English | 日本語
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.
Install
npm install @kiritan/runtimeUsage
// 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.
Requirements
- Node.js >= 22.7
Contributing
Contributions are welcome! See CONTRIBUTING.md for details.
License
Distributed under the WTFPL License.
