Instruction file imported from KickBoxingCats/Oryx-Mobile (
.github/instructions/translation.instructions.md). Copyright stays with the author.
Flow Translation Instructions (Generic)
Follow this workflow whenever you add or update user-facing text for any flow.
Runtime Input
When using this instruction, the prompt should include:
- Flow name: FLOW_NAME (for example: auth, onboarding, student main, mentor main).
- Optional route scope: FLOW_ROUTE_GLOB (for example: src/app/(auth)/** or src/app/(mentor)/(main)/**).
- Optional screen scope: FLOW_SCREEN_GLOB (for example: src/components/screens/auth/**).
If exact file paths are not provided, infer them from the route and screen structure before editing.
Scope Resolution Rules
- Apply translation updates only to files relevant to FLOW_NAME.
- Prioritize these areas when present:
- Route files under FLOW_ROUTE_GLOB.
- Screen components under FLOW_SCREEN_GLOB.
- Flow-specific validation/schema files.
- Translation resources that compose app locales.
- Keep changes minimal and avoid unrelated refactors.
Required Translation Structure
- Add or update keys in English and Arabic resources with matching shape.
- Keep composer files as composers; place flow-specific keys in flow-specific resource modules when that pattern exists.
- Use a stable namespace rooted at FLOW_NAME.
- Prefer nested semantic groups:
- FLOW_NAME.common
- FLOW_NAME.fields
- FLOW_NAME.actions
- FLOW_NAME.
- validation
In-Component Usage Rules
- Use tx for Text and Button whenever possible.
- Use labelTx and placeholderTx for Input/ControlledInput fields.
- Avoid hardcoded user-facing strings in route and screen files for FLOW_NAME.
- Keep brand names unchanged unless explicitly requested.
- For accessibility text (for example accessibilityLabel), use translate("...") with a key.
Validation Message Rules
- Use translate("validation...") for user-facing validation messages.
- Avoid hardcoded validation sentences.
- Ensure every validation key exists in both English and Arabic resources.
Key Naming Conventions
- Use stable semantic keys, not sentence-as-key.
- Keep action keys under FLOW_NAME.actions.
- Keep form fields under FLOW_NAME.fields..label|placeholder.
- Keep route copy under matching namespaces, such as FLOW_NAME..title.
Completion Checklist
- No hardcoded user-facing strings remain in touched files for FLOW_NAME.
- Every new key exists in both English and Arabic resources with matching structure.
- Updated screens/components use tx/labelTx/placeholderTx/translate consistently.
- Validation messages are translation-driven.
- Changes preserve RTL behavior and existing flow logic.
Icon Direction Rules
- Directional icons must follow the active language direction.
- In LTR, keep icon directions as defined by the icon set.
- In RTL, mirror left/right directional icons.
- Apply this to ArrowLeft, ArrowRight, ChevronLeft, and ChevronRight.
- Do not hardcode one visual direction for shared directional icons.
- Use i18n direction (RTL/LTR) as the single source of truth.
Examples:
- LTR: ArrowLeft points left and ArrowRight points right.
- RTL: ArrowLeft is mirrored to point right and ArrowRight is mirrored to point left.