Files
AFFiNE-Mirror/tools/cli
Mohad 13ad1beb10 feat(i18n): automatic RTL layout for Arabic, Persian, and Urdu + complete Arabic translations (#14624)
## Changes

### RTL Support (automatic, locale-driven)
- Add `rtl?: boolean` metadata to locale definitions in
`SUPPORTED_LANGUAGES`
- Set `rtl: true` for Arabic (`ar`), Persian (`fa`), and Urdu (`ur`)
- Automatically set `document.documentElement.dir` based on locale RTL
metadata on language change
- Remove hardcoded `lang="en"` from HTML template — JS now controls both
`lang` and `dir`

### Arabic Translations
- Add 100 missing keys to `ar.json` (Calendar integration, Doc
Analytics, MCP Server, AI Chat, and more)
- Arabic locale now has 2,313/2,313 keys (100% coverage, matches
`en.json` exactly)

## Testing
Switching to Arabic/Persian/Urdu now automatically flips the entire UI
layout to RTL without any manual feature flag.

Fixes #7099

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **New Features**
* Added Right-to-Left (RTL) support for Arabic, Persian, and Urdu with
automatic document direction and language attributes when a language is
selected.

* **Refactor**
* Centralized and reordered internal language handling so document
language and direction are applied earlier and consistently.

* **Chore**
  * Set a default text direction attribute on the base HTML template.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-03-12 23:14:19 +08:00
..
2026-02-24 18:09:57 +08:00
2026-02-24 13:22:46 +08:00
2026-02-24 13:22:46 +08:00
2024-12-24 15:29:48 +08:00
2026-02-24 18:09:57 +08:00

AFFiNE Monorepo Cli

Start

yarn affine -h

Run build command defined in package.json

yarn affine i18n build
# or
yarn build -p i18n

Run dev command defined in package.json

yarn affine web dev
# or
yarn dev -p i18n

Clean

yarn affine clean --dist --rust
# clean node_modules
yarn affine clean --node-modules

Init

Generate files that make the monorepo work properly, the per project codegen will not be included anymore

yarn affine init

Tricks

Define scripts to run a .ts files without manually wiring a TypeScript loader

affine run will automatically inject tsx for your scripts

{
  "name": "@affine/demo",
  "scripts": {
    "dev": "node ./dev.ts"
  }
}
affine @affine/demo dev

or

{
  "name": "@affine/demo",
  "scripts": {
    "dev": "r ./src/index.ts"
  },
  "devDependencies": {
    "@affine-tools/cli": "workspace:*"
  }
}

Short your key presses

# af is also available for running the scripts
yarn af web build

by custom shell script

personally, I use 'af'

create file af in the root of AFFiNE project with the following content

#!/usr/bin/env sh
./tools/scripts/bin/runner.js affine.ts $@

or on windows:

node "./tools/cli/bin/runner.js" affine.ts %*

and give it executable permission

chmod a+x ./af

# now you can run scripts with simply
./af web build

if you want to go further, but for vscode(or other forks) only, add the following to your .vscode/settings.json

{
  "terminal.integrated.env.osx": {
    "PATH": "${env:PATH}:${cwd}"
  },
  "terminal.integrated.env.linux": {
    "PATH": "${env:PATH}:${cwd}"
  },
  "terminal.integrated.env.windows": {
    "PATH": "${env:PATH};${cwd}"
  }
}

restart all the integrated terminals and now you get:

af web build