s/TRANSLATORS/Translators/ in xgettext comments
[neverball] / share / keynames.c
1 /*
2  * Copyright (C) 2008 Jānis Rūcis
3  *
4  * NEVERBALL is  free software; you can redistribute  it and/or modify
5  * it under the  terms of the GNU General  Public License as published
6  * by the Free  Software Foundation; either version 2  of the License,
7  * or (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful, but
10  * WITHOUT  ANY  WARRANTY;  without   even  the  implied  warranty  of
11  * MERCHANTABILITY or  FITNESS FOR A PARTICULAR PURPOSE.   See the GNU
12  * General Public License for more details.
13  */
14
15 #include <SDL_keyboard.h>
16 #include <string.h>
17
18 #include "lang.h"
19
20 /*---------------------------------------------------------------------------*/
21
22 /* Initial template generated from $SDL/src/events/SDL_keyboard.c */
23
24 static const char *table[][2] = {
25     /* Translators,
26      *
27      * This is a mostly-complete list of human-readable SDL key names.  There
28      * might not be corresponding names for all these keys in your language,
29      * and that's perfectly fine -- in such cases just copy the source string.
30      */
31     { "backspace", N_("Backspace") },
32     { "tab", N_("Tab") },
33     { "clear", N_("Clear") },
34     { "return", N_("Return") },
35     { "pause", N_("Pause") },
36     { "escape", N_("Escape") },
37     { "space", N_("Space") },
38     { "delete", N_("Delete") },
39     { "enter", N_("Enter") },
40     { "equals", N_("Equals") },
41     { "up", N_("Up") },
42     { "down", N_("Down") },
43     { "right", N_("Right") },
44     { "left", N_("Left") },
45     { "down", N_("Down") },
46     { "insert", N_("Insert") },
47     { "home", N_("Home") },
48     { "end", N_("End") },
49     { "page up", N_("Page Up") },
50     { "page down", N_("Page Down") },
51     { "f1", N_("F1") },
52     { "f2", N_("F2") },
53     { "f3", N_("F3") },
54     { "f4", N_("F4") },
55     { "f5", N_("F5") },
56     { "f6", N_("F6") },
57     { "f7", N_("F7") },
58     { "f8", N_("F8") },
59     { "f9", N_("F9") },
60     { "f10", N_("F10") },
61     { "f11", N_("F11") },
62     { "f12", N_("F12") },
63     { "f13", N_("F13") },
64     { "f14", N_("F14") },
65     { "f15", N_("F15") },
66     { "numlock", N_("Num Lock") },
67     { "caps lock", N_("Caps Lock") },
68     { "scroll lock", N_("Scroll Lock") },
69     { "right shift", N_("Right Shift") },
70     { "left shift", N_("Left Shift") },
71     { "right ctrl", N_("Right CTRL") },
72     { "left ctrl", N_("Left CTRL") },
73     { "right alt", N_("Right Alt") },
74     { "left alt", N_("Left Alt") },
75     { "right meta", N_("Right Meta") },
76     { "left meta", N_("Left Meta") },
77     { "left super", N_("Left Super") },
78     { "right super", N_("Right Super") },
79     { "alt gr", N_("Alt Gr") },
80     { "compose", N_("Compose") },
81     { "help", N_("Help") },
82     { "print screen", N_("Print Screen") },
83     { "sys req", N_("Sys Req") },
84     { "break", N_("Break") },
85     { "menu", N_("Menu") },
86     { "power", N_("Power") },
87     { "euro", N_("Euro") },
88     { "undo", N_("Undo") },
89 };
90
91 /*---------------------------------------------------------------------------*/
92
93 const char *pretty_keyname(SDLKey key)
94 {
95     const char *ugly_keyname;
96     int i;
97
98     if ((ugly_keyname = SDL_GetKeyName(key)) == NULL)
99         return NULL;
100
101     for (i = 0; i < sizeof (table); i++)
102         if (strcmp(table[i][0], ugly_keyname) == 0)
103             return _(table[i][1]);
104
105     return ugly_keyname;
106 }
107
108 /*---------------------------------------------------------------------------*/