-
Notifications
You must be signed in to change notification settings - Fork 29.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for RTL languages #11770
Comments
Yeah, I'm in the same boat when it comes to Hebrew., even though I don't use Hebrew much in my daily day job, especially when it comes to development but this can come in handy at times so 👍 from me. |
@HamzaAbdullahMoh @eyalsk Do you mean you'd want VSCode to be translated to Arabic or Hebrew or do you mean that you cannot work with source code files containing Arabic or Hebrew ? |
@alexandrudima Well, I'll speak for myself, I refer to the capability that allows people to write from right-to-left as opposed to left-to-right. Translation isn't needed, I don't use the Hebrew translation at all in any program that I use so personally it's less useful for me but maybe some people would want that too. |
I think @HamzaAbdullahMoh want to see an RTL vscode editor as an option, and this will be so helpful This's the needed information i think 😄 |
👍 |
I think this should be labeled as a requested feaure |
@alexandrudima @elkebirmed @kazemihabib @eyalsk @ramya-rao-a |
Just to clarify, the problem is that RTL words get messed up: |
To clarify the problem: when typing in an RTL language in VSCode there are two notable problems:
Google Docs is a good example for a product that solved the problems listed above. Unlike Sublime in VSCode there is no problem of chars in the wrong order. |
Yes, Persian, Arabic and Hebrew are right-to-left languages. The editor should support BIDIRECTIONAL (BIDI) texts to lets RTL language users develop their code inside VSCode editor. This feature is very useful for a crowd users around the world with RTL language. |
It is really frustrating that many otherwise great tools (Atom, VS Code, Sublime, you name it!) lack bidirectional editing capabilities. I usually end up writing each word in a separate line when working with HTML that includes Persian. |
It is been almost two years since we discussed and requested this feature, yet, nothing had changed. I still suffer a great deal when I venture to edit Arabic. Nonetheless, I tried PHPStorm editor and it astonished me in how it supports RTL languages!!. I wonder is it still that hard to do the same in VSCode or are we trying to solve geopolitical conflict here!!?!? |
I feel your pain, but this is an open source project so anyone can open a PR that fixes this. For the great majority of editors RTL hasn't been top priority and I guess that's the same situation with VSCode. |
Why it is not top priority??! |
@iddan That's actually far-fetched, I haven't looked into the code but I think that before anyone would even consider sending a PR the core team needs to have a plan for this so people would know what components/things require work. |
An undirected PR is better than no PR. The VSCode team would probably have to be involved in the process, not necessarily the first commit. |
FYI, I found an earlier version of this issue (containing less data) #4994 |
I agree @iddan. Can you, or someone else, offer advice on where in the code base to start looking? I'm interested in helping with the implementation for this feature. |
You need to get the Latin/English only version of that font then. |
If the RTL font you're looking for is Arabic then you can try Alusus Mono (https://alusus.org/fonts/AlususMono.otf). This font has both Arabic and English characters. |
@sarmadka Is there some public info about this font (family?)? And why is it recommended for English/Arabic combined workspaces? I wouldn't have expected a font to help fix VSCode's RTL issues, so I must be missing something 👀 |
@munael This was in response to the messages above about fonts. It has nothing to do with the RTL issue itself. |
Is there a solution allready? |
Important: i posted solution 2 in the comments below. Solution 1:
Note: If you want to disable RTL, In vs code, press |
Thank you @iAhmadKarmola . |
Hi @dushkin , add the following codes to the CSS file:
Then in vs code, press |
Friendly notice: And the ` The more appropriate way would probably be: /*
.view-line [dir="ltr"] { direction: rtl; }
.view-line [style*="unicode-bidi"] { unicode-bidi: normal; }
*/
/* ^ Seemingly wreaking havoc. */
.view-line [style*="unicode-bidi"] { direction: rtl; } ]] Testing text: // Testing the RTL text in VS Code.
/* Testing the RTL text in VS Code. */
const text1 = 'Testing the RTL text in VS Code.';
// تست متن RTL در VS Code.
/* تست متن RTL در VS Code. */
const text2 = 'تست متن RTL در VS Code.'; ]] |
Solution 2:
In this solution, the above problems are solved:
Note: If you want to disable RTL, In vs code, press |
I think however it's implemented it would be broken... one way or another. Significant portion of your code appears no-op: Overall, it appears no essentially different from your previous solution. ---- [ Quote iAhmadKarmola @ CE 2023-11-21 00:30:08 UTC: <meta charset="UTF-8" />
<body style="font-family: monospace">
<span dir="ltr">t0 = <span dir="rtl" style="unicode-bidi: isolate">`تست متن RTL در VS Code.'</span></span><br/>
<span dir="ltr">x0 = <span>`</span><span dir="rtl" style="unicode-bidi: isolate">تست متن RTL در VS Code.</span><span>'</span></span><br/>
<span dir="ltr">x1 = <span>`</span>‏<span dir="rtl" style="unicode-bidi: isolate">تست متن RTL در VS Code.</span><span>'</span></span><br/>
<span dir="ltr">x2 = <span>`</span><span dir="rtl" style="unicode-bidi: isolate">تست متن RTL در VS Code.</span>‏<span>'</span></span><br/>
<span dir="ltr">x3 = <span>`</span>‏<span dir="rtl" style="unicode-bidi: isolate">تست متن RTL در VS Code.</span>‏<span>'</span></span><br/>
--------
<pre style="white-space: pre-wrap; word-wrap: break-word; tab-size: 4">
t0: Original
x0: Separated quotes
x1: Prefix RLM
x2: Postfix RLM
x3: Both
</pre> ]] Regardless, I didn't notice the purpose of the Right-to-Left Mark insertion: seemingly no difference. ---- Derived from the sample: <meta charset="UTF-8" />
<body style="font-family: monospace">
<span dir="ltr"><span>//</span><span dir="rtl" style="unicode-bidi: isolate"> تست متن Ridiculously Long RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRTL در VS Code.</span></span><br/>
<span dir="ltr"><span>// </span><span dir="rtl" style="unicode-bidi: isolate">تست متن Ridiculously Long RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRTL در VS Code.</span></span><br/>
<span dir="ltr">// <span dir="rtl" style="unicode-bidi: isolate">تست متن Ridiculously Long RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRTL در VS Code.</span></span><br/> ]] |
In the If you think this solution is no different than solution 1, it's because you haven't noticed the problems I mentioned in solution 2. Note: Still waiting for the VS Code team to fix this simple problem. Hi @alexdima , in VS Code, you have recognized Farsi/Arabic texts by adding |
Thanks for your effort. I think the fundamental problem is Unicode has such RTL characters' implementation de facto broken. "These codes are just CSS and are not dangerous for you." “Why don't give direction to these "<span>"s?” I'm not quite sure what your selection problems are. |
After reading much of [ https://unicode.org/reports/tr9/ ], I worked out a plausible workaround: <meta charset="UTF-8" />
<pre style="white-space: pre-wrap; word-wrap: break-word; tab-size: 4">
`تست متن RTL در VS Code.'
`تست متن RTL در VS Code.'
`تست متن RTL در VS Code.'
`تست متن RTL در VS Code.'
</pre> ]] And which may look quite ugly in VS Code... [ [1] So few implementations actually support such... The so messily defined "Bidi_Class"... See also [ https://github.com/MasterInQuestion/talk/discussions/2#discussioncomment-7924135 ] for applicable workaround. ] [ [2] |
There is a separate bidi category AL (Right-to-Left Arabic) — see Table 4. Bidirectional Character Types See also https://www.unicode.org/Public/UCD/latest/ucd/extracted/DerivedBidiClass.txt file listing ranges and their classes, followed by full lists of characters in each If I understand correctly, the only purpose of separating AL is in [3.3.4 Resolving Weak Types to re-label European Number (e.g. regular ascii digits) occuring near Arabic text as Arabic Number; right after that, it does:
...so for all later purposes, AL behaves identical to R. And afaict the only purpose of separating AN from EN was to fine-tune the behavior of numbers with separators/terminators per language conventions.
(By "single number" I don't mean semantically one number; clearly addition and subtraction involves separate numbers, and hyphen-minus may express either subtraction or range... I just mean the bidi algorithm will join them to one sequence of EN-class characters.) => Together these rules allow e.g. the same ASCII
If the digits were explicitly AN, then surrounding letters would not matter:
The case of [disclaimers: I don't speak Arabic, TR9 is pretty complex and I may be speaking nonsense :-] |
So overly complex (and likely entirely wrong from the very beginning), that's how it had things 3D broken: Several countries have switched the alphabet to workaround the issue. |
What?!! Countries switch alphabets for political reasons, not for technical reasons, especially when it's been solved over and over again. Bidi works perfectly fine in Firefox, Chrome, Internet Explorer, Edge, Safari, Office, LibreOffice, GEdit, Kate, Notepad++, Gnome Builder, ...... |
The technical cause contributes. |
It's 2024 and our Farsi scripting language is about to release RC version, and still, there is no support for RTL languages. |
I tried to address the issue... But really couldn't figure out how. |
we have also strange behaviour with the editor and arabic language. STEPS TO RECREATE
|
@Hamcker We were also waiting for VS Code RTL support while working on Alusus programming language (which has support for RTL scripting), but eventually we gave up and ended up forking Gnome Builder instead. Reach out if you want to give that a try, it's not hard to add Farsi localization and support for your new scripting language. Not as powerful as VS Code, but better than nothing. |
I did this method, there was no problem in
|
iAhmadKarmola's design likely considered the JS only. The direct cause for your problem is: Eventually the unsolvable part in [ https://github.com/microsoft/vscode/issues/11770#issuecomment-1819265075 ]. |
@MasterInQuestion Yes, exactly |
It would be greatly beneficial if support for right-to-left (RTL) text orientation could be added to VSCode, particularly for languages such as Persian and Arabic. While the inclusion of these languages is not essential, ensuring that text in these languages displays correctly, especially in chatbot interfaces like Copilot AI Chat, would vastly improve the user experience for many developers. |
I can honestly dare to say that this is the best open source editor for web developers but, the missing of the small things like the Arabic language support is really frustrating!!
@alexandrudima yes I mean to work with source code files containing Arabic or Hebrew.
The text was updated successfully, but these errors were encountered: