| Summary: | In cocoa, Help menu can not display "Search" menu item in chinese language. | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Product: | [Eclipse Project] Platform | Reporter: | alf <lihedl> | ||||||||||
| Component: | SWT | Assignee: | Silenio Quarti <Silenio_Quarti> | ||||||||||
| Status: | RESOLVED FIXED | QA Contact: | Scott Kovatch <skovatch> | ||||||||||
| Severity: | normal | ||||||||||||
| Priority: | P3 | CC: | cyzhdl, eclipse.felipe, lihedl, linyunz, mukund, pwebster, raji, Silenio_Quarti, skovatch | ||||||||||
| Version: | 3.6.1 | ||||||||||||
| Target Milestone: | 4.3 M6 | ||||||||||||
| Hardware: | Macintosh | ||||||||||||
| OS: | Mac OS X | ||||||||||||
| Whiteboard: | |||||||||||||
| Attachments: |
|
||||||||||||
Created attachment 181067 [details]
Snippet java file for reproduct bug
The snippet Code for reproduct bug:
public class Snippet29 {
public static void main(String[] args) {
System.out.println("SWT implement is : " + SWT.getPlatform());
Display display = new Display();
Shell shell = new Shell(display);
Menu bar = new Menu(shell, SWT.BAR);
shell.setMenuBar(bar);
MenuItem helpItem = new MenuItem(bar, SWT.CASCADE);
helpItem.setText("°ïÖú");
// helpItem.setText ("¥Ø¥ë¥×");
Menu submenu = new Menu(shell, SWT.DROP_DOWN);
helpItem.setMenu(submenu);
MenuItem item = new MenuItem(submenu, SWT.PUSH);
item.addListener(SWT.Selection, new Listener() {
public void handleEvent(Event e) {
System.out.println("Select All");
}
});
item.setText("Select &All\tCtrl+A");
item.setAccelerator(SWT.MOD1 + 'A');
shell.setSize(200, 200);
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch())
display.sleep();
}
display.dispose();
}
}
Created attachment 181068 [details]
Screen shot for bug in cocoa
Created attachment 181071 [details]
Screen shot in carbon
In carbon, it run right.
Nothing obvious right now. I can reproduce it on 10.6. As long as you use the expected OS X Unicode values for the Help menu title you should get the Search menu item for free. For what it's worth, the equivalent AWT code also has the same bug:
import java.awt.*;
public class MenuTest {
public static void main(String args[]) {
MenuBar mb = new MenuBar();
Menu m = new Menu("帮助");
mb.add(m);
mb.setHelpMenu(m);
MenuItem mi = new MenuItem("Search");
m.add(mi);
Frame f = new Frame();
f.setMenuBar(mb);
f.show();
}
}
You can also try replacing the Chinese glyphs with the Unicode expansion:
\u5E2E\u52A9
and get the same result. (Please make sure I have those Unicode values right -- I got that by searching the Character Viewer for those glyphs.)
When I was working on the AWT this bug frequently cropped up, and it's because the Cocoa menu implementation doesn't handle programmatic updates of the menu bar very well. I'll file a new bug with Apple.
This is now tracked as Apple bug 8565320. As the status changes I'll update this bug. One thing that occurred to me is that you may need to create an application bundle and add the folder 'zh_TW.lproj' to <app bundle>/Contents/Resources. That tells Cocoa that your application is localized. I can't recall right now if that's a requirement in Cocoa but not in Carbon. Is there any new updates about this Apple bug 8565320? BTW, we had folder 'zh_TW.lproj' under our <app bundle>/Contents/Resources, but there is still with problem. *** Bug 401856 has been marked as a duplicate of this bug. *** (In reply to comment #8) > Is there any new updates about this Apple bug 8565320? > > BTW, we had folder 'zh_TW.lproj' under our <app bundle>/Contents/Resources, > but there is still with problem. I search the https://bugreport.apple.com and I was not able to find a bug with id 8565320 to check the status. Which JVM are you running? Old Apple 1.6? Or new Oracle 1.7? Updated snippet with chinese simplified/traditional and portuguese HELP strings.
package org.eclipse.swt;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Menu;
import org.eclipse.swt.widgets.MenuItem;
import org.eclipse.swt.widgets.Shell;
public class Snippet29 {
public static void main(String[] args) {
System.out.println("SWT implement is : " + SWT.getPlatform());
Display display = new Display();
Shell shell = new Shell(display);
Menu bar = new Menu(shell, SWT.BAR);
shell.setMenuBar(bar);
MenuItem helpItem = new MenuItem(bar, SWT.CASCADE);
// helpItem.setText("\u5E2E\u52A9");//simplified
// helpItem.setText("\u8f14\u52a9\u8aaa\u660e");//tradicional
helpItem.setText("Ajuda");//portuguese
Menu submenu = new Menu(shell, SWT.DROP_DOWN);
helpItem.setMenu(submenu);
MenuItem item = new MenuItem(submenu, SWT.PUSH);
item.addListener(SWT.Selection, new Listener() {
public void handleEvent(Event e) {
System.out.println("Select All");
}
});
item.setText("Select &All\tCtrl+A");
item.setAccelerator(SWT.MOD1 + 'A');
shell.setSize(200, 200);
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch())
display.sleep();
}
display.dispose();
}
}
I have released changes to master that work around this problem in cocoa. Note that the fix requires the SWT translation files (SWTMessages_XX.properties) to be updated. A new entry has been added for the help string: SWT_Help. http://git.eclipse.org/c/platform/eclipse.platform.swt.git/commit?id=a6ea095a16f72ca5deb1a7074e00ce6f47794bfb Created attachment 227689 [details]
same patch for R3_7_maintenance branch
Old Apple 1.6 (In reply to comment #10) > (In reply to comment #8) > > Is there any new updates about this Apple bug 8565320? > > > > BTW, we had folder 'zh_TW.lproj' under our <app bundle>/Contents/Resources, > > but there is still with problem. > > I search the https://bugreport.apple.com and I was not able to find a bug > with id 8565320 to check the status. > > Which JVM are you running? Old Apple 1.6? Or new Oracle 1.7? Will the patch be delivered into 4.3 Master target? Or just in R3_7_maintenance branch? (In reply to comment #12) > I have released changes to master that work around this problem in cocoa. > Note that the fix requires the SWT translation files > (SWTMessages_XX.properties) to be updated. A new entry has been added for > the help string: SWT_Help. > > http://git.eclipse.org/c/platform/eclipse.platform.swt.git/ > commit?id=a6ea095a16f72ca5deb1a7074e00ce6f47794bfb (In reply to comment #15) > Will the patch be delivered into 4.3 Master target? Or just in > R3_7_maintenance branch? > The patch is only released in 4.3 master branch. We do not plan to release it on the R3_7_maintenance branch. |
Build Identifier: I20100608-0911 In cocoa, when mac os x set chinese language, the "°ïÖú" (meaning "Help") menu can not display "ËÑË÷"(meaning "Search") menu item. But in carbon, this snippet work well. My cocoa version is swt-3.6.1-cocoa-macosx. Reproducible: Always Steps to Reproduce: 1.Download this swt snippet. 2.Set System Language to "¼òÌåÖÐÎÄ". System Preferences---> Language & Text ---> Language. Drag "¼òÌåÖÐÎÄ" to the first order. Maybe you need to change eclipse workspase file encoding to UTF-8 for run this snippet. Eclipse --> Preferences --> General --> Workspace --> Text file encoding --> other--> UTF-8 3.Run it in Cocoa. 4.Open "°ïÖú" menu and then can not see "ËÑË÷" menu item.