一键导入
core
Smallest Better Translate setup for plain TypeScript, Node.js, Bun, APIs, and shared libraries.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Smallest Better Translate setup for plain TypeScript, Node.js, Bun, APIs, and shared libraries.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
| name | core |
| description | Smallest Better Translate setup for plain TypeScript, Node.js, Bun, APIs, and shared libraries. |
Use this guide when you want the smallest possible Better Translate setup.
@better-translate/core is the base translation engine.
Use it when:
Create one translator file and export it:
import { configureTranslations } from "@better-translate/core";
const en = {
home: {
title: "Hello",
},
} as const;
const es = {
home: {
title: "Hola",
},
} as const;
export const translator = await configureTranslations({
availableLocales: ["en", "es"] as const,
defaultLocale: "en",
fallbackLocale: "en",
messages: { en, es },
});
TypeScript key autocomplete depends on the shared exported translator.
as consttranslatortranslator.t(...) from code that needs typed keysimport { translator } from "./i18n";
translator.t("home.title");
translator.t("home.title", { locale: "es" });
That keeps locale values and translation keys inferred from the messages you configured.
@better-translate/react when React components need hooks or locale switching@better-translate/nextjs when Next.js routes or server helpers need locale awareness@better-translate/astro when Astro requests need locale awareness@better-translate/md when content files should follow the same locale setupUse { bt: true } in any t() call to write source text directly instead of inventing a key:
t("Hello world", { bt: true });
Then run npx bt extract to generate keys automatically and rewrite the calls. See skills/cli/SKILL.md for the full setup.
Do not create one translation system per framework.
Create one core translator first, then let adapters read from it.
Extract source strings, generate locale files, and remove unused keys for Better Translate projects.
Expo and React Native integration guide using Better Translate React support.
React and Expo integration guide for Better Translate providers, hooks, and typed translation access.
Package map and reading order for Better Translate product skills.
Guide for combining Better Translate packages without duplicating translation ownership.
Map of Better Translate example apps to copy from when starting a new integration.