Skip to content

[FEATURE]: add translation files for remaining RTL languages (Farsi, Urdu, Pashto, etc.) #34697

Closed as not planned

Description

@hbx12

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

PR #32247 just updated the RTL direction map to support all 11 RTL-script languages — Arabic, Farsi, Urdu, Pashto, Sorani Kurdish, Hebrew, Yiddish, Sindhi, Uyghur, Divehi, and Dari. The infrastructure is ready: once a locale is registered, the app automatically flips to RTL layout via rtl.css.

However there are no actual translation files yet for any of these languages except Arabic. So users speaking Farsi, Urdu, Hebrew, etc. still cannot use the app in their language even though RTL support is technically already there.

What I think needs to happen:

  • Add translation files in packages/app/src/i18n/, packages/ui/src/i18n/, and packages/desktop/src/renderer/i18n/ for each RTL language
  • Register each new locale in the LOCALES arrays and locale detection matchers

Regarding the flagged duplicates:

This is a meta-issue to track adding translation files for all RTL languages that currently have no UI translations at all.

Activity

  1. github-actions commented on Jul 1, 2026

    @github-actions
    Contributor

    This issue does not fully meet our contributing guidelines.

    What needs to be fixed:

    • No recognized issue template was used. This project requires one of: Bug Report, Feature Request, or Question.
    • Feature request titles must start with [FEATURE]: — the current title uses feat: (a commit message convention, not an issue title format).
    • The feature request template requires a verification checkbox confirming the feature has not been previously suggested, which is missing here.
    • The content appears AI-generated (structured tables, precise file paths, and numbered implementation steps in a formulaic style are not acceptable substitutes for a genuine user request).

    Please edit this issue to use the proper Feature Request template and address the above within 2 hours, or it will be automatically closed.


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

    If you believe this was flagged incorrectly, please let a maintainer know.

  2. changed the title [-]feat: add translation files for remaining RTL languages (Farsi, Urdu, Pashto, etc.)[/-] [+][FEATURE]: add translation files for remaining RTL languages (Farsi, Urdu, Pashto, etc.)[/+] on Jul 1, 2026
  3. hbx12 commented on Jul 1, 2026

    @hbx12
    Author

    Thanks for the feedback. I have:

    1. Updated the title to start with [FEATURE]: ✓
    2. Added the verification checkbox ✓
    3. Used the proper Feature Request template structure ✓
    4. Clarified the difference from [FEATURE]: Add Farsi (fa) translation of README #31771 (README translation, not app UI) and [FEATURE]:راست چین شدن کادر چت #33201 (RTL alignment, already handled by PR feat(ui): full RTL support for Arabic and RTL languages #32247)

    This issue is specifically about adding UI translation files for all RTL languages that currently have none — the RTL infrastructure is done in PR #32247, this is about the translations themselves.

  4. github-actions commented on Jul 1, 2026

    @github-actions
    Contributor

    Thanks for updating the issue! It now meets our contributing guidelines. We'll take a look.

  5. NXR8 commented on Jul 16, 2026

    @NXR8

    RTL OpenCode — Arabic RTL Support System

    A system that adds Right-to-Left (RTL) text support to the OpenCode Desktop app while keeping code blocks LTR.


    How It Works

    1. Arabic Detection

    var AR = /[\u0600-\u06FF\u0750-\u077F\u08A0-\u08FF]/;

    Checks for any Arabic character within the first 30 characters of the text:

    • Arabic found → RTL
    • No Arabic → LTR

    Solves mixed-language cases:

    "This is a long English sentence... مع عربي في النهاية"  → LTR (Arabic after 48 chars)
    "Hello مرحبا"                                              → RTL (Arabic within first 30)
    

    2. Prompt Input

    Uses only 3 characters instead of 30 — switches to RTL instantly when the user types the first Arabic character.

    3. List Containers (<ol>, <ul>)

    These are skipped — they inherit direction from their parent (the Arabic paragraph). Individual <li> elements get direction based on their own content.

    4. Locking Code & Links LTR

    When an element is RTL, all code and anchor elements inside are forced LTR:

    code, span.line, .inline-code, a  ←  display:inline-block + dir:ltr

    5. MutationObserver for Streaming

    Monitors DOM changes with:

    • childList: new elements during streaming
    • subtree: all nesting levels
    • characterData: inline text changes

    Re-attaches the input event listener on the prompt input when React re-renders it.


    Console Snippet

    /* Paste this in Console after typing "allow pasting" */
    
    var s=document.createElement('style');
    s.textContent='p,li,ol,ul,blockquote,h1,h2,h3,h4,h5,h6,table,th,td,[data-slot="text-part-body"],[data-slot="user-message-text"],[data-component="prompt-input"]{text-align:start}'+
    '[data-component="markdown-code"],[data-component="markdown-code"] pre,[data-component="markdown-code"] code,[data-component="markdown-code"] span.line{direction:ltr!important;text-align:left!important}'+
    '[dir="rtl"] ol,[dir="rtl"] ul{padding-inline-start:32px}'+
    '[dir="rtl"] li>ol,[dir="rtl"] li>ul{padding-inline-start:1rem}';
    document.head.appendChild(s);
    
    var AR=/[\u0600-\u06FF\u0750-\u077F\u08A0-\u08FF]/;
    var SEL='p,li,ol,ul,blockquote,h1,h2,h3,h4,h5,h6,table,th,td,[data-slot="text-part-body"],[data-slot="user-message-text"]';
    
    function isText(n){return n.matches&&n.matches(SEL)}
    function setDir(el){
      if(!el||el.getAttribute('dr'))return;
      if(el.closest('pre')||el.tagName==='CODE')return;
      var t=(el.textContent||'').trim();
      if(!t){el.setAttribute('dir','ltr');el.setAttribute('dr','1');return}
      el.setAttribute('dir',AR.test(t.substring(0,30))?'rtl':'ltr');el.setAttribute('dr','1');
      if(el.getAttribute('dir')==='rtl')el.querySelectorAll('code,span.line,.inline-code,a,[dir="ltr"]').forEach(function(e){
        if(!e.closest('pre')){e.style.display='inline-block';e.setAttribute('dir','ltr');e.style.textAlign='left'}
      })
    }
    function attInp(el){
      if(!el||el.getAttribute('di'))return;
      el.addEventListener('input',function(){
        var t=(this.textContent||'').trim();
        if(!t)return;
        this.setAttribute('dir',AR.test(t.substring(0,3))?'rtl':'ltr')
      });
      el.setAttribute('di','1')
    }
    function scan(n){
      if(n.nodeType!==1)return;
      if(isText(n))setDir(n);
      if(n.matches&&n.matches('[data-component="prompt-input"],div[contenteditable="true"][role="textbox"]'))attInp(n);
      var f=n.querySelectorAll(SEL+',[data-component="prompt-input"],div[contenteditable="true"][role="textbox"]');
      for(var i=0;i<f.length;i++){
        if(isText(f[i]))setDir(f[i]);
        if(f[i].matches&&f[i].matches('[data-component="prompt-input"],div[contenteditable="true"][role="textbox"]'))attInp(f[i])
      }
    }
    document.querySelectorAll(SEL).forEach(setDir);
    attInp(document.querySelector('[data-component="prompt-input"],div[contenteditable="true"][role="textbox"]'));
    
    new MutationObserver(function(m){
      for(var i=0;i<m.length;i++)
        for(var j=0;j<m[i].addedNodes.length;j++)scan(m[i].addedNodes[j]);
    }).observe(document.getElementById('root')||document.body,{childList:true,subtree:true,characterData:true});

    Testing

    1. Open DevTools (F12 or Ctrl+Shift+I)
    2. Type allow pasting in the Console
    3. Paste the snippet above
    4. Verify:
      • Arabic text → right-aligned
      • English text → left-aligned
      • Lists → numbers/bullets on the right for Arabic
      • Code blocks → always LTR, left-aligned
      • Streaming responses → applied automatically
  6. toyro396133 commented on Jul 29, 2026

    @toyro396133

    I've already implemented a complete Hebrew (he) translation with full RTL support that addresses exactly what this issue requests for one of the RTL languages.

    The implementation includes:

    • Translation files in packages/app/src/i18n/he.ts, packages/ui/src/i18n/he.ts, packages/desktop/src/renderer/i18n/he.ts, packages/console/app/src/i18n/he.ts, and packages/stats/app/src/i18n/he.ts
    • Hebrew registered in all LOCALES arrays and locale detection matchers
    • Full RTL support with dir="rtl" handling in the language context
    • Hebrew-specific plural form handling (one, two, other)
    • 434 translated strings with proper technical terminology
    • 7 translated documentation files including getting started guide, CLI reference, and troubleshooting
    • Hebrew glossary file with RTL guidance

    This is available in PR #39423. Since the RTL infrastructure is already in place (as mentioned in this issue), the Hebrew translation can serve as a complete example for the other RTL languages (Farsi, Urdu, Pashto, etc.).

    Would you like me to update this issue to track the remaining RTL languages, with Hebrew marked as completed?

  7. Amlaach commented on Jul 29, 2026

    @Amlaach

    @toyro396133 Thanks for opening this PR! This is something I’d really like to see merged, and I’m sure others would benefit from it as well. Hopefully this helps show there’s real interest in having this implemented.

  8. israel-Life commented on Jul 29, 2026

    @israel-Life

    @toyro396133 I would also be very happy to have a Hebrew interface.
    You saw that there is PR that adds Hebrew #39423

  9. github-actions commented on Sep 28, 2026

    @github-actions
    Contributor

    To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.

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