ابحث عن أمر لتشغيله...

BidiLint is a command-line linter for right-to-left (RTL) localization files. It statically checks translated string catalogs against a base culture and reports the class of defects that character-level bidirectional text rendering produces in production: Latin runs rendered in the wrong order inside Arabic sentences, mixed numeral systems, dropped format placeholders, broken directional isolation, and — at the security end — Trojan Source bidi override characters. It is a .NET global tool (current release 0.7.2, .NET 8), designed to run locally and in CI with contractual exit codes.
Bidirectional text is governed by the Unicode Bidirectional Algorithm (UAX #9): the visual order of a mixed-direction string is computed from the logical order and the directionality of each character run. The consequence for software internationalization is that a translation can be character-for-character "correct" and still render incorrectly — a brand name such as .NET Core embedded in an Arabic sentence is reordered by the algorithm unless it is directionally isolated. These defects share three properties that make them expensive: they are invisible in the source file, they do not fail compilation or typical tests, and they are discovered by end users in the RTL interface. In my own Arabic-first work — this site's Arabic edition and an Arabic-first commerce platform — every rule in this tool corresponds to a defect that first reached production.
BidiLint compares each translation against a base culture (default en), file set by file set. Three design decisions shape it:
Format adapters, one per ecosystem. JSON (culture-named files and culture folders), .resx, Android strings.xml, Apple .strings, gettext PO/POT, and Flutter ARB are each parsed by a dedicated adapter into a common model of resource sets, so rules operate on keys and values, not on file syntax. Plural forms (i18next suffixes, Android <plurals>, PO plurals) are paired with their singular forms rather than treated as independent keys.
Findings carry their evidence. A bidi finding shows the resolved directionality levels that prove the rendering defect (for example, a Latin run at level 2 inside a level-1 RTL paragraph), not merely a claim that something is wrong. A finding a developer cannot verify is noise, and noisy linters are disabled.
Suppression is auditable and self-cleaning. Waivers require a written reason, may carry an expiry date, and report themselves as stale when expired or unmatched. Security findings (bidi overrides, invisible controls — the Trojan Source class, CVE-2021-42574) cannot be disabled in configuration, cannot be absorbed into a baseline, and can only be waived individually with a reason.
Correctness against the base: MissingKey, ExtraKey, EmptyValue, and the placeholder family — PlaceholderMismatch, PlaceholderSyntax, PlaceholderType — across placeholder dialects (.NET braced, ICU, printf, i18next, Angular, Rails, Mustache).
Bidirectional correctness: UnisolatedLatin, UnbalancedIsolates, BidiControl, IsolateDepth, NumberAdjacency, MixedNumerals (under a configurable numeral policy), PresentationForm, Normalization, Tatweel.
Security (non-configurable): BidiOverride and InvisibleControl.
The base file defines five keys. The Arabic translation is missing one key, drops a {0} placeholder, leaves .NET Core unisolated inside an RTL sentence, and mixes Western and Arabic-Indic digits in one string. Complete output of the published tool (exit code 4):
Existing catalogs are not clean, and a linter that demands a clean slate is not adopted. A baseline therefore records current findings by fingerprint (SHA-256 over rule, culture, key, and occurrence — stable across line moves and reformatting), so CI fails only on new findings; baseline entries that stop matching are reported as stale. Configuration (bidilint.json, scaffolded by bidilint --init) sets the base culture, per-rule severities, allow-lists for legitimate Latin terms (product names, currency codes), and waiver policy. Exit codes are contractual: 0 clean · 1 usage/config error · 2 path error · 3 no locale files or missing base · 4 findings at threshold · 5 internal error.
Analysis is static and file-based: it verifies string catalogs, not rendered UI. It cannot detect directionality defects introduced by markup or layout code outside the catalogs.
Very large single-file catalogs (hundreds of thousands of keys) are the slowest case; splitting catalogs per feature area keeps scans fast, and is the layout the tool's grouping model assumes.
Judgement calls remain human: whether a specific Latin term should be isolated, transliterated, or allow-listed is a product decision the tool surfaces but does not make.