Bug 130589 - Strings with basic LTR reading order not rendered correctly in RTL locales
Summary: Strings with basic LTR reading order not rendered correctly in RTL locales
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Search (show other bugs)
Version: 3.2   Edit
Hardware: PC Windows All
: P3 normal (vote)
Target Milestone: 3.4 M7   Edit
Assignee: Platform-Search-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords: nl
Depends on:
Blocks: 131156
  Show dependency tree
 
Reported: 2006-03-06 13:02 EST by Karice McIntyre CLA
Modified: 2009-03-09 11:41 EDT (History)
3 users (show)

See Also:


Attachments
screen shot of example of incorrect rendering (960.05 KB, image/bmp)
2006-03-06 13:02 EST, Karice McIntyre CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Karice McIntyre CLA 2006-03-06 13:02:25 EST
In RTL orientation, there are some strings that should maintain basic LTR reading order - examples are file paths, URLs and file associations.  Even though Eclipse provides full BiDi support as of 3.1, these strings are special cases and so are not rendered correctly due to the presence of neutral characters - that is, characters whose directionality is determined based on the directionality of its surrounding text.  See http://www.unicode.org/reports/tr9/ for the full specification on the Bidirectional algorithm.  The Eclipse platform now provides API that will render these strings correctly in RTL locales (Hebrew and Arabic) by inserting directional marker characters into the string in the appropriate places.  Strings that utilize this API are intended to have an overall reading order of left to right (e.g.file paths, file associations, URLs) and are segmented according to delimiter characters where each segment will have the usual BiDi rendering algorithm applied to it.  To use this API, call
    org.eclipse.osgi.util.TextProcessor.process(String, String) 
where the first string is the string to manipulate (e.g. a file path, URL, etc) and the second string is a string of delimiters which define how the string should be segmented.
  
Example 1 
string=d:\AAA\bbb\CCC\ddd.html
delimiter=".:\"

Example 2
string=*.html
delimiter="*."

Example 3
http://AAA/bbb/ccc.html
delimiter=".:/"


Since file paths and URLs will likely be the most common use case for this API, a set of default delimiters="./\:" is provided so a call to 
    org.eclipse.osgi.util.TextProcessor.process(String) 
is all that is required in these cases.  

Test cases to check for:
URL example to test = http:\\abc\ABC where lower case is Latin (e.g. English) and upper case is Hebrew/Arabic
Without using the new API, it renders CBA\http:\\abc

File path to test = d:\abc\ABC where lower case is Latin (e.g. English) and upper case is Hebrew/Arabic
Without using the new API, it renders CBA\d:\abc

Originating from bug 119517.

Please do a complete review of the UI elements of this component in order to identify and call the new API for all occurrences of file/directory paths, URLs, file associations and any other strings that should have overall left to right reading order.  Check views, wizards, property and preference pages, and dialogs as a starting point.  Some examples of this problem that I have found in this component thus far are:

*Search View (choose Show as List option)
Comment 1 Karice McIntyre CLA 2006-03-06 13:02:55 EST
Created attachment 35772 [details]
screen shot of example of incorrect rendering
Comment 2 Martin Aeschlimann CLA 2006-03-07 03:56:38 EST
This looks like major work, especially in JDT.

It seems that we need help here from a RTL expert. Which strings need this special treatment. Paths, URL you say.
What about file names (x.java)? packages (org.eclipse.jdt), qualified names ('a.b.X$E'), method signatures (foo(int x, int y))

To encapsulate that knowledge, it would be good to have specific formatters, or label providers. E.g. We have JavaElementLabels.getMethodLabel(..) that could do the correct thing. Everybody playing around with TextProcessor.process might lead to more confusion than goodness (why is this utility in osgi?)

So what do you think of helpers like JavaElementLabels.getWorkspacePathLabel(IPath) get getExternalPathLabel() in core resources. (or something along these lines)

An advantage of such a utility is that much we can we also promote an Eclipse wide consistent rendering of paths. E.g. once (in 1.1) it was enforced that rendered workspace paths should always remove the leading separator 'MyProject/file.txt' instead of '/MyProject/file.txt' but many components don't follow this.

Ok I see, this would mean new API. But if this fix is as much work as a imagine it to be, it could be worth it.
Comment 3 Karice McIntyre CLA 2006-03-07 09:25:39 EST
I agree it will be alot of work.  

I have been communicating with the Globalization Center of Competency and they helped us come up with this solution.  The reason why the API is generic is because I don't see how we can completely identify all the specific possible uses for it, as your suggested implementation would require (before the API freeze, too).  At this point, we could only identify what is useful for the Platform (and JDT and PDE) and that will very likely not encompass every need for API like this for all applications built on Eclipse.  I definitely see the point of your suggested implementation, but I don't see it working pragmatically since the API freeze has already taken place and I believe some additional uses will arise for this API in the Platform and in other products, post-API freeze.
Comment 4 Karice McIntyre CLA 2006-03-07 09:28:39 EST
This only occurs on Windows (and maybe Mac), but not Linux.
Comment 5 Martin Aeschlimann CLA 2006-06-09 06:30:08 EDT
I filed bug 146220 to request label renderers for paths where RTL/LRT issues can be encapsulated and not everybody has to know all the details.
Comment 6 Martin Aeschlimann CLA 2007-04-10 06:54:29 EDT
*** Bug 181300 has been marked as a duplicate of this bug. ***
Comment 7 Martin Aeschlimann CLA 2008-04-21 10:03:16 EDT
fixed for 3.4 M7
see bug 222889, bug 222927
Comment 8 Dani Megert CLA 2009-03-09 11:41:21 EDT
Paul, did you use the wrong bug number? How can this fixed bug block another one?