# Multilingual guide (Urdu + English)

## URLs

Every public URL starts with `/ur/` or `/en/`. `/` redirects using, in order: the saved language cookie, the browser's `Accept-Language`, then `APP_LOCALE` (Urdu by default). Bots are never redirected by `Accept-Language`.

## Installing the Urdu font (Noto Nastaliq Urdu)

The font is free under the SIL Open Font License 1.1.

1. Download it from <https://fonts.google.com/noto/specimen/Noto+Nastaliq+Urdu>. Use "Get font", then "Download all".
2. Convert the Regular and Bold TTF files to WOFF2. Use any converter, or run `pip install fonttools brotli`, then:
   ```bash
   pyftsubset NotoNastaliqUrdu-Regular.ttf --unicodes="U+0020-007E,U+0600-06FF,U+0750-077F,U+08A0-08FF,U+FB50-FDFF,U+FE70-FEFF,U+200C-200F,U+2010-2027" --flavor=woff2 --layout-features='*' --output-file=NotoNastaliqUrdu-Regular.woff2
   ```
   Repeat for Bold. Keep `--layout-features='*'`: Nastaleeq depends on OpenType features to join letters correctly.
3. Put the files here:
   - `public/fonts/NotoNastaliqUrdu-Regular.woff2`
   - `public/fonts/NotoNastaliqUrdu-Bold.woff2`
   - `public/fonts/OFL.txt` (the licence file from the download)
4. Run `npm run build` again.

To use a different font later, change `config/typography.php` (or the `URDU_FONT_*` values in `.env`) and the `@font-face` rules in `resources/css/app.css`.

## RTL rules (follow them in every new view)

- Use logical utilities: `ms-`, `me-`, `ps-`, `pe-`, `start-`, `end-`, `border-s`, `border-e`. Never use `ml-`, `mr-`, `left-` or `right-`.
- Fields that are always Latin (email, phone, URL, CNIC) keep `dir="ltr"`. The base CSS does this for `type=email|tel|url` and `inputmode=numeric`.
- Fields where people type Urdu get `dir="rtl" lang="ur"`.
- Mixed-language values inside a sentence go in `<bdi>`, or an element with `dir="auto"`.
- Never use `text-transform`, `letter-spacing` or a fake bold on Urdu text. Give Urdu text room: the base styles set line-height to about 2.1 for body text.
- Directional icons get the `icon-directional` class, so they flip in RTL.

## Translations

- All UI text lives in `lang/ur/ui.php` and `lang/en/ui.php`. Keep both files with the same keys.
- Urdu validation and auth messages are in `lang/ur/validation.php` and `lang/ur/auth.php`. English uses Laravel's defaults.
- Location names: `name_en` and `name_ur` on every location. Urdu tehsil names are filled in by an Urdu editor in admin. Pages fall back to English until that's done. Admin shows an "Urdu name missing" badge.

## Dates and numbers

Times are stored in UTC and shown in `Asia/Karachi`, through the `local_datetime()` helper. Urdu pages use Western digits by default (setting `ui.urdu_digits`).
