あらゆるTypeScriptプロジェクト向けの1つのi18n設定
同じ設定。同じAPI。Next.js、Astro、React、TanStack Router、プレーンなNodeで、AI GatewayまたはローカルのOllamaモデルを使用。書き換え不要。
export const landingTranslationsConfig = {
availableLocales: ["en", "es"] as const,
defaultLocale: "en",
fallbackLocale: "en",
messages: { en, es },
} as const;
const translator = await configureTranslations(landingTranslationsConfig);
const { t } = createTranslationHelpers(translator);
t("hero.title") // -> "One i18n setup for any TypeScript project."
t("hero.descriptionParam", {
params: {
param1: "value1",
}
}) // -> localized copy param
t("header.language", {
locale: "es"
}) // -> "Idioma"
t("Write source strings", { bt: true }) // -> auto-extracted & keyed by CLIどこでも同じ設定
i18n設定を書き換えることなくフレームワークを切り替えられます
bun add @better-translate/corebun add @better-translate/astrobun add @better-translate/corebun add @better-translate/corebun add @better-translate/reactbun add @better-translate/nextjsbun add @better-translate/tanstack-router