| From | Sent On | Attachments |
|---|---|---|
| Rob Ross | Dec 23, 2008 4:48 pm | |
| Olivier Grégoire | Dec 24, 2008 1:41 am | |
| Karsten Lentzsch | Jan 6, 2009 2:54 am | |
| Rob Ross | Jan 12, 2009 4:00 pm | |
| Mark Fortner | Jan 14, 2009 10:25 am | |
| Karsten Lentzsch | Jan 15, 2009 1:31 pm | |
| Karsten Lentzsch | Jan 15, 2009 1:46 pm | |
| Rob Ross | Jan 15, 2009 5:03 pm | |
| Olivier Grégoire | Jan 16, 2009 8:12 am | |
| Rob Ross | Jan 16, 2009 11:21 am | |
| Karsten Lentzsch | Jan 16, 2009 11:31 am | |
| Rob Ross | Jan 16, 2009 5:35 pm | |
| Karsten Lentzsch | Jan 18, 2009 11:40 am | |
| Harald Kuhr | Jan 19, 2009 6:47 am | |
| Karsten Lentzsch | Jan 19, 2009 9:27 am | |
| Rob Ross | Jan 23, 2009 7:33 pm | |
| Mark Fortner | Jan 24, 2009 9:04 am | |
| Rob Ross | Jan 24, 2009 9:14 am | |
| Karsten Lentzsch | Jan 30, 2009 11:58 am | |
| Rob Ross | Feb 7, 2009 9:28 pm | |
| Karsten Lentzsch | Feb 10, 2009 11:25 am | |
| Chiovari Cristian Sergiu | Feb 10, 2009 10:49 pm | |
| Jean-Francois Poilpret | Feb 11, 2009 3:58 am | |
| Harald Kuhr | Feb 11, 2009 5:01 am | |
| Jean-Francois Poilpret | Feb 11, 2009 5:47 am | |
| Anil Philip | Feb 11, 2009 6:48 am | |
| Karsten Lentzsch | Feb 11, 2009 6:57 am | |
| Karsten Lentzsch | Feb 11, 2009 7:00 am | |
| Chiovari Cristian Sergiu | Feb 11, 2009 11:00 am | |
| Martin Skopp | Feb 12, 2009 2:34 am | |
| Karsten Lentzsch | Feb 12, 2009 5:31 am | |
| Harald Kuhr | Feb 12, 2009 8:09 am | |
| Harald Kuhr | Feb 12, 2009 8:15 am | |
| Anil Philip | Feb 12, 2009 11:17 am | |
| Anil Philip | Feb 13, 2009 6:30 am | |
| Werner Randelshofer | Feb 14, 2009 4:44 am | |
| Karsten Lentzsch | Feb 16, 2009 12:14 pm | |
| Karsten Lentzsch | Feb 16, 2009 12:17 pm | |
| Chiovari Cristian Sergiu | Feb 16, 2009 1:15 pm | |
| Chiovari Cristian Sergiu | Feb 16, 2009 1:18 pm | |
| Michael Erskine | Feb 17, 2009 5:21 am | |
| Rob Ross | Feb 25, 2009 11:53 am | |
| Karsten Lentzsch | Feb 25, 2009 12:41 pm | |
| Karsten Lentzsch | Mar 2, 2009 11:13 am |
| Subject: | Re: Question about internationalizing menu items | |
|---|---|---|
| From: | Rob Ross (rob....@gmail.com) | |
| Date: | Feb 7, 2009 9:28:28 pm | |
| List: | net.java.dev.appframework.users | |
On Jan 6, 2009, at 2:54 AM, Karsten Lentzsch wrote:
Here's how I define the preferences (options) action with my ResourceMap implementation. It provides an optional suffix for the OS ($os), Look&Feel ($laf), or system property (e.g. $java.version):
openPreferences.Action.text=${openPreferences.Action.text.[$os]} openPreferences.Action.text.default=Preferences openPreferences.Action.text.win=Optio&ns openPreferences.Action.accelerator=$ {openPreferences.Action.accelerator.[$os]} openPreferences.Action.accelerator.default=${null} openPreferences.Action.accelerator.mac=meta COMMA
On the Mac the text is "Preferences" and accelerator is meta Comma, on Windows the text is "Options", mnemonic is 'n' and there's no accelerator.
The menu item placement is managed by the GUI building code.
-Karsten
Karsten,
I've been setting up a lot of Actions and have thought up a simpler implementation than this that still provides the same level of flexibility.
Instead of having this in the properties file:
Preferences.Action.text=${Preferences.Action.text.[$os]} Preferences.Action.text.default=Preferences... Preferences.Action.text.win=&Options Preferences.Action.accelerator=${Preferences.Action.accelerator.[$os]} Preferences.Action.accelerator.default=${null} Preferences.Action.accelerator.mac=command COMMA
I can reduce it to :
Preferences.Action.text=Preferences... Preferences.Action.text.win=&Options Preferences.Action.accelerator.mac=command COMMA
The way this would work is, first, the "os" variable, (the same one as you currently use) can be both set/retrieved explicitly , as well as automatically initialized by the framework. Next, the framework already "knows" about the common values this variable can take on (e.g., "mac", "win", "solaris", etc.
By allowing it to be explicitly set, you provide the ability to expand the framework in case a user has some particular variation not initially thought of.
But the real difference comes in the implementation of the Action property injector. This would now use the concept of "the most specific platform attribute". So in the case of say the "text" property, if the application is running on the Windows platform, the value of Preferences.Action.text.win is used. On all other platforms, the value of Preferences.Action.text would be used.
Now say we run the same app on Mac OS. Since there is no specific "Preferences.Action.text.mac" property specified, the "Preferences.Action.text" property is used. Thus overriding properties for specific platforms becomes just a matter of providing for that specific value. That avoids having to have a "default" variant; the default would be just the base attribute (Preferences.Action.text), and a more specific variant is used only when such a variant is specified AND running on that platform.
Note there is no "Preferences.Action.accelerator" property specified. Thus, there is no default accelerator for this Action, so on most platforms there would not be an accelerator associated with this Action. But, on the Mac, this action would get the command-COMMA accelerator.
Also note, "command" would be synonymous with "meta", and it's trivially easy to add this functionality. Mac developers are so used to working with "command" key, and not so much "meta", that seems more natural. Of course, this could be written as "meta COMMA" and produce the exact same result.
I really think you should consider this approach, because after having defined 30 Actions now using your notation, my properties files seem very cluttered with a lot of boilerplate "scripting" , whereas the approach I'm suggesting seems a lot more streamlined and easier to read.
Let me know what you think!
Rob Ross





