summaryrefslogtreecommitdiffstats
path: root/src/util/et/error_message.c
diff options
context:
space:
mode:
authorGreg Hudson <ghudson@mit.edu>2011-06-10 18:17:22 +0000
committerGreg Hudson <ghudson@mit.edu>2011-06-10 18:17:22 +0000
commitcb8b1138d6e349a77507f3c561fc7ee2dde5cd7c (patch)
treead5246d1ab834f44aa9a5de30b255d9f044c9663 /src/util/et/error_message.c
parentfd2f45cf93bfbf10863011fb1a61fc08041c2f51 (diff)
downloadkrb5-cb8b1138d6e349a77507f3c561fc7ee2dde5cd7c.tar.gz
krb5-cb8b1138d6e349a77507f3c561fc7ee2dde5cd7c.tar.xz
krb5-cb8b1138d6e349a77507f3c561fc7ee2dde5cd7c.zip
Add localization support to com_err
* Add compile_et arguments --textdomain and --localedir. * Store text domain and localedir at the end of error tables. * error_message() calls dgettext if the table has a text domain. * add_error_table() calls bindtextdomain if the table has a localedir. * Define N_() as no-op in generated source and mark up error messages. * When using system compile_et, test for --textdomain support. * Use --textdomain option when available. * Run xgettext over generated sources in compile_et rule. * Translate com_err results in krb5int_get_error() if com_err won't. ticket: 6918 git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@24960 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src/util/et/error_message.c')
-rw-r--r--src/util/et/error_message.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/util/et/error_message.c b/src/util/et/error_message.c
index 35d58f306..01f2c03ca 100644
--- a/src/util/et/error_message.c
+++ b/src/util/et/error_message.c
@@ -185,7 +185,11 @@ found:
if (table->n_msgs <= (unsigned int) offset)
goto no_table_found;
- return table->msgs[offset];
+ /* If there's a string at the end of the table, it's a text domain. */
+ if (table->msgs[table->n_msgs] != NULL)
+ return dgettext(table->msgs[table->n_msgs], table->msgs[offset]);
+ else
+ return table->msgs[offset];
no_table_found:
k5_mutex_unlock(&et_list_lock);
@@ -290,6 +294,12 @@ add_error_table(const struct error_table *et)
}
e->next = et_list;
et_list = e;
+
+ /* If there are two strings at the end of the table, they are a text domain
+ * and locale dir, and we are supposed to call bindtextdomain. */
+ if (et->msgs[et->n_msgs] != NULL && et->msgs[et->n_msgs + 1] != NULL)
+ bindtextdomain(et->msgs[et->n_msgs], et->msgs[et->n_msgs + 1]);
+
return k5_mutex_unlock(&et_list_lock);
}