Skip to content

Add IRR currency and improve Persian (fa-IR) support#4312

Open
mamal72 wants to merge 2 commits into
umami-software:masterfrom
mamal72:fix/improve-ir-fa-support
Open

Add IRR currency and improve Persian (fa-IR) support#4312
mamal72 wants to merge 2 commits into
umami-software:masterfrom
mamal72:fix/improve-ir-fa-support

Conversation

@mamal72

@mamal72 mamal72 commented Jun 2, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Add IRR (Iranian Rial) to the supported currencies list
  • Complete the fa-IR (Persian) translation — 12 missing keys filled in (board-type, open, replay-code, save-replay, select-link, select-pixel, customers, orders, saved, upgrade, select-board-entity-first, upgrade-required)
  • Set lang and dir on document.documentElement via useEffect on locale change, so the HTML lang attribute reflects the active language on every render (including initial load) and both attributes live on the same <html> element

Test plan

  • Switch locale to فارسی and verify lang="fa" and dir="rtl" are set on <html>
  • Verify previously untranslated UI strings (boards, replays, revenue metrics) now appear in Persian
  • Select IRR as currency in a revenue report and confirm correct formatting (﷼ symbol, no decimals)

@vercel

vercel Bot commented Jun 2, 2026

Copy link
Copy Markdown

@mamal72 is attempting to deploy a commit to the Umami Software Team on Vercel.

A member of the Team first needs to authorize it.

@greptile-apps

greptile-apps Bot commented Jun 2, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR adds IRR (Iranian Rial) to the supported currencies list, fills in 12 missing Persian (fa-IR) translation keys, and refactors how the HTML lang and dir attributes are managed by moving the update to document.documentElement via a useEffect in useLocale.

  • fa-IR.json: 12 new keys added across both the label and message sections; label.saved and message.saved coexist in separate JSON objects without conflict.
  • constants.ts: IRR appended to CURRENCIES with the correct ISO 4217 code; Intl.NumberFormat supports it natively with zero decimal places.
  • useLocale.ts: The old #__next dir assignment is removed. A new useEffect is added to set lang/dir on document.documentElement, but Providers.tsx's MessagesProvider already contains an equivalent effect that runs after and uses the full locale string, making the new effect redundant.

Confidence Score: 5/5

Safe to merge — the translation additions and IRR currency entry are straightforward, and removing the #__next dir assignment is a correct cleanup. The new useEffect in useLocale is redundant but not harmful.

All three changed files make isolated, low-risk additions: JSON translation keys, a constant entry, and a client-side DOM side-effect hook. No data paths, APIs, or server-side logic are touched. The duplicate lang/dir effect in useLocale is overwritten by the existing MessagesProvider effect on every render, so the final observable behavior is unchanged from before this PR.

No files require special attention; the redundant effect in useLocale.ts is worth cleaning up but does not affect correctness.

Important Files Changed

Filename Overview
src/components/hooks/useLocale.ts Removes the old dir assignment on #__next, adds a new useEffect to set lang/dir on document.documentElement — but Providers.tsx's MessagesProvider already performs this exact update and runs after, making the new effect redundant and its lang format inconsistent.
public/intl/messages/fa-IR.json Adds 12 missing translation keys across the label and message sections; the new label.saved and existing message.saved are in separate JSON objects so there is no duplicate-key conflict.
src/lib/constants.ts Appends IRR (Iranian Rial) to the CURRENCIES array; ISO 4217 code is correct and Intl.NumberFormat supports it natively.

Sequence Diagram

sequenceDiagram
    participant Store as Zustand Store
    participant ML as useLocale (any component)
    participant MP as MessagesProvider (Providers.tsx)
    participant DOM as document.documentElement

    Note over Store: locale changes (e.g. fa-IR)
    Store->>ML: locale update (all subscribers)
    Store->>MP: locale update

    Note over ML,MP: React commit phase — child effects first
    ML->>DOM: "lang = "fa" (split('-')[0])"
    ML->>DOM: "dir = "rtl""

    Note over MP: MessagesProvider effect runs after
    MP->>DOM: "lang = "fa-IR" (full locale) ← overwrites"
    MP->>DOM: "dir = "rtl""
Loading

Reviews (2): Last reviewed commit: "Improve Persian (fa-IR) support" | Re-trigger Greptile

Comment thread src/lib/format.ts Outdated
Comment thread public/intl/messages/fa-IR.json
@mamal72 mamal72 force-pushed the fix/improve-ir-fa-support branch 5 times, most recently from 13d5530 to 464e99c Compare June 2, 2026 01:38
- Add 12 missing translation keys to fa-IR.json
- Set lang and dir on document.documentElement via useEffect on locale
  change, fixing the hardcoded lang="en" and ensuring both attributes
  are on the same element and applied on initial load
@mamal72 mamal72 force-pushed the fix/improve-ir-fa-support branch from 464e99c to b077714 Compare June 2, 2026 01:39
@mamal72 mamal72 marked this pull request as draft June 2, 2026 01:41
@mamal72 mamal72 marked this pull request as ready for review June 2, 2026 01:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant