Description: Libreoffice doesn't correctly set text direction when opening plain text files. Steps to Reproduce: 1. Write a plain text file with mostly RTL language (E.g: Arabic: https://ar.wikipedia.org/wiki/ليبر_أوفيس) 2. Open it with Libreoffice writer Actual Results: Text direction is LTR Expected Results: Text direction is RTL Reproducible: Always User Profile Reset: No Additional Info: I suppose Libreoffice already have language detection capabilities. If not, please take a look on Google's language detection library: https://github.com/Mimino666/langdetect.
AvidSeeker, please add a plain text file with rtl language as this makes it easier for us to verify the bug. thank you. => NEEDINFO
Created attachment 189715 [details] Plain text RTL document example
[Automated Action] NeedInfo-To-Unconfirmed
That makes sense to me. If gedit displays the sample text RTL, why shouldn't LO do the same, setting the page style accordingly? Or at least recognise the language properly per paragraph, and set its direction accordingly. Weirdly, when importing the sample file, the paragraphs are assigned the Hindi language instead of Arabic... (same in OOo 3.3) Tested with recent master build: Version: 24.2.0.0.alpha0+ (X86_64) / LibreOffice Community Build ID: 2902ab24ecc5ffbf4907ea83b2028508b9de6364 CPU threads: 8; OS: Linux 5.15; UI render: default; VCL: gtk3 Locale: es-MX (en_AU.UTF-8); UI: en-US Calc: threaded
My Thunderbird extension does this for incoming plain text emails... https://github.com/eyalroz/bidimailui/
Any objections to me expanding the title to cover pasting plain text? Also, what about textual, but non-plain, formats, like Markdown and such?
Jonathan Clark committed a patch related to this issue. It has been pushed to "master": https://git.libreoffice.org/core/commit/974d50f66f16762f82857eaf817328460afb8b6b tdf#157037 Auto-detect paragraph directions in plain text It will be available in 26.8.0. The patch should be included in the daily builds available at https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: https://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
This commit handles opening and pasting plain text files. Other use cases should be filed as separate bugs.
Just noticed that the attachment here is actually a Markdown file rather than plain text. So, Just to clarify - after the fix, if we open `.md` files in LibreOffice we _don't_ get direction auto-detection, right? Anyway - kudos to Jonathan for another significant improvement to RTL support in LibreOffice! I hope to try this out soon myself.
(In reply to Eyal Rozenberg from comment #9) > So, Just to clarify - after the fix, if we open `.md` files in LibreOffice > we _don't_ get direction auto-detection, right? That's correct.