Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 328010 - In cocoa, Help menu can not display "Search" menu item in chinese language.
Summary: In cocoa, Help menu can not display "Search" menu item in chinese language.
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 3.6.1   Edit
Hardware: Macintosh Mac OS X
: P3 normal (vote)
Target Milestone: 4.3 M6   Edit
Assignee: Silenio Quarti CLA
QA Contact: Scott Kovatch CLA
URL:
Whiteboard:
Keywords:
: 401856 (view as bug list)
Depends on:
Blocks:
 
Reported: 2010-10-18 02:43 EDT by alf CLA
Modified: 2013-05-24 09:26 EDT (History)
9 users (show)

See Also:


Attachments
Snippet java file for reproduct bug (1.67 KB, application/octet-stream)
2010-10-18 02:50 EDT, alf CLA
no flags Details
Screen shot for bug in cocoa (20.12 KB, image/png)
2010-10-18 03:05 EDT, alf CLA
no flags Details
Screen shot in carbon (29.95 KB, image/png)
2010-10-18 03:09 EDT, alf CLA
no flags Details
same patch for R3_7_maintenance branch (8.55 KB, patch)
2013-02-27 14:22 EST, Silenio Quarti CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description alf CLA 2010-10-18 02:43:00 EDT
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.
Comment 1 alf CLA 2010-10-18 02:50:30 EDT
Created attachment 181067 [details]
Snippet java file for reproduct bug
Comment 2 alf CLA 2010-10-18 02:55:38 EDT
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();
	}
}
Comment 3 alf CLA 2010-10-18 03:05:18 EDT
Created attachment 181068 [details]
Screen shot for bug in cocoa
Comment 4 alf CLA 2010-10-18 03:09:11 EDT
Created attachment 181071 [details]
Screen shot in carbon

In carbon, it run right.
Comment 5 Scott Kovatch CLA 2010-10-18 18:50:41 EDT
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.
Comment 6 Scott Kovatch CLA 2010-10-18 19:32:40 EDT
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.
Comment 7 Scott Kovatch CLA 2010-11-04 14:37:25 EDT
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.
Comment 8 ChunYan Zhang CLA 2013-02-27 04:33:05 EST
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.
Comment 9 Silenio Quarti CLA 2013-02-27 11:20:17 EST
*** Bug 401856 has been marked as a duplicate of this bug. ***
Comment 10 Silenio Quarti CLA 2013-02-27 12:10:17 EST
(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?
Comment 11 Silenio Quarti CLA 2013-02-27 12:51:30 EST
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();
	}
}
Comment 12 Silenio Quarti CLA 2013-02-27 13:56:40 EST
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
Comment 13 Silenio Quarti CLA 2013-02-27 14:22:59 EST
Created attachment 227689 [details]
same patch for R3_7_maintenance branch
Comment 14 ChunYan Zhang CLA 2013-02-27 20:52:05 EST
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?
Comment 15 ChunYan Zhang CLA 2013-02-28 03:07:19 EST
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
Comment 16 Silenio Quarti CLA 2013-02-28 10:05:28 EST
(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.