All skills
sergiodxa avatar

/frontend-internationalization-best-practices

@6eae8fd

Internationalization best practices for React Router framework mode using remix-i18next. Use when setting up locales, middleware, resource routes, or language switching.

Use this Skill: https://skilld.dev/gh/sergiodxa/agent-skills/frontend-internationalization-best-practices

This session only. Nothing lands on disk.

ruleslanguage-switcher.md

≈241 tokens on demand. Your agent reads this file only when SKILL.md points to it.

Build a Language Switcher

Persist locale in cookie or session so users keep their preference across requests.

Pattern

// app/routes/_index.tsx
import { data } from "react-router";
import type { Route } from "./+types/_index";
import { localeCookie, getLocale } from "~/middleware/i18next";

export async function loader({ context }: Route.LoaderArgs) {
  let locale = getLocale(context);
  return data(
    { locale },
    { headers: { "Set-Cookie": await localeCookie.serialize(locale) } },
  );
}
export function LanguageSwitcher() {
  return (
    <div>
      <a href="/?lng=en">English</a>
      <a href="/?lng=es">Espanol</a>
    </div>
  );
}

Rules

  1. Store locale in cookie/session when user switches languages
  2. Keep URLs stable; use query params or UI state for the switch
  3. Prefer cookie/session over DB lookups on each request

Source: SKILL.md on GitHub

1 warning8d5 checks · Risk SAFE
  • Gen Agent Trust Hub8d

    The skill provides guidelines and patterns for implementing internationalization in React Router applications using remix-i18next. It demonstrates secure practices such as using Zod for input validation in resource routes to prevent directory traversal or arbitrary data access, and correctly configuring secure cookies for locale persistence. No security issues were identified.

  • Socket8d

    No alerts

  • Snyk8d

    Risk: LOW · No issues

  • Runlayer7mo

    12/12 files flagged

  • ZeroLeaks5mo

    Score: 93/100 · 2 sections analyzed

Signed by skilld at 6eae8fd. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub 2 months ago.

Dormantupdated 8 months ago

README badge

README badge for sergiodxa/agent-skills/frontend-internationalization-best-practices