From cdfa28812023db7df374c63171cf4536ef5f78ba Mon Sep 17 00:00:00 2001 From: "Ira W. Snyder" Date: Fri, 18 Jan 2008 01:22:15 -0800 Subject: [PATCH] Add gettext support to Tilda This adds proper gettext support to Tilda, so that it can be internationalized at a later date. Not all strings are marked, yet. Note that this will not work as-is, because some additional #define's are needed. They will be provided when the project is autoconfed. --- tilda-terminal.c | 5 ----- tilda.c | 7 +++++++ tilda.h | 8 ++++++++ 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/tilda-terminal.c b/tilda-terminal.c index 57f14b0..c91ee8a 100644 --- a/tilda-terminal.c +++ b/tilda-terminal.c @@ -2,11 +2,6 @@ #include "tilda-terminal.h" #include "tilda-terminal-dbus-glue.h" -// FIXME: temporary helpers for gettext -// TODO: remove these -#define _(X) X -#define N_(X) X - #define DINGUS1 "(((news|telnet|nttp|file|http|ftp|https)://)|(www|ftp)[-A-Za-z0-9]*\\.)[-A-Za-z0-9\\.]+(:[0-9]*)?" #define DINGUS2 "(((news|telnet|nttp|file|http|ftp|https)://)|(www|ftp)[-A-Za-z0-9]*\\.)[-A-Za-z0-9\\.]+(:[0-9]*)?/[-A-Za-z0-9_\\$\\.\\+\\!\\*\\(\\),;:@&=\\?/~\\#\\%]*[^]'\\.}>\\) ,\\\"]" diff --git a/tilda.c b/tilda.c index e13ca49..c712fc7 100644 --- a/tilda.c +++ b/tilda.c @@ -119,6 +119,13 @@ int main (int argc, char *argv[]) TildaWindow *tw; +#if ENABLE_NLS + /* Gettext Initialization */ + setlocale (LC_ALL, ""); + bindtextdomain (PACKAGE, LOCALEDIR); + textdomain (PACKAGE); +#endif + /* Initialize GTK+ (and the GObject system) */ gtk_init (&argc, &argv); diff --git a/tilda.h b/tilda.h index c0df133..96adfa1 100644 --- a/tilda.h +++ b/tilda.h @@ -15,6 +15,14 @@ #define debug_assert(args...) do { /* nothing */ } while (0) #endif +/* Optional gettext translation macros */ +#ifdef ENABLE_NLS + #include +#else + #define _(X) X + #define N_(X) X +#endif + /* Project-global variables */ extern DBusGConnection *dbus_connection; -- 2.25.1