An accelerator key is a key on your keyboard that you can press to quickly access a menu or function. It is also sometimes called a hot key, access key or mnemonic.
If you look at the menu bar on any application you will see that the first letter of each entry in underlined. Notice that F̲ile, E̲dit and V̲iew each have the first letter underlined. To quickly open the File menu press Alt+F. You will notice that most of the menu entries also have accelerator keys, to access O̲pen simply type O after typing Alt+F.
An accelerator marker is the special character we use to mark accelerator keys when we translate.
In translations accelerator keys are shown by various characters:
| Application | Marker | Name | Source Text Example | Displays As | Note |
|---|---|---|---|---|---|
| KDE | & | ampersand | Save &As... | Save A̲s... | |
| GNOME | _ | underscore | Save _As... | Save A̲s... | |
| OpenOffice.org | ~ | tilde | Save ~As... | Save A̲s... | |
| Mozilla | & | ampersand | Save &As... | Save A̲s... | Using moz2po |
| Windows Windows RC files | & | ampersand | Save &As... | Save A̲s... |
In all of the above examples pressing A would take you to the Save As dialogue box.
What happens if you want to use the & character without making it an accelerator? In this case the accelerator is usually escaped by using && (for KDE) or & (for Mozilla). E.g. “Mail && News” or “Mail & News”. As a translator you would be free to drop the & and use the equivalent of “and” in your language.
How do you select an accelerator key for your languages? Keep these principles in mind:
We usually follow these simple rules.
If we have two accelerator keys using the same letter then we say that we have a clash. Assume that the following list are the top three entries in a menu:
You will notice that all the accelerators use the A key – this is a clash. Fortunately most applications will cycle through the options as you press A repeatedly. But what would happen if the 3rd item appeared first? (The third item uses the ellipses (...) to indicate that a dialogue box will open. This if this appeared first you would never be able to access the other items.
Here is a better choice of accelerators for the same menu:
We now use A, d and c – there are no conflicts.
The pofilter tool has an accelerator test. This will check for missing accelerators as well as accelerators that shouldn’t be in the translation. The tool can tell the difference between the various accelerator keys used.
pofilter --mozilla -t accelerators <original> <accelerator-errors>
This will check for Mozilla PO style accelerators (&) in the ‘original’ directory and output any errors to a new directory called ‘accelerator-errors’
Please check the pofilter documentation for more details on how to use this tool.
What happens if you select the same accelerator key for two different components? How do you check this?
Firstly, it is not a big problem. Once the application is fully translated these conflicts should sort themselves out over time.
FIXME There are settings that can be used in KDE to check for accelerator conflicts. Not sure if any testing is possible in Gnome, OpenOffice or Mozilla.
OpenOffice.org seems to have a system that will automatically determine missing accelerator keys. What would work best with this system is to mark the accelerators that you would like to remain static and allow the others to be automatically determined. So keep “File”, “Edit”, “View” accelerators constant but allow all others to be determined at runtime.