Accelerator Keys

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.

What is an accelerator key and an accelerator marker

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.

Identifying the accelerator key

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.

Selecting

How do you select an accelerator key for your languages? Keep these principles in mind:

  1. Try to keep it similar to the English. This makes it easier for users to switch to localised interfaces.
  2. Accelerators should not degrade readability too much.
  3. Avoid duplication. Ideally, in any menu, window or dialogue box, a letter should only be used as an accelerator for one string. If the letter ‘T’ is used for two menu entries, it is usually not a big problem, but the software isn’t as usable as it could be.
  4. Review accelerators in the running application.

We usually follow these simple rules.

  1. Try to keep the same position as the original. E.g. “&File” –> “&Ifayile”
  2. Try to keep the same letter as the original. E.g. “&File” –> “I&fayile”
  3. Select an uncommon letter. In Xhosa the letter I occurs frequently so we try to avoid using it too much.
  4. Avoid adding accelerators under characters with descenders such as lower case g, p, q or y. The character goes below the base line and could cause the character to look odd and the accelerator not to be immediately recognisable. E.g. in KDE &g would appear as g which looks messy. It is best to confirm with an actual test, since some rendering systems actually support underlining clearly when the letter contains a descender.
  5. Try to avoid letter next to a descender for similar reasons as above.
  6. Avoid narrow letters like i and l.
  7. Make sure the character is actually available on the user’s keyboard. Accented characters such as ä might or might not be present on a keyboard in the language.
  8. If your language uses diacritics under certain letters such as ț, ḓ or ọ, avoid these characters as well, as the underline might run through the diacritic. Avoid letters with diacritics entirely unless you are very sure that they will be usable by the end-users.
  9. No available character. Usually in Asian languages where a keyboard is Western. Translate the word into your language and use the original English accelerator. Ie “&File” –> “XXXX(&F)”. In Mozilla you can safely ignore defining the accelerator in which case it will default to the English version (FIXME: validate this :)
  10. Non-letters like numbers and punctuation marks can be used if they are present on a standard keyboard as is common amongst the speakers of your language. This will usually only be a relevant choice if it was chosen for the source text as well.

Accelerator Clashes

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:

  • A̲uthor
  • A̲ddress
  • Available A̲tions...

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:

  • A̲uthor
  • Ad̲dress
  • Available Ac̲tions...

We now use A, d and c – there are no conflicts.

Examples

Checking

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.

Errors

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.

Application Specific Notes

KDE

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

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.