This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 96333 - I18N - module projects don't automatically handle RTL locales for ui display
Summary: I18N - module projects don't automatically handle RTL locales for ui display
Status: RESOLVED INCOMPLETE
Alias: None
Product: platform
Classification: Unclassified
Component: Window System (show other bugs)
Version: 5.x
Hardware: All All
: P2 blocker (vote)
Assignee: issues@platform
URL:
Keywords: I18N
: 96471 (view as bug list)
Depends on:
Blocks:
 
Reported: 2007-02-22 16:25 UTC by Ken Frank
Modified: 2011-07-25 14:33 UTC (History)
4 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
right to left text editing bug (9.47 KB, image/png)
2010-10-15 19:29 UTC, relation
Details
screenshot of the current fix (8.21 KB, image/png)
2011-07-25 14:33 UTC, shlomi
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Ken Frank 2007-02-22 16:25:35 UTC
This is about module project and the platform - please change to correct
cat/subcat as needed.

jdk does not provide the following behavior - if user is running in a locale in
which the default ui behavior is left to right, like display of menus, like
arabic locale -- it does not show such menus or other ui unless additional
code is added about orientation direction.

Am filing this since it seems that module projects and platforms should show
their ui objects orientation as per locale, without user needing to add code.

In other mail, Jesse indicated he thought that this situation was a filable
kind of issue.
Comment 1 Jesse Glick 2007-02-22 19:53:37 UTC
This is an aspect of the platform (probably o.o.awt.MenuBar?), not the module
development support.
Comment 2 kalali 2007-02-23 08:57:15 UTC
First I should say that platform does not works correctly when we have Right to
Left locale.

It is not a module development feature and indeed it is a core feature, defect.
As JDK does not layout the components correctly based on user locale Netbeans
platform should do it.

for example imagine that you have to write an application with more than one
languages like Hebrew, Arabic, English and Chinese.

What the platform core should do is something like :
- Accept a direction argument when executing Launcher or pick up the direction
from resource files.
- Apply the direction to all components. (As i can tell if we apply the
direction in a top level container its child will comply with the new direction)

This way platform can provide correct support for RTL languages.

Thanks
Comment 3 Jesse Glick 2007-02-23 19:58:15 UTC
*** Issue 96471 has been marked as a duplicate of this issue. ***
Comment 4 Ken Frank 2007-02-25 17:10:56 UTC
just confirming that when its fixed here for platform, then ide will get the
fix also, and no need for any additional coding or building steps for the ide ?

ken.frank@sun.com
Comment 5 David Simonek 2007-03-19 14:59:31 UTC
Hello guys,

Couple of comments & questions:

- The fact that JDK/Swing doesn't support RTL makes things complicated. Why they
don't support this?
- (to kalali) Is there any way to change text direction easily for Swing
components? How?
- where is the information of text direction stored? Somewhere in locale? I
simply know nothing about locales...
- We don't have resources for fixing this, so I had to set target milestone to
the future. Coding help is of course welcomed, given that nobody here knows
anything about RTL languages.
Comment 6 Ken Frank 2007-03-19 16:15:43 UTC
why jdk did not fix ?
see swing issue 4505945

to fix it, there is a one line code change related to
orientation, that could be done for nb windows,
although additional code would be needed for
locale detection.

Tomas suggested such a line might be like
frame.applyComponentOrientation(ComponentOrientation.getOrientation(Locale.getDefault());

The locale settings might have some information about rtl but I think
its more in jdk/swing that the info is stored about orientation,
and that combined with nb code, to detect a list of rtl locales,
would allow such a line as above (or perhaps the getOrientation call
handles that.

I think also conversations with jdk/swing people might be helpful;
let me know if that will help and I can point you to some of them.

ken.frank@sun.com

Comment 7 Stanislav Aubrecht 2007-06-19 09:39:48 UTC
i think this is an RFE, not a bug.
even if we applied that suggested one liner to change the component orientation the whole editor would fall apart.
fixing rtl related issues would require tremendous amount of effort.
besides, how would qa test this?
Comment 8 Ken Frank 2007-06-19 15:21:30 UTC
I suggest getting additonal comments on this from filer and viewing other user input and how its handled
by other ides to see if would be viewed as enhancement or issue.  

ken.frank@sun.com
Comment 9 Ken Frank 2008-01-15 18:17:58 UTC
could dev team take another look at this and see if 
something can be done about it ?

seems that a user in rtl locale should not need to do anything
special, and that behavior of applications should work as other ones
do.

I realize there might need to be several different issues filed or
a mini project to deal with rtl, as suggested in another issue on this topic.

ken.frank@sun.com
Comment 10 relation 2010-10-15 19:29:09 UTC
Created attachment 102429 [details]
right to left text editing bug

The right to left (rtl) text is not shown properly in the upper text that is captured inside Netbeans PHP, while the lower one which is captured in WordPad is shown in the correct way.
Comment 11 relation 2010-10-15 19:32:17 UTC
Here I have attached a picture of the right to left editing bug in Netbeans.
Comment 12 Stanislav Aubrecht 2010-10-18 08:59:42 UTC
(In reply to comment #10)
> Created an attachment (id=102429) [details]
> right to left text editing bug
> 
> The right to left (rtl) text is not shown properly in the upper text that is
> captured inside Netbeans PHP, while the lower one which is captured in WordPad
> is shown in the correct way.

please provide jdk, os and netbeans version info.
also try reproducing this problem with swingset demo application (part of jdk distribution), it is probably a jdk bug.
thanks
Comment 13 shlomi 2011-06-13 19:47:54 UTC
Hey,

I am using NB 7, and i need to develop an application on top of it which uses an rtl locale.

I ran into 2 main issues
1. the menu system
2. the explorer tabs 

1. I managed to get the menu right aligned, but the contents of each menu are still ltr, and no matter what i tried, it didnt work (my menu consisted only of strings in the rtl locale)

2. the tabs seemed to be "pixel written", so in order to have them right to left, one have to re-code major parts of the *TabRendererUI classes, for all the supported l&f's.

Does anyone have any workarounds for the two issues i mentioned?

Also, this bug is quite old, should we expect any resolution for the rtl issues, or rtl based programs should not use NB rcp altogether?... 

Best regards, 
Shlomi
Comment 14 shlomi 2011-06-16 08:03:46 UTC
Hey,

I managed to partially resolve these issues:

For the menu systems, the problem is that although the swing code that executes setComponentOrientation on the main menu was called from a module installer's restore method, wrapped around by an invokeWhenUiReady, it was called *before the LazyMenu was realized, which was the problem. once i put the code in some later performing action, the menus acted as expected, becoming right to left. I still need to find the proper place to put that code so it will be automatic.

as to the EDITOR-tabs (forgive my mistake in the previous post), i managed to hack the Metal's l&f tab classes, and i now have a first working version of a right-to-left tab system, supporting resize, and overflow cases. If you are interested, ill try to upload the code.
Comment 15 shlomi 2011-07-25 14:33:39 UTC
Created attachment 109606 [details]
screenshot of the current fix

Here is a screenshot of the module that attempts to fix the toolbar to become RTL. here is the link to the source https://github.com/vadali/NB-RTL