Bug 157037 - Auto detect CTL on plain text files
Summary: Auto detect CTL on plain text files
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
Inherited From OOo
Hardware: All All
: medium enhancement
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: RTL-CTL File-Opening
  Show dependency treegraph
 
Reported: 2023-08-31 12:08 UTC by AvidSeeker
Modified: 2023-09-28 23:35 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments
Plain text RTL document example (2.22 KB, text/markdown)
2023-09-20 11:48 UTC, AvidSeeker
Details

Note You need to log in before you can comment on or make changes to this bug.
Description AvidSeeker 2023-08-31 12:08:19 UTC
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.
Comment 1 Dieter 2023-09-16 09:25:16 UTC
AvidSeeker, please add a plain text file with rtl language as this makes it easier for us to verify the bug. thank you.
=> NEEDINFO
Comment 2 AvidSeeker 2023-09-20 11:48:43 UTC
Created attachment 189715 [details]
Plain text RTL document example
Comment 3 QA Administrators 2023-09-21 03:16:14 UTC Comment hidden (obsolete)
Comment 4 Stéphane Guillou (stragu) 2023-09-28 23:35:45 UTC
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