Include gettext support. Mark warnings for possible translation. Add.
authorNalin Dahyabhai <nalin@src.gnome.org>
Mon, 10 Jun 2002 19:35:31 +0000 (19:35 +0000)
committerNalin Dahyabhai <nalin@src.gnome.org>
Mon, 10 Jun 2002 19:35:31 +0000 (19:35 +0000)
* Makefile.am, configure.in: Include gettext support.
* src/pty.c, src/reaper.c, src/trie.c, src/vte.c: Mark warnings for possible
translation.
* po/POTFILES.in, po/vte.pot: Add.

19 files changed:
ChangeLog
Makefile.am
autogen.sh
configure.in
po/POTFILES.in [new file with mode: 0644]
po/vte.pot [new file with mode: 0644]
src/caps.h
src/debug.h
src/pty.c
src/pty.h
src/reaper.c
src/ring.h
src/termcap.h
src/trie.c
src/trie.h
src/vte.c
src/vte.h
src/vteaccess.c
src/vteaccess.h

index 614e9b7..08d0cc4 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,7 +1,10 @@
 2002-06-07 nalin
+       * Makefile.am, configure.in: Include gettext support.
        * src/vte.c: Center characters in their cells, caching their extents.
        Finish merging otaylor's Xft2 patch (oops).
        * src/vte.c, src/vte.h: Expose vte_terminal_set_encoding().
+       * src/pty.c, src/reaper.c, src/trie.c, src/vte.c: Mark warnings for
+       possible translation.
 2002-06-06 nalin
        * src/vte.c, src/vte.h: Add get_cursor_position(). Remove get_snapshot()
        and free_shapshot().
index cb0197f..6ba5356 100644 (file)
@@ -1,4 +1,4 @@
-SUBDIRS = src termcaps
+SUBDIRS = src termcaps po
 EXTRA_DIST = HACKING vte.spec vte.pc.in
 
 pkgconfigdir = $(libdir)/pkgconfig
index 40a610a..46db892 100755 (executable)
@@ -71,6 +71,7 @@ case $CC in
 esac
 
 libtoolize -f -c
+glib-gettextize -f -c
 aclocal $ACLOCAL_FLAGS
 
 # optionally feature autoheader
index d65d79a..c44e155 100644 (file)
@@ -2,6 +2,7 @@ AC_INIT(configure.in)
 VERSION=`grep ^Version: $srcdir/vte.spec | awk '{print $NF}'`
 AM_INIT_AUTOMAKE(vte,$VERSION)
 AM_PROG_LIBTOOL
