[gtk+] gdk: Make gen-keyname-table.pl work again
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] gdk: Make gen-keyname-table.pl work again
- Date: Wed, 26 Oct 2011 09:37:18 +0000 (UTC)
commit aceccd581926d84cad1dfbb72e0f81158efb59a6
Author: Bastien Nocera <hadess hadess net>
Date: Tue Oct 25 14:34:27 2011 +0100
gdk: Make gen-keyname-table.pl work again
keyname-table.h was modified by hand, and gen-keyname-table.pl
couldn't be used to generate that file again.
https://bugzilla.gnome.org/show_bug.cgi?id=662628
gdk/Makefile.am | 1 +
gdk/gen-keyname-table.pl | 37 +++++++++++++++++++++++++++++++++----
gdk/keynames-translate.txt | 26 ++++++++++++++++++++++++++
3 files changed, 60 insertions(+), 4 deletions(-)
---
diff --git a/gdk/Makefile.am b/gdk/Makefile.am
index c7f24af..0c80115 100644
--- a/gdk/Makefile.am
+++ b/gdk/Makefile.am
@@ -17,6 +17,7 @@ CLEANFILES =
EXTRA_DIST += \
keynames.txt \
+ keynames-translate.txt \
keyname-table.h \
gdkkeynames.c \
gen-keyname-table.pl \
diff --git a/gdk/gen-keyname-table.pl b/gdk/gen-keyname-table.pl
index e0fe964..cc47400 100755
--- a/gdk/gen-keyname-table.pl
+++ b/gdk/gen-keyname-table.pl
@@ -1,7 +1,7 @@
#!/usr/bin/perl -w
-if (@ARGV != 1) {
- die "Usage: gen-keyname-table.pl keynames.txt > keyname-table.h\n";
+if (@ARGV != 2) {
+ die "Usage: gen-keyname-table.pl keynames.txt keynames-translate.txt > keyname-table.h\n";
}
open IN, $ARGV[0] || die "Cannot open $ARGV[0]: $!\n";
@@ -20,6 +20,18 @@ while (defined($_ = <IN>)) {
push @translate, $2;
}
}
+close IN;
+
+open IN, $ARGV[1] || die "Cannot open $ARGV[1]: $!\n";
+while (defined($_ = <IN>)) {
+ next if /^!/;
+ if (!/^\s*([\w_]*\S)\s+$/) {
+ die "Cannot parse line $_";
+ }
+
+ push @translate, $1;
+}
+close IN;
$offset = 0;
@@ -99,13 +111,30 @@ print <<EOT;
#if 0
+/*
+ * Translators, the strings in the 'keyboard label' context are
+ * display names for keyboard keys. Some of them have prefixes like
+ * XF86 or ISO_ - these should be removed in the translation. Similarly,
+ * underscores should be replaced by spaces. The prefix 'KP_' stands
+ * for 'key pad' and you may want to include that in your translation.
+ * Here are some examples of English translations:
+ * XF86AudioMute - Audio mute
+ * Scroll_lock - Scroll lock
+ * KP_Space - Space (keypad)
+ */
EOT
for $key (@translate) {
+ if ($key eq 'KP_Space') {
+ print "/* Translators: KP_ means 'key pad' here */\n";
+ }
+ if ($key eq 'XF86MonBrightnessUp') {
+ print "/* Translators: 'Mon' means Monitor here, and the XF86 prefix should be removed */\n";
+ }
print <<EOT;
-N_("keyboard label|$key")
+NC_("keyboard label", "$key")
EOT
-}
+}
print <<EOT;
diff --git a/gdk/keynames-translate.txt b/gdk/keynames-translate.txt
new file mode 100644
index 0000000..a03795c
--- /dev/null
+++ b/gdk/keynames-translate.txt
@@ -0,0 +1,26 @@
+XF86MonBrightnessUp
+XF86MonBrightnessDown
+XF86AudioMute
+XF86AudioLowerVolume
+XF86AudioRaiseVolume
+XF86AudioPlay
+XF86AudioStop
+XF86AudioNext
+XF86AudioPrev
+XF86AudioRecord
+XF86AudioPause
+XF86AudioRewind
+XF86AudioMedia
+XF86ScreenSaver
+XF86Battery
+XF86Launch1
+XF86Forward
+XF86Back
+XF86Sleep
+XF86Hibernate
+XF86WLAN
+XF86WebCam
+XF86Display
+XF86TouchpadToggle
+XF86WakeUp
+XF86Suspend
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]