Issue Details (XML | Word | Printable)

Key: RCP-507
Type: Improvement Improvement
Status: Open Open
Priority: Major Major
Assignee: Unassigned
Reporter: Jonny Wray
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Spring Rich Client Project

Platform independent shortcut configuration is needed

Created: 10/Dec/07 11:05 PM   Updated: 30/Oct/08 02:17 PM
Component/s: Core
Affects Version/s: 0.2.1
Fix Version/s: 1.x

Time Tracking:
Not Specified

File Attachments: 1. Text File springrcp-support-2.patch (24 kB)
2. Text File springrcp-support.patch (6 kB)



 Description  « Hide
The current parsing of the messages file to create shortcuts does not allow for platform independent shortcut definitions, eg ctrl on windows and command on Mac OSX. Also, a number of common commands have their shortcuts set to ctrl which isn't correct on Mac OS and maybe other platforms.

 All   Comments   Work Log   Change History   FishEye   Builds      Sort Order: Ascending order - Click to sort in descending order
Jonny Wray added a comment - 10/Dec/07 11:11 PM
The patch enclosed implements a platform independent method of specifying shortcuts by using the string 'shortcut' within the messages.properties file. The standard messages.properties has been altered to use shortcut instead of ctrl for the various common commands (new, save, etc). On MacOS this means command is used as the shortcut modifier, as is usual, whereas on windows it is ctrl. Other platforms will use their specific shortcut modifier, but only windows and macos have been tested.

Peter De Bruycker added a comment - 11/Dec/07 11:32 AM
don't we have to take this a step further and take i18n to a higher level?

I mean something like this:

<bundle name>[_<locale>][_<platform>].properties, where platform is 'win', 'osx' or 'linux' (splitting linux into kde and gnome if needed)

This would allow for complete localization of accelerators: for example on windows the common accelerator to exit an application is Ctrl-X, while on OSX its Command-Q

This means translation of 'shortcut' to ctrl for Windows and meta for OSX is not enough.

I remember seeing something like this on a blog a while ago, but I don't seem to be able to find it.


Jonny Wray added a comment - 11/Dec/07 04:20 PM
Peter,

I see what you mean, this solution isn't complete. That said, it's better than the current situation and may suffice for some people. It certainly did on my current project which is why I made the changes.

I'm planning on looking into solutions for Mac specific commands (ie quit being in the apple menu) over the next few weeks so at the same time I'll look into a more complete solution for this problem also.

Jonny


Jonny Wray added a comment - 16/Dec/07 08:48 PM
I've added a second patch that adds variant i18n to the previously described solution. So, this provides:
  • The use of the 'shortcut' modifier in the command label property signifies the platform specific shortcut modifier, as defined by the platform specific Toolkit, should be used. This is equivalent to ctrl on windows and meta on MacOS.
  • The provided properties files have been modified to use shortcut rather than the platform specific ctrl.
  • Predefined platform variants of win, macosx and linux have been defined and the default locale is modified accordingly. This allows, for example, a macosx specific resource bundle properties file to defined the exit command label as 'Quit'
  • The provided bundle properties file have a macosx variant file defined that specifies the Quit label. The actual text was obtained by changing the locale on a Mac machine and using the translated Quit label in Safari.
  • In order to overcome a problem in the bundle search algorithm used by ResourceBundle.getBundle an extension of org.springframework.context.support.ResourceBundleMessageSource is given that allows language specific bundles with a variant, but without a country, to be used. Note that this problem with ResourceBundle was a know bug in Sun's bug tracker and a solution was provided for Java6, which we obviously can't use. The solution provided is simple but does the job.

The same result could be achieved without the introduction of the shortcut modifier or the use of the ResourceBundleMessageSource extension. However, that solution would require a much larger number of properties files many with much the same content, violating DRY principles.