diff options
author | Matthias Clasen <mclasen@redhat.com> | 2005-06-10 06:41:04 +0000 |
---|---|---|
committer | Matthias Clasen <matthiasc@src.gnome.org> | 2005-06-10 06:41:04 +0000 |
commit | 79d82223a23527721dcc72cf973e1c3075eb1a20 (patch) | |
tree | bb55babc5850c7e50227366ebbd179ab78260cb9 /gtk/gtkaccellabel.c | |
parent | ab44ea2b8cbe72aee536ef478a95c6b0c445a376 (diff) | |
download | gtk+-79d82223a23527721dcc72cf973e1c3075eb1a20.tar.gz |
Generate N_() calls for translatable key names.
2005-06-10 Matthias Clasen <mclasen@redhat.com>
* gdk/gen-keyname-table.pl: Generate N_() calls for
translatable key names.
* gdk/keynames.txt: Mark some key names as translatable.
* gdk/keyname-table.h: Regenerated.
* gtk/gtkaccellabel.c (gtk_accel_label_class_init): Add
some context to the msg ids for keyboard modifiers and
key names.
(_gtk_accel_label_class_get_accelerator_label): Try to
translate key names. (#300224, Christian Rose)
Diffstat (limited to 'gtk/gtkaccellabel.c')
-rw-r--r-- | gtk/gtkaccellabel.c | 34 |
1 files changed, 24 insertions, 10 deletions
diff --git a/gtk/gtkaccellabel.c b/gtk/gtkaccellabel.c index c60f308cd9..88f9dad49b 100644 --- a/gtk/gtkaccellabel.c +++ b/gtk/gtkaccellabel.c @@ -116,20 +116,23 @@ gtk_accel_label_class_init (GtkAccelLabelClass *class) * that use the shift key. If the text on this key isn't typically * translated on keyboards used for your language, don't translate * this. + * And do not translate the part before the |. */ - class->mod_name_shift = g_strdup (_("Shift")); + class->mod_name_shift = g_strdup (Q_("keyboard label|Shift")); /* This is the text that should appear next to menu accelerators * that use the control key. If the text on this key isn't typically * translated on keyboards used for your language, don't translate * this. + * And do not translate the part before the |. */ - class->mod_name_control = g_strdup (_("Ctrl")); + class->mod_name_control = g_strdup (Q_("keyboard label|Ctrl")); /* This is the text that should appear next to menu accelerators * that use the alt key. If the text on this key isn't typically * translated on keyboards used for your language, don't translate * this. + * And do not translate the part before the |. */ - class->mod_name_alt = g_strdup (_("Alt")); + class->mod_name_alt = g_strdup (Q_("keyboard label|Alt")); class->mod_separator = g_strdup ("+"); class->accel_seperator = g_strdup (" / "); class->latin1_to_char = TRUE; @@ -570,10 +573,12 @@ _gtk_accel_label_class_get_accelerator_label (GtkAccelLabelClass *klass, switch (ch) { case ' ': - g_string_append (gstring, "Space"); + /* do not translate the part before the | */ + g_string_append (gstring, Q_("keyboard label|Space")); break; case '\\': - g_string_append (gstring, "Backslash"); + /* do not translate the part before the | */ + g_string_append (gstring, Q_("keyboard label|Backslash")); break; default: g_string_append_unichar (gstring, g_unichar_toupper (ch)); @@ -583,13 +588,22 @@ _gtk_accel_label_class_get_accelerator_label (GtkAccelLabelClass *klass, else { gchar *tmp; - - tmp = gtk_accelerator_name (accelerator_key, 0); - if (tmp[0] != 0 && tmp[1] == 0) + + tmp = gdk_keyval_name (gdk_keyval_to_lower (accelerator_key)); + if (tmp == NULL) + tmp = ""; + else if (tmp[0] != 0 && tmp[1] == 0) tmp[0] = g_ascii_toupper (tmp[0]); - substitute_underscores (tmp); + else + { + gchar msg[128]; + + strcpy (msg, "keyboard label|"); + g_strlcat (msg, tmp, 128); + tmp = g_strip_context (msg, dgettext (GETTEXT_PACKAGE, msg)); + substitute_underscores (tmp); + } g_string_append (gstring, tmp); - g_free (tmp); } return g_string_free (gstring, FALSE); |