Skip to content

[FEATURE]: Add RTL (Right-to-Left) language support in the chat panel #26915

Open

Description

@datacodexlab

Feature hasn't been suggested before.

  • I have verified this feature I'm about to request hasn't been suggested before.

Describe the enhancement you want to request

Summary

OpenCode currently does not support RTL text rendering in the chat panel. Arabic, Hebrew, and Persian-speaking users experience broken text alignment and poor readability when writing in their native languages.

Problem

When a user types in Arabic (or any RTL language) in the chat input:

  • Text alignment is LTR by default, making RTL text appear reversed or unreadable.
  • There is no option to manually switch the chat panel direction.
  • Mixed LTR/RTL content (e.g., Arabic prompt + English code) is not handled gracefully.

Proposed Solution

  1. Auto-detect text direction using the Unicode Bidirectional Algorithm (bidi) — automatically switch alignment based on the first characters typed.
  2. Manual toggle — allow users to set a preferred text direction in settings:
    {
      "chat": {
        "textDirection": "auto"
      }
    }
    Options: "auto" | "ltr" | "rtl"
  3. Per-message direction — each chat bubble should render in the correct direction based on its content language.

Why This Matters

Arabic-speaking developers are a significant and growing user base in the Middle East and globally. RTL support is a basic accessibility requirement for these users and is standard in all major chat-based tools (Slack, Discord, VS Code chat extensions).

Without RTL support, Arabic developers are forced to write their prompts in English even when they prefer Arabic — this creates a significant barrier to adoption.

References

Activity

  1. github-actions commented on May 11, 2026

    @github-actions
    Contributor

    This issue might be a duplicate of existing issues. Please check:

    Please review these issues and consider adding your input there instead of opening a new one.

  2. hbx12 commented on May 30, 2026

    @hbx12

    Hi maintainers,

    I'd like to help move Arabic/RTL support forward.

    I'm a native Arabic speaker and an active OpenCode user. I can help with:

    • Testing Arabic prompts and mixed Arabic/English code blocks
    • Validating RTL alignment in chat and input areas
    • Reviewing Arabic-related UX issues
    • Documenting expected RTL behavior
    • Helping triage Arabic/RTL reports from Middle East users

    I'm happy to start with small PRs and work closely with the team's preferred direction.

    I'd also be interested in helping maintain Arabic localization and RTL QA long-term.

    Thanks.

  3. Musa85 commented on Jul 4, 2026

    @Musa85

    Detailed root-cause analysis and a fully tested fix recipe (CSS/JS, with before/after screenshots on Desktop 1.17.13) is available in #35319 — covers word ordering, alignment, and table column direction for Arabic/RTL.

  4. razavioo commented on Jul 29, 2026

    @razavioo

    Community plugin available: opencode-rtl

    For those looking for RTL support, we've built an OpenCode plugin that automatically applies Unicode bidi isolation (RLI/LRI/PDI) to the AI's responses and system prompts.

    npm install opencode-rtl
    // opencode.json
    {
      "plugin": [
        ["opencode-rtl", { "language": "auto" }]
      ]
    }

    What it fixes today:

    • Injects RTL system prompts so the AI responds in your language
    • Protects inline code (console.log()) and markdown blocks from getting scrambled by wrapping them in LTR isolates
    • Works out-of-the-box for Arabic, Persian, Hebrew, Urdu, etc.
    • Fixes character ordering and mixed-direction (BiDi) text issues

    Current limitations:

    • Right-alignment: The plugin fixes the ordering of words and code (which fixes a lot of the unreadable output), but the text is still left-aligned. Full right-alignment requires native support in the renderer (like CSS dir="rtl" as discussed in this issue, or native alignment in the CLI TUI).
    • Streaming: It formats the text after the response completes. (We are proposing a streaming hook to fix this).

    Repo: https://github.com/razavioo/opencode-rtl

  5. razavioo commented on Sep 27, 2026

    @razavioo

    The opencode-rtl plugin adds RTL support for chat via OpenCode's plugin system. It isolates RTL text with bidi markers, handles code blocks and tables, and guides the model to respond with proper RTL formatting.

    // OpenCode 2
    { "plugins": [{ "package": "opencode-rtl", "options": { "language": "auto" } }] }
    
    // OpenCode 1
    { "plugin": [["opencode-rtl", { "language": "auto" }]] }

    Supports Arabic, Hebrew, Persian, Urdu, and 6 other RTL languages with automatic detection.

  6. mehran282 commented on Oct 12, 2026

    @mehran282

    Confirming this is still present in v2 (TUI 2.0.27, Windows 11 + Windows Terminal). Typing Persian in the composer renders word-by-word reversed LTR, e.g. typing Persian displays reversed and unreadable. Same in message replies. No client-side setting affects it (font change does not help - layout/bidi, not coverage). Happy to test any fix build on Windows.

  7. Hona commented on Oct 12, 2026

    @Hona
    Member

    can you try the GUI/Desktop app on v2?
    it should have okay-ish
    RTL support

  8. Nasrallah1995 commented on Oct 20, 2026

    @Nasrallah1995

    +1 for the Desktop app specifically — this is what keeps Arabic-first users on other tools.

    I work in Arabic (RTL reports, decks, urban indicators). In the Desktop chat panel, mixed Arabic/English messages lose per-line direction: a line that starts with a Latin token (a path, a number, an ID) flips to LTR and the surrounding Arabic reorders, so every such line has to be re-read to parse.

    Minimum that would unblock, without a full i18n pass:

    • Per-message direction detection from the first strong character, plus a manual per-message override.
    • dir="auto" + unicode-bidi: plaintext on message bodies, list items and table cells.
    • Code blocks stay LTR; Arabic inside comments/strings still renders connected.
    • A setting Text direction: Auto / LTR / RTL to force a direction per workspace.

    Related: #16875 (reversed/disconnected Arabic characters), #39525 (TUI renderer).

    بالعربية: النص العربي في المحادثة يختلط اتجاهه ويحتاج دعماً أصلياً في لوحة المحادثة.

  9. opencodejr commented on Oct 29, 2026

    @opencodejr

    Thanks for the request, @datacodexlab!

    You're asking for proper right-to-left support in the chat: automatic direction detection, a setting to force auto/ltr/rtl, and the right direction for each message.

    Much of this is already in OpenCode v2 (2.x) desktop/web:

    • The prompt input sets its direction from what you type (dir="auto"). Shell mode stays left-to-right.
    • Each message, and each Markdown block inside it, sets its own direction, and code stays left-to-right. An Arabic prompt with English code inside should display correctly.
    • The app layout supports RTL in general.

    If you're on an older version, please try the latest 2.x release.

    What isn't there yet is a setting like "textDirection": "rtl" that forces one direction instead of detecting it. I've passed that to the maintainers to consider.

    Related issues, in case one of them matches what you're seeing:

    If something still looks wrong in the latest 2.x, please open a bug report with your version (opencode --version), your platform and a screenshot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions