81
/* get the language code in a static allocated buffer
82
* short_form: only return the languagecode if true, otherwise
83
* languagecode_countrycode
85
char* get_lang_code(gboolean short_form)
87
/* make own private copy */
88
static gchar locale[51];
89
strncpy(locale, setlocale(LC_MESSAGES, NULL), 50);
91
// FIXME: we need to be more inteligent here
92
// _and_ we probably want to look into the "LANGUAGE" enviroment too
103
* get a i18n field of the rfc822 header
104
* Return Value: a pointer that must not be freed (part of the rfc822 struct)
106
char *hook_file_lookup_i18n(struct rfc822_header *rfc822, char *field)
110
/* try $field-$languagecode_$countrycode first */
111
s = g_strdup_printf("%s-%s", field, get_lang_code(FALSE));
112
entry = rfc822_header_lookup(rfc822, s);
113
//g_print("Looking for: %s ; found: %s\n",s,entry);
118
/* try $field-$languagecode next */
119
s = g_strdup_printf("%s-%s", field, get_lang_code(TRUE));
120
//g_print("Looking for: %s ; found: %s\n",s,entry);
121
entry = rfc822_header_lookup(rfc822, s);
126
/* if everything else fails ... return untranslated */
127
return rfc822_header_lookup(rfc822, field);
131
* show the given hook file
80
133
void show_one_hook(TrayApplet *ta, gchar *hook_file)
82
135
HookDialog *hook_dialog = (HookDialog *)ta->user_data;
112
165
gtk_widget_hide(button_run);
115
char *name = rfc822_header_lookup(rfc822, "Name");
116
char *description = rfc822_header_lookup(rfc822, "Description");
168
char *name = hook_file_lookup_i18n(rfc822, "Name");
169
char *description = hook_file_lookup_i18n(rfc822, "Description");
117
170
char *s = g_strdup_printf("%s\n\n%s\n",name, description);
118
171
gtk_text_buffer_set_text(buf, s, -1);