start

# Accelerator Keys

An accelerator key is a key on your keyboard that you can press to quickly access a menu or function.

## 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 File, Edit and View 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 Open simply type o.

An accelerator marker is the 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 As...
GNOME | _ | underscore | Save _As... | Save As...
OpenOffice.org | ~ | tilde | Save ~As... | Save As...
Mozilla | & | ampersand | Save &As... | Save As... | Using moz2po

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 &&. Eg “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? We usually follow these simple rules.

1. Try to keep the same position as the original. Eg “&File” → “&Ifayile”
2. Try to keep the same letter as the original. Eg “&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 such as lower case g or y where the character goes below the line as it causes the character to look odd and the accelerator not to be immediately recognisable. eg. In GNOME _g would appear as g which looks messy.
5. 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 (: validate this :)

## 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:

- Author
- Address
- Available Actions...

You will notice that all the accelerators use the A key --- this is a clash. Fortunatly 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 elipses (...) 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:

- Author
- Address
- Available Actions...

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

## Examples

English | Bad | Good | Why?
--- | --- | --- | ---
X Axis... | Khona ya X... | Khona ya X... | This accelerator appears nicely on the letter X in the English. The translator slavishly followed the first rule of keeping the accelerator in the same position. Yet the good version, which follows rule 2, is much better as it keeps the same letter and it also works for the next string which is “Y Axis...”
800×600 pixels | dikarolwana tse 800×600 | dikarolwana tse 800×600 | This follows the previous example. The translator has continued to use the first letter of the translation even though the number work well in the translation so there was no need to change the accelerator. It also work with the surrounding translations that cover 1024×758, etc. With the option chosen by the translator all of these translations would use the d as the accelerator which wouldn’t work.
URL for Perl scripts | URL bakeng sa maqephe a Perl | URL bakeng sa maqephe a Perl | You will notice that Perl is untranslated this is becuase in Sotho it was decided not to translate the names of computer languages, they’re really like brand names. So here the accelerator appears in English associated with Perl. Perl appears in the translation and therefore we could simply have transfered it without any worry about accelerator conflicts.
An ~example | Bad~translation | Good ~translation | This example shows a common error of leaving out a space between words. Because the accelerator sometimes in your mind looks like a space its easy to forget to place the space between words in the translation.

## 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, its not a train smash. Once the application is fully translated these conflicts should sort themselves out over time.

## Application Specific Notes

### KDE

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.