hi18n
Core library forSee 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: "太郎" });