Token导航 LogoToken导航TokenDH.com
开发规范需要联网github未标认证来源可访问许可证需确认审计通过

frontend-internationalization-best-practices前端国际化最佳实践

Agent Skill

用于辅助前端页面、组件、样式和交互逻辑的开发与维护。它适合让 Agent 生成或审查 React、Next.js、Vue、Tailwind、CSS 等相关代码,整理组件结构,或定位布局和性能问题。使用时需要结合项目现有设计系统、路由和构建方式,避免只生成孤立片段;涉及页面改动时,应配合本地预览和构建检查确认视觉效果。

总安装

2,812

周安装

116

GitHub Stars

83

下载量

919
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:frontend-internationalization-best-practices(前端国际化最佳实践)
来源仓库:https://github.com/sergiodxa/agent-skills
仓库路径:skills/frontend-internationalization-best-practices
安装命令:
npx skills add https://github.com/sergiodxa/agent-skills --skill frontend-internationalization-best-practices
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/sergiodxa/agent-skills --skill frontend-internationalization-best-practices

简介

提供国际化开发规范与多语言支持最佳实践。

  • 涵盖翻译文件组织、语言切换逻辑与 RTL 布局处理。
  • 推荐使用标准库如 i18next 或 react-intl。
  • 需配合本地化流程,确保文本提取与更新同步。
  • frontend-internationalization-best-practices 属于开发规范类 Skill,可作为该场景下的辅助能力补充。

SKILL.md

Internationalization Best Practices

Guidelines for building a React Router i18n setup with remix-i18next. Focuses on middleware detection, locale storage, type safety, and client/server synchronization.

When to Apply

  • Adding i18n to a React Router app
  • Wiring remix-i18next middleware
  • Implementing language switching or locale detection
  • Serving locale resources from /api/locales

Rules Summary

Setup & Middleware (CRITICAL)

setup-middleware - @rules/setup-middleware.md

Configure createI18nextMiddleware and type-safe resources.

export const [i18nextMiddleware, getLocale, getInstance] =
  createI18nextMiddleware({
    detection: {
      supportedLanguages: ["es", "en"],
      fallbackLanguage: "en",
      cookie: localeCookie,
    },
    i18next: { resources },
    plugins: [initReactI18next],
  });

locales-structure - @rules/locales-structure.md

Define locale resources per language and re-export.

// app/locales/en/translation.ts
export default { title: "Example" };

Namespaces (HIGH)

namespaces-strategy - @rules/namespaces-strategy.md

Use a single namespace for small apps; multiple namespaces for large apps.

// Large app: common + route namespaces
export default { common, home, notFound };

Locale Detection & Persistence (CRITICAL)

locale-detection - @rules/locale-detection.md

Prefer cookie/session for speed, with DB as source of truth.

export const [i18nextMiddleware, getLocale] = createI18nextMiddleware({
  detection: { cookie: localeCookie, fallbackLanguage: "en" },
});

language-switcher - @rules/language-switcher.md

Store locale in cookie/session and keep it in sync.

return data(
  { locale },
  { headers: { "Set-Cookie": await localeCookie.serialize(locale) } },
);

Client & Server Integration (CRITICAL)

root-locale-sync - @rules/root-locale-sync.md

Send locale to the UI and sync <html lang dir>.

export async function loader({ context }: Route.LoaderArgs) {
  let locale = getLocale(context);
  return data(
    { locale },
    { headers: { "Set-Cookie": await localeCookie.serialize(locale) } },
  );
}

entry-client-init - @rules/entry-client-init.md

Initialize i18next client with htmlTag detection.

i18next.init({ detection: { order: ["htmlTag"], caches: [] } });

entry-server-provider - @rules/entry-server-provider.md

Reuse the middleware instance in SSR with I18nextProvider.

<I18nextProvider i18n={getInstance(routerContext)}>
  <ServerRouter context={entryContext} url={request.url} />
</I18nextProvider>

Resource Routes & Caching (HIGH)

locales-resource-route - @rules/locales-resource-route.md

Serve /api/locales/:lng/:ns with validation and cache headers.

return data(namespaces[ns.data], { headers });

UI Usage (MEDIUM)

use-bound-t-in-loader - @rules/use-bound-t-in-loader.md

Use the bound t() in loaders and useTranslation in components.

let t = getInstance(context).getFixedT(locale);

Not Found (MEDIUM)

not-found-i18n - @rules/not-found-i18n.md

Provide a 404 route so middleware runs and translations load.

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

36.23%
按下载量换算333

Claude

31.45%
按下载量换算289

Cursor

19.2%
按下载量换算176

Gemini CLI

9.74%
按下载量换算90

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

需要联网

该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills