Montajebii/add fa-IR(Persian) localization#73
Conversation
msitarzewski
left a comment
There was a problem hiding this comment.
Thank you for this, @montajebii — a complete Persian translation (~690 keys) is a genuinely welcome contribution, and the registry wiring (LOCALES, localeLabels, overrides) is set up correctly. 🙏
There are two small code issues to fix before we can merge, plus one heads-up that is not on you.
1. Build-breaking typo in messages.ts (required)
The import has the semicolon inside the string, so it resolves to a path that doesn't exist and the build fails:
-import fa from "./locales/fa;"
+import fa from "./locales/fa";2. fa.ts should follow the same shape as the other locales (required)
Every locale validates itself against the English source of truth with satisfies Partial<Messages>. That's what catches a renamed or removed key. Your fa.ts instead uses as const and re-declares MessageKey / Messages from its own keys, which skips that safety.
Please match src/lib/i18n/locales/ru.ts:
// top of fa.ts
import type { Messages } from "./en";
const fa = {
"app.theme.light": "روشن",
// … all your keys, unchanged …
} satisfies Partial<Messages>;
export default fa;i.e. add the import type { Messages } from "./en"; line, change } as const; → } satisfies Partial<Messages>;, and remove these three lines:
export type MessageKey = keyof typeof fa;
export type Messages = Record<MessageKey, string>;Then run npm run check — with satisfies Partial<Messages> in place it will flag any key that doesn't exist in en.ts (typos), so it's a good way to confirm the file is clean before pushing.
3. RTL — heads-up, not a blocker for this PR
Persian is right-to-left, and the app doesn't have RTL layout support yet (no dir="rtl" / logical-CSS handling anywhere). So once this lands, the Persian UI will render in the current LTR layout — fully readable, but alignment/icons/punctuation won't be mirrored. Proper RTL (dir="rtl" + logical properties) is a separate, larger piece of work that we'll track on our side — you don't need to tackle it here. Just flagging so the strings-only behavior isn't a surprise.
Once 1 and 2 are in and npm run check is green, this is good to merge. Thanks again! 🇮🇷
Persian(Farsi) is an LTR language. This localization will be helpful, but for better UX, adding the LTR feature is recommended.
fixes #72