i18n-rtl
Skill1 starsChanged 5 months agoMITView on GitHub
Internationalizes a Next.js 16 App Router app with next-intl for fr/en/ar — every user string via t() and present in all three message files, locale routing, and Arabic RTL that mirrors via dir="rtl" plus logical Tailwind classes (ms-/me-, ps-/pe-, text-start) instead of physical left/right. Use when adding a translated string, wiring next-intl routing/middleware, fixing hardcoded text, making a layout mirror for Arabic, or converting ml-/mr-/text-left to logical properties. Not for Zod form schemas and field messages (see zod-forms) or the Tailwind theme and shadcn setup itself (see tailwind-shadcn).
In this repository49 other files it gives its agents.
- accessibilitySkill
- ai-evalsSkill
- ai-integrationSkill
- architecture-decisionsSkill
- audit-loggingSkill
- aws-servicesSkill
- browser-e2e-testingSkill
- celery-tasksSkill
- changelogSkill
- ci-cdSkill
- codebase-guideSkill
- code-reviewSkill
- commit-messageSkill
- cookie-auth-csrfSkill
- dashboard-data-designSkill
- db-concurrencySkill
- debugSkill
- dependency-auditSkill
- deploy-awsSkill
- design-systemSkill
- drf-apiSkill
- drf-zod-contractSkill
- frontend-perfSkill
- git-workflowSkill
- incident-responseSkill
- migrationsSkill
- money-decimalSkill
- multi-tenancySkill
- nextjs-moduleSkill
- observabilitySkill
- perf-reviewSkill
- production-readinessSkill
- product-ux-designSkill
- rbac-permissionsSkill
- react-querySkill
- security-reviewSkill
- skill-authoringSkill
- tailwind-shadcnSkill
- tenant-session-switchSkill
- threat-modelingSkill
- verifySkill
- version-checkSkill
- visual-ui-designSkill
- webhook-handlerSkill
- websockets-channelsSkill
- write-testsSkill
- zod-formsSkill
- zustand-stateSkill
- example-skillSkill
The file
We split this skill into the rules it gives an agent
1 rule. About 0 are common, 0 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 17
No hardcoded user text: Every visible string comes from t() and exists as a key in messages/fr.json, messages/en.json, and messages/ar.json.
≈ “Common” is an estimate: at least 1 in 5 of the 213,897 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.
Files
i18n and Arabic RTL (next-intl, logical CSS)
When to use
Adding or reviewing any user-facing string, wiring locale routing, or making a
layout mirror correctly for Arabic. On this stack every visible string is
translated in all three locales (fr, en, ar) and every direction-sensitive
style is written in logical properties so dir="rtl" flips it for free.
Pattern
Two invariants, held everywhere:
- No hardcoded user text. Every visible string comes from
t()and exists as a key inmessages/fr.json,messages/en.json, andmessages/ar.json. A key present in one file but missing in another is a bug (blank UI or a raw key leak). - Direction is data, not layout. Set
dirfrom the locale on<html>; write spacing/alignment with logical classes (ms-,me-,ps-,pe-,text-start,text-end) so the same markup mirrors forarwithout RTL-specific CSS.
Route by locale, set dir once in the root layout, and read every string via t():
// app/[locale]/layout.tsx — route by locale, set dir once, provide messages
import { NextIntlClientProvider, hasLocale } from 'next-intl';
import { getMessages } from 'next-intl/server';
import { notFound } from 'next/navigation';
import { routing } from '@/i18n/routing';
export default async function LocaleLayout(
{ children, params }: { children: React.ReactNode; params: Promise<{ locale: string }> },
) {
const { locale } = await params; // Next 16 params are async
if (!hasLocale(routing.locales, locale)) notFound();
const dir = locale === 'ar' ? 'rtl' : 'ltr'; // direction is data, not layout
const messages = await getMessages();
return (
<html lang={locale} dir={dir}>
<body>
<NextIntlClientProvider messages={messages}>{children}</NextIntlClientProvider>
</body>
</html>
);
}
// In components: strings via t(), spacing via LOGICAL classes so ar mirrors for free.
// const t = useTranslations('invoices'); // key must exist in fr.json, en.json, ar.json
// <span className="ms-2 me-4 text-start ps-3">{t('label')}</span> // not ml-/mr-/text-leftAdapt to your repo
Rename the invoices namespace and message keys to your domain. Confirm your locale
set (routing.locales in i18n/routing.ts) and defaultLocale, and that the
[locale] segment plus the next-intl middleware.ts matcher are wired. Add a
CI/lint step that diffs the key sets of fr/en/ar.json so a missing translation
fails the build rather than shipping a blank string.
Gotchas
- A key in
fr.jsonbut missing inar.jsonrenders the raw key or empty text — keep the three files in lockstep; don't let one drift. ml-/mr-/left-/right-/text-leftdo not flip underdir="rtl"; use the logicalms-/me-/ps-/pe-/text-start/text-end(Tailwind v4 maps these to CSS logical properties). Seetailwind-shadcn.- Set
diron<html>from the locale, not per-component; icons/chevrons that must point a fixed way get an explicitrtl:rotate-180or a physical override. - Translate the tenant label too — "Entreprise" is the portable example; rename it and its message keys to your own tenant noun.
useTranslationsruns in client components; usegetTranslationsin server components/route handlers — don't mix them up.
See also
tailwind-shadcnzod-formsnextjs-module
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
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.

