agentleFS
charanjit-singhcharanjit-singh/lovable-skills/skills/i18n-multi-language/SKILL.md

i18n-multi-language

Skill10 starsChanged 6 months agoMITView on GitHub

Use when adding multi-language support, translations, locale switching, date/number formatting, or RTL layout. Not for single-language apps unless preparing for i18n later.

The file

We split this skill into the rules it gives an agent

4 rules. About 0 are common, 1 is distinctive, and 3 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 3

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Use i18next (react-i18next) for strings.

    line 11
  2. Very specific:

    Never concatenate "$" + amount or hand-format dates.

    line 76
  3. Very specific:

    Use Tailwind logical properties (ps-4 / pe-4 instead of pl-4 / pr-4).

    line 85
  4. Distinctive:

    Test layout in Arabic/Hebrew at least once.

    line 86

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

i18n multi-language

Use i18next (react-i18next) for strings; Intl for dates, numbers, and currency.

Setup

src/
  i18n/
    index.ts            # i18next init
    locales/
      en/common.json
      es/common.json
// src/i18n/index.ts
import i18n from "i18next";
import { initReactI18next } from "react-i18next";

import en from "./locales/en/common.json";
import es from "./locales/es/common.json";

i18n.use(initReactI18next).init({
  resources: { en: { common: en }, es: { common: es } },
  lng: localStorage.getItem("lang") ?? navigator.language.split("-")[0] ?? "en",
  fallbackLng: "en",
  defaultNS: "common",
  interpolation: { escapeValue: false },
});

Usage

const { t } = useTranslation();
<h1>{t("dashboard.title")}</h1>
<p>{t("welcome", { name: user.name })}</p>

JSON:

{
  "dashboard": { "title": "Dashboard" },
  "welcome": "Welcome, {{name}}"
}

Pluralization

{ "items_one": "{{count}} item", "items_other": "{{count}} items" }
t("items", { count });

Dates, numbers, currency — use Intl

new Intl.DateTimeFormat(locale, { dateStyle: "medium" }).format(date);
new Intl.NumberFormat(locale, { style: "currency", currency: "USD" }).format(amount / 100);
new Intl.RelativeTimeFormat(locale, { numeric: "auto" }).format(-3, "day");

Never concatenate "$" + amount or hand-format dates.

Locale switcher

  • Persist the chosen locale (user profile or localStorage).
  • Set <html lang={locale}> and (if RTL) dir="rtl".

RTL support

  • Use Tailwind logical properties (ps-4 / pe-4 instead of pl-4 / pr-4).
  • Test layout in Arabic/Hebrew at least once.

DB content

For user-generated multi-language content, store one row per locale or a JSON column keyed by locale code. Do not concat languages into one column.

Avoid

  • Hardcoded strings in JSX once i18n is enabled — every visible string goes through t().
  • Concatenating translated fragments (t("welcome") + " " + name) — use interpolation.
  • Translating error codes — translate user-facing messages, not stable error slugs.
  • Shipping with a single language but i18next scaffolding that nobody owns — pick a path.

Checklist

  • All visible copy uses t().
  • Intl for dates / numbers / currency.
  • <html lang> reflects current locale.
  • RTL tested if supporting Arabic/Hebrew.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.