4 die "Usage: gen-keyname-table.pl keynames.txt keynames-translate.txt > keyname-table.h\n";
7 open IN, $ARGV[0] || die "Cannot open $ARGV[0]: $!\n";
11 while (defined($_ = <IN>)) {
13 if (!/^\s*(0x[0-9a-f]+)\s+([\w_]*\S)\s+(1)?\s*$/) {
14 die "Cannot parse line $_";
25 open IN, $ARGV[1] || die "Cannot open $ARGV[1]: $!\n";
26 while (defined($_ = <IN>)) {
28 if (!/^\s*([\w_]*\S)\s+$/) {
29 die "Cannot parse line $_";
41 /* keyname-table.h: Generated by gen-keyname-table.pl from keynames.txt
47 static const char keynames[] =
56 print qq( "$name\\0");
59 $offset += length($name) + 1;
70 static const gdk_key gdk_keys_by_keyval[] = {
82 print " { $keyval, $offset }";
88 @keys = sort { $a->[1] cmp $b->[1] } @keys;
92 static const gdk_key gdk_keys_by_name[] = {
104 print " { $keyval, $offset }";
115 * Translators, the strings in the 'keyboard label' context are
116 * display names for keyboard keys. Some of them have prefixes like
117 * XF86 or ISO_ - these should be removed in the translation. Similarly,
118 * underscores should be replaced by spaces. The prefix 'KP_' stands
119 * for 'key pad' and you may want to include that in your translation.
120 * Here are some examples of English translations:
121 * XF86AudioMute - Audio mute
122 * Scroll_lock - Scroll lock
123 * KP_Space - Space (keypad)
127 for $key (@translate) {
128 if ($key eq 'KP_Space') {
129 print "/* Translators: KP_ means 'key pad' here */\n";
131 if ($key eq 'XF86MonBrightnessUp') {
132 print "/* Translators: 'Mon' means Monitor here, and the XF86 prefix should be removed */\n";
135 NC_("keyboard label", "$key")