+AM_GLIB_GNU_GETTEXT
 AC_EGREP_CPP(glibc,
                [
                 #include <stdio.h>
@@ -72,6 +73,11 @@ if test x$prefix = xNONE ; then
 fi
 AC_DEFINE_UNQUOTED(DATADIR,"$mydatadir",
                    [The location where arch-independent package-specific data can be found.])
+AC_DEFINE_UNQUOTED(LOCALEDIR,"$mydatadir/locale",
+                   [The location where locale data can be found.])
+
+GETTEXT_PACKAGE="$PACKAGE"
+AC_SUBST(GETTEXT_PACKAGE)
 
 AM_CONFIG_HEADER(config.h)
-AC_OUTPUT([Makefile src/Makefile termcaps/Makefile vte.pc])
+AC_OUTPUT([Makefile src/Makefile termcaps/Makefile po/Makefile.in vte.pc])
diff --git a/po/POTFILES.in b/po/POTFILES.in
new file mode 100644 (file)
index 0000000..8444b94
--- /dev/null
@@ -0,0 +1,4 @@
+src/pty.c
+src/reaper.c
+src/trie.c
+src/vte.c
diff --git a/po/vte.pot b/po/vte.pot
new file mode 100644 (file)
index 0000000..326bb7f
--- /dev/null
@@ -0,0 +1,117 @@
+# SOME DESCRIPTIVE TITLE.
+# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
+# This file is distributed under the same license as the PACKAGE package.
+# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
+#
+#, fuzzy
+msgid ""
+msgstr ""
+"Project-Id-Version: PACKAGE VERSION\n"
+"POT-Creation-Date: 2002-06-10 15:34-0400\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
+"Language-Team: LANGUAGE <LL@li.org>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=CHARSET\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: src/pty.c:101
+#, c-format
+msgid "Error adding `%s' to environment, continuing."
+msgstr ""
+
+#: src/reaper.c:106
+msgid "Error creating signal pipe."
+msgstr ""
+
+#: src/trie.c:386
+#, c-format
+msgid "Duplicate (%s/%s)!"
+msgstr ""
+
+#: src/vte.c:780
+#, c-format
+msgid "Error compiling regular expression \"%s\"."
+msgstr ""
+
+#: src/vte.c:4082
+#, c-format
+msgid "Got unexpected (key?) sequence `%s'."
+msgstr ""
+
+#: src/vte.c:4683
+#, c-format
+msgid "Character %5ld is %d columns wide, guessing 1."
+msgstr ""
+
+#: src/vte.c:4876
+#, c-format
+msgid "No handler for control sequence `%s' defined."
+msgstr ""
+
+#. Be conservative about discarding data.
+#: src/vte.c:5090
+#, c-format
+msgid "Invalid multibyte sequence detected.  Munging up %d bytes of data."
+msgstr ""
+
+#: src/vte.c:5504
+#, c-format
+msgid "Error reading from child: %s."
+msgstr ""
+
+#: src/vte.c:5672
+#, c-format
+msgid "Error (%s) converting data for child, dropping."
+msgstr ""
+
+#: src/vte.c:7158
+#, c-format
+msgid ""
+"Warning: using fontset \"%s\", which is missing these character sets: %s."
+msgstr ""
+
+#: src/vte.c:7523
+#, c-format
+msgid "Failed to load Xft font pattern \"%s\", falling back to default font."
+msgstr ""
+
+#: src/vte.c:7536
+msgid "Failed to load default Xft font."
+msgstr ""
+
+#: src/vte.c:7575
+msgid "Error allocating Xft font, disabling Xft."
+msgstr ""
+
+#: src/vte.c:7599
+#, c-format
+msgid "Failed to load font set \"%s\", falling back to default font."
+msgstr ""
+
+#: src/vte.c:7611
+msgid "Failed to load default font, crashing or behaving abnormally."
+msgstr ""
+
+#: src/vte.c:7692
+#, c-format
+msgid "Error reading PTY size, using defaults: %s."
+msgstr ""
+
+#: src/vte.c:7713
+#, c-format
+msgid "Error setting PTY size: %s."
+msgstr ""
+
+#: src/vte.c:9537
+msgid "Error allocating layout, disabling Pango."
+msgstr ""
+
+#: src/vte.c:9547
+msgid "Error allocating draw, disabling Xft."
+msgstr ""
+
+#. Aaargh.  We're screwed.
+#: src/vte.c:10729
+msgid "g_iconv_open() failed setting word characters"
+msgstr ""
index 32d5095..cdc8f5b 100644 (file)
@@ -16,8 +16,8 @@
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 
-#ifndef caps_h
-#define caps_h
+#ifndef vte_caps_h_included
+#define vte_caps_h_included
 
 #ident "$Id$"
 
index 6a89aac..f22ff7e 100644 (file)
@@ -18,8 +18,8 @@
 
 #ident "$Id$"
 
-#ifndef debug_h
-#define debug_h
+#ifndef vte_debug_h_included
+#define vte_debug_h_included
 
 typedef enum {
        VTE_DEBUG_MISC    = 1 << 0,
index 53d367f..82cad92 100644 (file)
--- a/src/pty.c
+++ b/src/pty.c
 #include "debug.h"
 #include "pty.h"
 
+#ifdef ENABLE_NLS
+#include <libintl.h>
+#define _(String) dgettext(PACKAGE, String)
+#else
+#define _(String) String
+#endif
+
 /* Open the named PTY slave, fork off a child (storing its PID in child),
  * and exec the named command in its own session as a process group leader */
 static int
@@ -91,8 +98,8 @@ vte_pty_fork_on_fd(const char *path, const char **env_add,
        /* Set any environment variables. */
        for (i = 0; (env_add != NULL) && (env_add[i] != NULL); i++) {
                if (putenv(g_strdup(env_add[i])) != 0) {
-                       g_warning("Error adding `%s' to environment, "
-                                 "continuing.", env_add[i]);
+                       g_warning(_("Error adding `%s' to environment, "
+                                   "continuing."), env_add[i]);
                }
 #ifdef VTE_DEBUG
                if (vte_debug_on(VTE_DEBUG_MISC)) {
index b8e14e1..8f1675a 100644 (file)
--- a/src/pty.h
+++ b/src/pty.h
@@ -16,8 +16,8 @@
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 
-#ifndef pty_h_included
-#define pty_h_included
+#ifndef vte_pty_h_included
+#define vte_pty_h_included
 
 #ident "$Id$"
 
index dbde87d..9fb6f88 100644 (file)
 #include "marshal.h"
 #include "reaper.h"
 
+#ifdef HAVE_LOCALE_H
+#include <locale.h>
+#else
+#define bindtextdomain(package,dir)
+#endif
+
+#ifdef ENABLE_NLS
+#include <libintl.h>
+#define _(String) dgettext(PACKAGE, String)
+#else
+#define _(String) String
+#endif
+
 static VteReaper *singleton_reaper = NULL;
 struct reaper_info {
        int signum;
@@ -90,7 +103,7 @@ vte_reaper_init(VteReaper *reaper, gpointer *klass)
        int ret;
        ret = pipe(reaper->iopipe);
        if (ret == -1) {
-               g_error("Error creating signal pipe.");
+               g_error(_("Error creating signal pipe."));
        }
        action.sa_handler = vte_reaper_signal_handler;
        sigemptyset(&action.sa_mask);
@@ -108,6 +121,7 @@ vte_reaper_init(VteReaper *reaper, gpointer *klass)
 static void
 vte_reaper_class_init(VteReaperClass *klass, gpointer data)
 {
+       bindtextdomain(PACKAGE, LOCALEDIR);
        klass->child_exited_signal = g_signal_new("child-exited",
                                                  G_OBJECT_CLASS_TYPE(klass),
                                                  G_SIGNAL_RUN_LAST,
index c14e5ad..7b18adc 100644 (file)
@@ -16,8 +16,8 @@
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 
-#ifndef ring_h_included
-#define ring_h_included
+#ifndef vte_ring_h_included
+#define vte_ring_h_included
 
 #ident "$Id$"
 
index 64f9882..f564f3c 100644 (file)
@@ -16,8 +16,8 @@
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 
-#ifndef termcap_h
-#define termcap_h
+#ifndef vte_termcap_h_included
+#define vte_termcap_h_included
 
 #ident "$Id$"
 
index a03da85..276ff22 100644 (file)
 #include "debug.h"
 #include "trie.h"
 
+#ifdef ENABLE_NLS
+#include <libintl.h>
+#define _(String) dgettext(PACKAGE, String)
+#else
+#define _(String) String
+#endif
+
 #ifndef TRIE_MAYBE_STATIC
 #define TRIE_MAYBE_STATIC
 #endif
@@ -376,7 +383,7 @@ vte_trie_addx(struct vte_trie *trie, wchar_t *pattern, size_t length,
                } else {
 #ifdef VTE_DEBUG
                        if (vte_debug_on(VTE_DEBUG_PARSE)) {
-                               g_warning("Duplicate (%s/%s)!",
+                               g_warning(_("Duplicate (%s/%s)!"),
                                          result, trie->result);
                        }
 #endif
index 84d8dbf..c4c6428 100644 (file)
@@ -16,8 +16,8 @@
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 
-#ifndef trie_h
-#define trie_h
+#ifndef vte_trie_h_included
+#define vte_trie_h_included
 
 #ident "$Id$"
 
index 704ccc0..5a2df9f 100644 (file)
--- a/src/vte.c
+++ b/src/vte.c
 #include <X11/Xft/Xft.h>
 #endif
 
+#ifdef HAVE_LOCALE_H
+#include <locale.h>
+#else
+#define bindtextdomain(package,dir)
+#endif
+
+#ifdef ENABLE_NLS
+#include <libintl.h>
+#define _(String) dgettext(PACKAGE, String)
+#else
+#define _(String) String
+#endif
+
 #define VTE_TAB_WIDTH                  8
 #define VTE_LINE_WIDTH                 1
 #define VTE_COLOR_SET_SIZE             8
@@ -764,7 +777,8 @@ vte_terminal_match_add(VteTerminal *terminal, const char *match)
        memset(&regex, 0, sizeof(regex));
        ret = regcomp(&regex.reg, match, REG_EXTENDED);
        if (ret != 0) {
-               g_warning("Error compiling regular expression \"%s\".", match);
+               g_warning(_("Error compiling regular expression \"%s\"."),
+                         match);
                return -1;
        }
        regex.tag = terminal->pvt->match_regexes->len;
@@ -4065,7 +4079,7 @@ vte_sequence_handler_complain_key(VteTerminal *terminal,
                                  GValueArray *params)
 {
        g_return_if_fail(VTE_IS_TERMINAL(terminal));
-       g_warning("Got unexpected (key?) sequence `%s'.\n",
+       g_warning(_("Got unexpected (key?) sequence `%s'."),
                  match ? match : "???");
 }
 
@@ -4666,7 +4680,7 @@ vte_terminal_insert_char(GtkWidget *widget, wchar_t c, gboolean force_insert)
 
        /* FIXME: find why this can happen, and stop it. */
        if (columns < 0) {
-               g_warning("Character %5ld is %d columns wide, guessing 1.\n",
+               g_warning(_("Character %5ld is %d columns wide, guessing 1."),
                          c, columns);
                columns = 1;
        }
@@ -4859,7 +4873,7 @@ vte_terminal_handle_sequence(GtkWidget *widget,
                /* Let the handler handle it. */
                handler(terminal, match_s, match, params);
        } else {
-               g_warning("No handler for control sequence `%s' defined.\n",
+               g_warning(_("No handler for control sequence `%s' defined."),
                          match_s);
        }
 
@@ -5073,7 +5087,7 @@ vte_terminal_process_incoming(gpointer data)
                                        }
                                }
                                /* Be conservative about discarding data. */
-                               g_warning("Invalid multibyte sequence detected.  Munging up %d bytes of data.", end - start);
+                               g_warning(_("Invalid multibyte sequence detected.  Munging up %d bytes of data."), end - start);
                                /* Remove the offending bytes. */
                                for (i = start; i < end; i++) {
 #ifdef VTE_DEBUG
@@ -5487,8 +5501,8 @@ vte_terminal_io_read(GIOChannel *channel,
                                        leave_open = TRUE;
                                        break;
                                default:
-                                       g_warning("Error reading from child: "
-                                                 "%s.\n", strerror(errno));
+                                       g_warning(_("Error reading from child: "
+                                                   "%s."), strerror(errno));
                                        leave_open = TRUE;
                                        break;
                        }
@@ -5655,7 +5669,7 @@ vte_terminal_send(VteTerminal *terminal, const char *encoding,
        obuf = obufptr = g_malloc0(ocount);
 
        if (g_iconv(*conv, &ibuf, &icount, &obuf, &ocount) == -1) {
-               g_warning("Error (%s) converting data for child, dropping.\n",
+               g_warning(_("Error (%s) converting data for child, dropping."),
                          strerror(errno));
        } else {
                n_outgoing = terminal->pvt->n_outgoing + (obuf - obufptr);
@@ -7141,8 +7155,8 @@ vte_terminal_font_complain(const char *font,
                        charsets = tmp;
                        tmp = NULL;
                }
-               g_warning("Warning: using fontset \"%s\", which is missing "
-                         "these character sets: %s.\n", font, charsets);
+               g_warning(_("Warning: using fontset \"%s\", which is missing "
+                           "these character sets: %s."), font, charsets);
                g_free(charsets);
        }
 }
@@ -7506,8 +7520,8 @@ vte_terminal_set_font(VteTerminal *terminal,
 
                if (new_font == NULL) {
                        name = vte_unparse_xft_pattern(matched_pattern);
-                       g_warning("Failed to load Xft font pattern \"%s\", "
-                                 "falling back to default font.", name);
+                       g_warning(_("Failed to load Xft font pattern \"%s\", "
+                                   "falling back to default font."), name);
                        free(name);
 
                        /* Try to use the default font. */
@@ -7519,7 +7533,7 @@ vte_terminal_set_font(VteTerminal *terminal,
                                               0);
                }
                if (new_font == NULL) {
-                       g_warning("Failed to load default Xft font.");
+                       g_warning(_("Failed to load default Xft font."));
                }
 
                g_assert (pattern != new_font->pattern);
@@ -7558,7 +7572,7 @@ vte_terminal_set_font(VteTerminal *terminal,
                                        strlen(VTE_REPRESENTATIVE_CHARACTERS));
                        /* width = terminal->pvt->ftfont->max_advance_width; */
                } else {
-                       g_warning("Error allocating Xft font, disabling Xft.");
+                       g_warning(_("Error allocating Xft font, disabling Xft."));
                        terminal->pvt->use_xft = FALSE;
                }
        }
@@ -7582,8 +7596,8 @@ vte_terminal_set_font(VteTerminal *terminal,
                        vte_terminal_font_complain(xlfds, missing_charset_list,
                                                   missing_charset_count);
                } else {
-                       g_warning("Failed to load font set \"%s\", "
-                                 "falling back to default font.", xlfds);
+                       g_warning(_("Failed to load font set \"%s\", "
+                                   "falling back to default font."), xlfds);
                        if (missing_charset_list != NULL) {
                                XFreeStringList(missing_charset_list);
                                missing_charset_list = NULL;
@@ -7594,8 +7608,8 @@ vte_terminal_set_font(VteTerminal *terminal,
                                                                &missing_charset_count,
                                                                &def_string);
                        if (terminal->pvt->fontset == NULL) {
-                               g_warning("Failed to load default font, "
-                                         "crashing or behaving abnormally.\n");
+                               g_warning(_("Failed to load default font, "
+                                           "crashing or behaving abnormally."));
                        } else {
                                vte_terminal_font_complain(xlfds,
                                                           missing_charset_list,
@@ -7675,8 +7689,8 @@ vte_terminal_get_size(VteTerminal *terminal)
        if (terminal->pvt->pty_master != -1) {
                /* Use an ioctl to read the size of the terminal. */
                if (ioctl(terminal->pvt->pty_master, TIOCGWINSZ, &size) != 0) {
-                       g_warning("Error reading PTY size, using defaults: "
-                                 "%s.", strerror(errno));
+                       g_warning(_("Error reading PTY size, using defaults: "
+                                   "%s."), strerror(errno));
                } else {
                        terminal->row_count = size.ws_row;
                        terminal->column_count = size.ws_col;
@@ -7696,8 +7710,8 @@ vte_terminal_set_size(VteTerminal *terminal, long columns, long rows)
                size.ws_col = columns;
                /* Try to set the terminal size. */
                if (ioctl(terminal->pvt->pty_master, TIOCSWINSZ, &size) != 0) {
-                       g_warning("Error setting PTY size: %s.",
-                                 strerror(errno));
+                       g_warning(_("Error setting PTY size: %s."),
+                                   strerror(errno));
                }
        } else {
                terminal->row_count = rows;
@@ -9520,7 +9534,7 @@ vte_terminal_paint(GtkWidget *widget, GdkRectangle *area)
                layout = terminal->pvt->layout;
 
                if (layout == NULL) {
-                       g_warning("Error allocating layout, disabling Pango.");
+                       g_warning(_("Error allocating layout, disabling Pango."));
                        terminal->pvt->use_pango = FALSE;
                }
        }
@@ -9530,7 +9544,7 @@ vte_terminal_paint(GtkWidget *widget, GdkRectangle *area)
        if (terminal->pvt->use_xft) {
                ftdraw = XftDrawCreate(display, drawable, visual, colormap);
                if (ftdraw == NULL) {
-                       g_warning("Error allocating draw, disabling Xft.");
+                       g_warning(_("Error allocating draw, disabling Xft."));
                        terminal->pvt->use_xft = FALSE;
                }
        }
@@ -9894,6 +9908,8 @@ vte_terminal_class_init(VteTerminalClass *klass, gconstpointer data)
        GObjectClass *gobject_class;
        GtkWidgetClass *widget_class;
 
+       bindtextdomain(PACKAGE, LOCALEDIR);
+
        gobject_class = G_OBJECT_CLASS(klass);
        widget_class = GTK_WIDGET_CLASS(klass);
 
@@ -10710,7 +10726,7 @@ vte_terminal_set_word_chars(VteTerminal *terminal, const char *spec)
        conv = g_iconv_open("WCHAR_T", "UTF-8");
        if (conv == NULL) {
                /* Aaargh.  We're screwed. */
-               g_warning("g_iconv_open() failed setting word characters");
+               g_warning(_("g_iconv_open() failed setting word characters"));
                return;
        }
        ilen = strlen(spec);
index 142a52e..b51fe03 100644 (file)
--- a/src/vte.h
+++ b/src/vte.h
@@ -16,8 +16,8 @@
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 
-#ifndef vte_h_included
-#define vte_h_included
+#ifndef vte_vte_h_included
+#define vte_vte_h_included
 
 #ident "$Id$"
 
index 2232d6f..831ca86 100644 (file)
 #include "vte.h"
 #include "vteaccess.h"
 
+#ifdef HAVE_LOCALE_H
+#include <locale.h>
+#else
+#define bindtextdomain(package,dir)
+#endif
+
 #define VTE_TERMINAL_ACCESSIBLE_PRIVATE_DATA "VteTerminalAccessiblePrivateData"
 typedef struct _VteTerminalAccessiblePrivate {
        gboolean snapshot_invalid;      /* This data needs to be refreshed. */
@@ -829,6 +835,8 @@ vte_terminal_accessible_class_init(gpointer *klass)
 {
         GObjectClass *gobject_class; 
 
+       bindtextdomain(PACKAGE, LOCALEDIR);
+
         gobject_class = G_OBJECT_CLASS(klass); 
 
        /* Override the finalize method. */
index cb1d492..a209ac0 100644 (file)
@@ -16,8 +16,8 @@
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 
-#ifndef vteaccess_h_included
-#define vteaccess_h_included
+#ifndef vte_vteaccess_h_included
+#define vte_vteaccess_h_included
 
 #ident "$Id$"