Workbench menus and NLS [message #460849] |
Sat, 30 December 2006 16:31  |
Eclipse User |
|
|
|
Hi,
I have a simple RCP application.
I would like to provide translatable menus.
Now, I use the following ActionBarAdvisor and
translate menu labels via an org.eclipse.osgi.util.NLS
class I have named ApplicationMessages.
Fine.
Recently I discover Eclipse NLS language packs.
I install the SDK language pack and start Eclipse IDE
with the argument -nl fr and much to my delight
the Eclipse IDE is in French.
Now I launch my RCP application with -nl fr and of
course my menus have not been translated to French.
What must I do to take advantage of vast resources
of the Eclipse NLS language packs in my RCP application?
More specifically, how can I use the NLS language packs
to translate my menu labels?
Umm, most specifically, the File and Help menu labels, for instance,
have already been translated in the language packs and I would very
much like to take advantage of these translations rather than having
to roll my own. I'm aware of course that I will have to translate my
application specific items myself.
Thanks,
Jeff Higgins
public class ApplicationActionBarAdvisor extends ActionBarAdvisor {
private IWorkbenchAction exitAction;
private IWorkbenchAction aboutAction;
private IWorkbenchAction helpAction;
private String MenubarLabel_File;
private String MenubarLabel_Help;
public ApplicationActionBarAdvisor(IActionBarConfigurer configurer) {
super(configurer);
this.MenubarLabel_File =
ApplicationMessages.ApplicationMenubarLabel_File;
this.MenubarLabel_Help =
ApplicationMessages.ApplicationMenubarLabel_Help;
}
protected void makeActions(IWorkbenchWindow window) {
exitAction = ActionFactory.QUIT.create(window);
register(exitAction);
aboutAction = ActionFactory.ABOUT.create(window);
register(aboutAction);
helpAction = ActionFactory.HELP_CONTENTS.create(window);
register(helpAction);
}
public void fillMenuBar(IMenuManager menubar) {
MenuManager fileMenu = new MenuManager(
MenubarLabel_File, IWorkbenchActionConstants.M_FILE);
menubar.add(fileMenu);
fileMenu.add(exitAction);
MenuManager helpMenu = new MenuManager(
MenubarLabel_Help, ApplicationConstants.APPLICATION_MENUBAR_ID_HELP);
menubar.add(helpMenu);
helpMenu.add(helpAction);
helpMenu.add(aboutAction);
}
}
|
|
|
|
|
Re: Workbench menus and NLS [message #460858 is a reply to message #460856] |
Sun, 31 December 2006 11:11   |
Eclipse User |
|
|
|
This is a multi-part message in MIME format.
------=_NextPart_000_0009_01C72CCC.7D10EC00
Content-Type: multipart/alternative;
boundary="----=_NextPart_001_000A_01C72CCC.7D10EC00"
------=_NextPart_001_000A_01C72CCC.7D10EC00
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Thank you Alex.
I'm still blindly feeling my way around this=20
lush jungle of intertwined functionality.
Haven't yet got a big picture view of all the interactions.
Anyway, I've solved my immediate problem by:
1. Placing the appropriate language pack jars into
my target platform directories.
2. Adding the appropriate NLS jars to my product configuration.
3. Launching my product with the -nl switch.
Now I have:
Main menu items are not translated of course but I believe=20
I can fix this, if nothing else, by translating them myself
or figuring out how to as you say "even use the existing=20
fragments to provide the data that you need"
Appreciative,
Jeff Higgins
=20
"Alex Blewitt" <alex_blewitt@yahoo.com> wrote in message =
news:10708564.1167575680762.JavaMail.root@cp1.javalobby.org...
> Have a look at=20
>=20
> =
http://help.eclipse.org/help32/topic/org.eclipse.platform.do c.isv/referen=
ce/misc/message_bundles.html
>=20
> =
http://www.eclipse.org/articles/Article-Internationalization /how2I18n.htm=
l
>=20
> if you haven't done already.
>=20
> In essence, if you're using the NLS class, you just provide static =
fields in your code and then bind them to a messages file. The messages =
file is selected based on the locale, so if your messages are called =
'messages.properties' then depending on your locale, it will load =
'messages_en.properties' or 'messages_fr.properties' into the app.
>=20
> The language packs are basically additional _xx.properties files for =
the menus etc. in the given language; and they're supplied as fragments =
(as the article shows) so that the messages are available to the runtime =
plugins when they are loaded. In essence, therefore, all you need to do =
is follow the same pattern -- or even use the existing fragments to =
provide the data that you need in the appropriate languages. (Just =
remember that the fragments are under EPL, so if you modify/prune the =
fragment, the fragment will be under EPL too :-)
>=20
> Alex.
------=_NextPart_001_000A_01C72CCC.7D10EC00
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.5730.11" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY>
<DIV>Thank you Alex.</DIV>
<DIV> </DIV>
<DIV>I'm still blindly feeling my way around this </DIV>
<DIV>lush jungle of intertwined functionality.</DIV>
<DIV>Haven't yet got a big picture view of all the interactions.</DIV>
<DIV> </DIV>
<DIV>Anyway, I've solved my immediate problem by:</DIV>
<DIV> </DIV>
<DIV>1. Placing the appropriate language pack jars into</DIV>
<DIV>my target platform directories.</DIV>
<DIV>2. Adding the appropriate NLS jars to my product =
configuration.</DIV>
<DIV>3. Launching my product with the -nl switch.</DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV>Now I have:</DIV>
<DIV> </DIV>
<DIV><IMG alt=3D"A screenshot of menubar." hspace=3D0=20
src=3D"cid:000401c72cf6$65e23910$0402a8c0@JEFF" align=3Dbaseline =
border=3D0></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV>Main menu items are not translated of course but I believe </DIV>
<DIV>I can fix this, if nothing else, by translating them myself</DIV>
<DIV>or figuring out how to as you say "even use the existing </DIV>
<DIV>fragments to provide the data that you need"</DIV>
<DIV> </DIV>
<DIV>Appreciative,</DIV>
<DIV>Jeff Higgins</DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV>"Alex Blewitt" <<A=20
href=3D"mailto:alex_blewitt@yahoo.com">alex_blewitt@yahoo.com</A>> =
wrote in=20
message <A=20
href=3D"news:10708564.1167575680762.JavaMail.root@cp1.javalobby.org">news=
:10708564.1167575680762.JavaMail.root@cp1.javalobby.org</A>...</DIV>> =
Have a look at <BR>> <BR>> <A=20
href=3D" http://help.eclipse.org/help32/topic/org.eclipse.platform.do c.isv=
/reference/misc/message_bundles.html">http://help.eclipse.org/help32/topi=
c/org.eclipse.platform.doc.isv/reference/misc/message_bundle s.html </A><BR=
>>=20
<BR>> <A=20
href=3D" http://www.eclipse.org/articles/Article-Internationalization /how2=
I18n.html"> http://www.eclipse.org/articles/Article-Internationalization /h=
ow2I18n.html</A><BR>>=20
<BR>> if you haven't done already.<BR>> <BR>> In essence, if =
you're=20
using the NLS class, you just provide static fields in your code and =
then bind=20
them to a messages file. The messages file is selected based on the =
locale, so=20
if your messages are called 'messages.properties' then depending on your =
locale,=20
it will load 'messages_en.properties' or 'messages_fr.properties' into =
the=20
app.<BR>> <BR>> The language packs are basically additional =
_xx.properties=20
files for the menus etc. in the given language; and they're supplied as=20
fragments (as the article shows) so that the messages are available to =
the=20
runtime plugins when they are loaded. In essence, therefore, all you =
need to do=20
is follow the same pattern -- or even use the existing fragments to =
provide the=20
data that you need in the appropriate languages. (Just remember that the =
fragments are under EPL, so if you modify/prune the fragment, the =
fragment will=20
be under EPL too :-)<BR>> <BR>> Alex.</BODY></HTML>
------=_NextPart_001_000A_01C72CCC.7D10EC00--
------=_NextPart_000_0009_01C72CCC.7D10EC00
Content-Type: application/octet-stream;
name="menu.gif"
Content-Transfer-Encoding: base64
Content-ID: <000401c72cf6$65e23910$0402a8c0@JEFF>
R0lGODlhOQF5AHAAACH5BAgAAP8ALAAAAAA5AXkAhwAAAAokagwmaw0nbA0o bQ4obQ8pbg8qbhAq
bxErcBEscBItcRMtchMuchQvcxUwcxUwdBYxdBcydRgzdhk0dxo1eBs2eRw3 eRw3eh04eh45ex86
fCA7fSE8fSE9fiI9fiM+f0BAQCM/gCQ/gCVAgSVBgiZBgidCgyhDgylFhCpG hStHhitIhyxIhy1J
iC5KiS9Lii9MijBNizFOjDJPjTNQjTRRjjVSjzZSjzZTkDdUkThVkThVkjlW kjpXkztYlDxZlT1a
lT1alj5blz9clz9dmChilkBdmEFemUFfmkJfmkNgm0RhnEVinEZjnUZknUdl nkhmn0lnoUpooUtp
okxqo01rpE1spE5tpU9upU9uplBvplFwp1Jwp1JxqFNyqVRyqVRzqlV0q1Z1 q1Z1rFd2rFh3rVl4
rlp5r1t6r1t6sFx7sF18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8TqvtkCr
tiqx+/qr2+qHz2md05iSljiw62qc0xmy2+ir28iNyjidHYuyO+n+riq6nXLg CYgqC286s5pQra0Z
sJRKnNvKj+OasMCKid5Kndaanhg5hA47mR1BqDMLCZAQC7IAtbyKsQdrtNiY sABbjTqLtSmbsxB5
sDTJtTyRtJrpEZoaC1D7pmgbC57Ar/3qsdnKsupqm/0JsnOrsetaiuc6muGq sCPrkuwKE2Qbmh5B
qJ4AC4gKC7CwqH+KhIO7mmxqBHhqCqbAp37auJbqslgqlQvZpm8ap5jruJo7 pqF7mqN7pqX7hY/L
oqlrhqubpa1bpqe7prE7orNbp7WrurcrqLkLm+aJuqkYuEcplK/LuTLRn0UY qdxaqsI7obuLqcfb
vDRhrKs6qUr+WbxMqaUZybc/S7fgWq7cm7cY+7F9S645ib1bGRP6uZ7ZWrA8 y77uab7VS5DSm4bo
q5Tau75VC7/qibwri7ysyqrf+pP1i4b3S5RaeoxXq579K5ELfLRUS7RGe77P C6upmrUM7L4YvL/A
CIzoaLV0WcHKesF6a5/iS457m7Hym58hy8LqusIiecBDqb3W+5S9K8NCScMh cawFzKE4rJM63Lsy
8cM5GcRCLLgi/LBHPKdJrLRLbLq/G5hHOsVUXMVWfMV52cRaGQJc3MVe/MVg HMZiPMZkXMZmfMZo
nMZqvMZs3MZgHMVPHMcrsblyXMcva8d4LJt5vMcaysd+7KUXf+zHdBzItTvI hNy6hnzIpZvIigym
AQEAOw==
------=_NextPart_000_0009_01C72CCC.7D10EC00--
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.02806 seconds