? _build
? plugins-l10n-strings.patch
? docs/reference/tmpl/gedit-enum-types.sgml
? gedit/gedit-document-loader-local.c
? gedit/gedit-document-loader-orig.c
? gedit/gedit-document-loader-orig.h
? gedit/gedit-document-loader-vfs.c
? plugins/externaltools/data/Makefile.in
? plugins/externaltools/scripts/Makefile.in
? plugins/externaltools/tools/toolmenu.py
Index: configure.ac
===================================================================
RCS file: /cvs/gnome/gedit/configure.ac,v
retrieving revision 1.54
diff -u -p -B -r1.54 configure.ac
--- configure.ac	19 Dec 2006 01:53:00 -0000	1.54
+++ configure.ac	25 Dec 2006 20:50:19 -0000
@@ -315,6 +315,7 @@ plugins/docinfo/Makefile
 plugins/externaltools/Makefile
 plugins/externaltools/tools/Makefile
 plugins/externaltools/data/Makefile
+plugins/externaltools/scripts/Makefile
 plugins/filebrowser/Makefile
 plugins/indent/Makefile
 plugins/Makefile
Index: plugins/externaltools/Makefile.am
===================================================================
RCS file: /cvs/gnome/gedit/plugins/externaltools/Makefile.am,v
retrieving revision 1.2
diff -u -p -B -r1.2 Makefile.am
--- plugins/externaltools/Makefile.am	19 Nov 2006 21:28:09 -0000	1.2
+++ plugins/externaltools/Makefile.am	25 Dec 2006 20:50:19 -0000
@@ -1,5 +1,5 @@
-# Python snippets plugin
-SUBDIRS = tools data
+# External Tools plugin
+SUBDIRS = tools data scripts
 plugindir = $(libdir)/gedit-2/plugins
 
 plugin_in_files = externaltools.gedit-plugin.desktop.in
Index: plugins/externaltools/data/Makefile.am
===================================================================
RCS file: /cvs/gnome/gedit/plugins/externaltools/data/Makefile.am,v
retrieving revision 1.1
diff -u -p -B -r1.1 Makefile.am
--- plugins/externaltools/data/Makefile.am	19 Nov 2006 21:28:10 -0000	1.1
+++ plugins/externaltools/data/Makefile.am	25 Dec 2006 20:50:19 -0000
@@ -1,10 +1,23 @@
 # Python snippets plugin
-tools_SCRIPTS = \
-	open-terminal-here \
-	build \
-	remove-trailing-spaces \
-	run-command
-	
+
+INTL_EXTRACT=../scripts/gedit-tool-intl-extract.py
+INTL_MERGE=$(srcdir)/../scripts/gedit-tool-intl-merge.py
+
+tools_in_files = \
+	open-terminal-here.tool.in \
+	build.tool.in \
+	remove-trailing-spaces.tool.in \
+	run-command.tool.in
+tools_SCRIPTS = $(tools_in_files:.tool.in=.tool)
 toolsdir = $(datadir)/gedit-2/plugins/tools
 
-EXTRA_DIST = $(tools_SCRIPTS)
+# Custom i18n stuff of the death
+gettext_strings.h: $(tools_in_files) $(INTL_EXTRACT)
+	(cd $(srcdir) && $(INTL_EXTRACT) $(tools_in_files)) > $@
+
+%.tool: %.tool.in $(INTL_MERGE) $(wildcard $(top_srcdir)/po/*.po)
+	LC_ALL=C $(INTL_MERGE) -o $@ -c ./gedit-intl-merge-cache $(top_srcdir)/po $<
+	chmod --reference=$< $@
+
+EXTRA_DIST = $(tools_in_files)
+CLEAN_FILES = $(tools_SCRIPTS)
Index: plugins/externaltools/data/build
===================================================================
RCS file: plugins/externaltools/data/build
diff -N plugins/externaltools/data/build
--- plugins/externaltools/data/build	19 Nov 2006 21:28:10 -0000	1.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,14 +0,0 @@
-#!/bin/sh
-
-# [Gedit Tool]
-# Name=Build
-# Comment=Run "make" in the document directory
-# Input=nothing
-# Output=output-panel
-# Shortcut=F8
-# Applicability=local
-##MimeType=
-##Exec=fooview %F
-##Icon=fooview.png
-##Terminal= : wheter to show it in the bottom panel (default: true)
-make
Index: plugins/externaltools/data/build.tool.in
===================================================================
RCS file: plugins/externaltools/data/build.tool.in
diff -N plugins/externaltools/data/build.tool.in
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ plugins/externaltools/data/build.tool.in	25 Dec 2006 20:50:19 -0000
@@ -0,0 +1,14 @@
+#!/bin/sh
+
+# [Gedit Tool]
+# _Name=Build
+# _Comment=Run "make" in the document directory
+# Input=nothing
+# Output=output-panel
+# Shortcut=F8
+# Applicability=local
+##MimeType=
+##Exec=fooview %F
+##Icon=fooview.png
+##Terminal= : wheter to show it in the bottom panel (default: true)
+make
Index: plugins/externaltools/data/open-terminal-here
===================================================================
RCS file: plugins/externaltools/data/open-terminal-here
diff -N plugins/externaltools/data/open-terminal-here
--- plugins/externaltools/data/open-terminal-here	19 Nov 2006 21:28:10 -0000	1.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,12 +0,0 @@
-#!/bin/sh
-
-# [Gedit Tool]
-# Name=Open Terminal Here
-# Comment=Open a terminal in the document location
-# Input=nothing
-# Output=output-panel
-# Shortcut=
-# Applicability=local
-
-#TODO: use "gconftool-2 -g /desktop/gnome/applications/terminal/exec"
-gnome-terminal --working-directory=$GEDIT_CURRENT_DOCUMENT_DIR &
Index: plugins/externaltools/data/open-terminal-here.tool.in
===================================================================
RCS file: plugins/externaltools/data/open-terminal-here.tool.in
diff -N plugins/externaltools/data/open-terminal-here.tool.in
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ plugins/externaltools/data/open-terminal-here.tool.in	25 Dec 2006 20:50:19 -0000
@@ -0,0 +1,12 @@
+#!/bin/sh
+
+# [Gedit Tool]
+# _Name=Open terminal here
+# _Comment=Open a terminal in the document location
+# Input=nothing
+# Output=output-panel
+# Shortcut=
+# Applicability=local
+
+#TODO: use "gconftool-2 -g /desktop/gnome/applications/terminal/exec"
+gnome-terminal --working-directory=$GEDIT_CURRENT_DOCUMENT_DIR &
Index: plugins/externaltools/data/remove-trailing-spaces
===================================================================
RCS file: plugins/externaltools/data/remove-trailing-spaces
diff -N plugins/externaltools/data/remove-trailing-spaces
--- plugins/externaltools/data/remove-trailing-spaces	19 Nov 2006 21:28:10 -0000	1.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,11 +0,0 @@
-#!/bin/sh
-
-# [Gedit Tool]
-# Name=Remove Trailing Spaces
-# Comment=Remove useless trailing spaces in your file
-# Input=document
-# Output=replace-document
-# Shortcut=<Alt>F12
-# Applicability=all
-
-sed 's/[[:blank:]]*$//'
Index: plugins/externaltools/data/remove-trailing-spaces.tool.in
===================================================================
RCS file: plugins/externaltools/data/remove-trailing-spaces.tool.in
diff -N plugins/externaltools/data/remove-trailing-spaces.tool.in
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ plugins/externaltools/data/remove-trailing-spaces.tool.in	25 Dec 2006 20:50:19 -0000
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+# [Gedit Tool]
+# _Name=Remove trailing spaces
+# _Comment=Remove useless trailing spaces in your file
+# Input=document
+# Output=replace-document
+# Shortcut=<Alt>F12
+# Applicability=all
+
+sed 's/[[:blank:]]*$//'
Index: plugins/externaltools/data/run-command
===================================================================
RCS file: plugins/externaltools/data/run-command
diff -N plugins/externaltools/data/run-command
--- plugins/externaltools/data/run-command	19 Nov 2006 21:28:10 -0000	1.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,12 +0,0 @@
-#!/bin/sh
-
-# [Gedit Tool]
-# Name=Run Command
-# Comment=Execute a custom command and put its output in a new document
-# Input=nothing
-# Output=new-document
-# Shortcut=
-# Applicability=all
-
-#TODO: use "gconftool-2 -g /desktop/gnome/applications/terminal/exec"
-exec `zenity --entry --title="Run command - gedit" --text="Command to run"`
Index: plugins/externaltools/data/run-command.tool.in
===================================================================
RCS file: plugins/externaltools/data/run-command.tool.in
diff -N plugins/externaltools/data/run-command.tool.in
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ plugins/externaltools/data/run-command.tool.in	25 Dec 2006 20:50:19 -0000
@@ -0,0 +1,12 @@
+#!/bin/sh
+
+# [Gedit Tool]
+# _Name=Run command
+# _Comment=Execute a custom command and put its output in a new document
+# Input=nothing
+# Output=new-document
+# Shortcut=
+# Applicability=all
+
+#TODO: use "gconftool-2 -g /desktop/gnome/applications/terminal/exec"
+exec `zenity --entry --title="Run command - gedit" --text="Command to run"`
Index: plugins/externaltools/scripts/Makefile.am
===================================================================
RCS file: plugins/externaltools/scripts/Makefile.am
diff -N plugins/externaltools/scripts/Makefile.am
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ plugins/externaltools/scripts/Makefile.am	25 Dec 2006 20:50:19 -0000
@@ -0,0 +1,3 @@
+EXTRA_DIST = \
+	gedit-tool-intl-merge.py \
+	gedit-tool-intl-extract.py
Index: plugins/externaltools/scripts/gedit-tool-intl-extract.py
===================================================================
RCS file: plugins/externaltools/scripts/gedit-tool-intl-extract.py
diff -N plugins/externaltools/scripts/gedit-tool-intl-extract.py
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ plugins/externaltools/scripts/gedit-tool-intl-extract.py	25 Dec 2006 20:50:19 -0000
@@ -0,0 +1,82 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+# gedit-tool-intl-extract.py
+# This file is part of gedit
+#
+# Copyright (C) 2006 - Steve Frécinaux <code@istique.net>
+#
+# gedit is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# gedit is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with gedit; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, 
+# Boston, MA  02110-1301  USA
+
+import sys
+import getopt
+
+def usage():
+    print "Usage: %s [OPTION]... [FILE] ..." % sys.argv[0]
+    print "Generates a C header file from a Gedit Tool file, for use with xgettext."
+
+    print """
+      -o, --output=FILE Specify the output file name. If not set, stdout will
+                        be used.
+      -a, --append      Append to output file instead of overwriting it.
+    """
+
+try:
+    opts, args = getopt.getopt(sys.argv[1:], 'ho:a', ['help', 'output=', 'append'])
+except getopt.GetoptError:
+    usage()
+    sys.exit(2)
+
+output = None
+append = False
+
+for o, a in opts:
+    if o in ('-h', '--help'):
+        usage()
+        sys.exit()
+    elif o in ('-o', '--output'):
+        output = a
+    elif o in ('-a', '--append'):
+        append = True
+
+if output is not None:
+    outfile = file(output, append and 'ab' or 'wb', 1)
+else:
+    outfile = sys.stdout
+
+
+for filename in args:
+    outfile.write('\n/* From file %s */\n' % filename)
+
+    infile = file(filename, 'rb', 1)   
+    in_block = False
+    for line in infile:
+        if not in_block:
+            in_block = line.startswith('# [Gedit Tool]')
+            continue
+        if line.startswith('##'): continue
+        if not line.startswith('# '): break
+        try:
+            (key, value) = [i.strip() for i in line[2:].split('=', 1)]
+            if key.startswith('_'):
+                outfile.write('char *s = N_("%s");\n' % value.replace('"', '\\"'))
+        except ValueError:
+            break
+    infile.close()
+
+outfile.close()
+
+# ex:ts=4:et:
Index: plugins/externaltools/scripts/gedit-tool-intl-merge.py
===================================================================
RCS file: plugins/externaltools/scripts/gedit-tool-intl-merge.py
diff -N plugins/externaltools/scripts/gedit-tool-intl-merge.py
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ plugins/externaltools/scripts/gedit-tool-intl-merge.py	25 Dec 2006 20:50:19 -0000
@@ -0,0 +1,204 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+# gedit-tool-intl-merge.py
+# This file is part of gedit
+#
+# Copyright (C) 2006 - Steve Frécinaux <code@istique.net>
+#
+# gedit is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# gedit is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with gedit; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, 
+# Boston, MA  02110-1301  USA
+
+import getopt
+import sys
+import os
+import re
+import glob
+import cPickle as pickle
+#import pickle
+
+
+def usage():
+    print "Usage: %s [OPTION]... [PO_DIRECTORY] [FILE]" % sys.argv[0]
+    print "Generates an output file that includes some localized attributes from"
+    print "an untranslated source file."
+    print """
+      -o, --output=FILE Specify the output file name. [default: stdout]
+      -c, --cache=FILE  Specify the cache file to use. [default: none]
+    """
+
+RE_POFILE_LANG      = re.compile('^.*/(.*)\.po$')
+RE_HEX_SEQUENCE     = re.compile(r'\\x([0-9a-fA-F]{2})')
+RE_OCTAL_SEQUENCE   = re.compile(r'\\([0-7]{3})')
+RE_ESCAPED_SEQUENCE = re.compile(r'(\\x[0-9a-fA-F]{2}|\\[0-7]{3}|\\.)')
+
+def pofile2lang(pofile):
+    return re.sub(RE_POFILE_LANG, '\\1', pofile)
+
+def unescape_one_sequence(sequence):
+    tr = {
+        "\\\\" : "\\",
+        "\\\"" : "\"",
+        "\\n"  : "\n",
+        "\\r"  : "\r",
+        "\\t"  : "\t",
+        "\\b"  : "\b",
+        "\\f"  : "\f",
+        "\\a"  : "\a",
+        "\\v"  : chr(11)
+    }
+    
+    if tr.has_key(sequence):
+        return tr[sequence]
+
+    m = RE_HEX_SEQUENCE.match(sequence)
+    if m:
+        print m.groups()
+        return chr(hex(m.group(1)))
+    m = RE_OCTAL_SEQUENCE.match(sequence)
+    if m: 
+        print m.groups()
+        return chr(oct(m.group(1)))
+
+    return sequence
+
+def unescape_po_string(string):
+    return RE_ESCAPED_SEQUENCE.sub(lambda m: unescape_one_sequence(m.group(1)), string)
+
+
+
+try:
+    opts, args = getopt.getopt(sys.argv[1:], 'ho:c:', ['help', 'output=', 'cache='])
+    assert len(args) >= 2
+except:
+    usage()
+    sys.exit(2)
+
+output = None
+cache = None
+
+for o, a in opts:
+    if o in ('-h', '--help'):
+        usage()
+        sys.exit()
+    elif o in ('-o', '--output'):
+        output = a
+    elif o in ('-c', '--cache'):
+        cache = a
+
+(podir, filename) = args[0:2]
+
+
+pofiles_by_lang = dict()
+update_time = 0
+for pofile in glob.glob("%s/*.po" % podir):
+    pofiles_by_lang[pofile2lang(pofile)] = pofile
+    update_time = max(update_time, os.stat(pofile)[8])
+
+RE_MSGID = re.compile(r'^msgid "((\\.|[^\\]+)*)"')
+RE_MSGSTR = re.compile(r'^msgstr "((\\.|[^\\]+)*)"')
+RE_MSGLINE = re.compile(r'^"((\\.|[^\\]+)*)"')
+
+if cache and os.path.isfile(cache) and os.stat(cache)[8] >= update_time:
+    cachefile = file(cache, 'rb')
+    translations = pickle.load(cachefile)
+    cachefile.close()
+else:
+    translations = dict()
+    for (lang, pofile) in pofiles_by_lang.iteritems():
+        fp = file(pofile, 'rb')
+
+        inmsgid = False
+        inmsgstr = False
+        msgid = ""
+        msgstr = ""
+
+        for line in fp:
+            m = RE_MSGID.match(line)
+            if m is not None:
+                if inmsgstr and msgid and msgstr:
+                    translations[(lang, msgid)] = msgstr
+                msgid = unescape_po_string(m.group(1))
+                msgstr = ""
+                inmsgid = True;
+                inmsgstr = False;
+
+            m = RE_MSGSTR.match(line)
+            if m is not None:
+                msgstr = unescape_po_string(m.group(1))
+                inmsgstr = True
+                inmsgid = False
+
+            m = RE_MSGLINE.match(line)
+            if m is not None:
+                if inmsgid:
+                    msgid += unescape_po_string(m.group(1))
+                elif inmsgstr:
+    	            msgstr += unescape_po_string(m.group(1))
+
+        if inmsgstr and msgid and msgstr:
+            translations[(lang, msgid)] = msgstr
+
+    if cache:
+        cachefile = file(cache, 'wb')
+        pickle.dump(translations, cachefile, -1)
+        cachefile.close()
+
+sys.stderr.write("Merging translations into %s.\n" % filename)
+
+def insert_translations(key, value, outfile):
+    outfile.write("# %s=%s\n" % (key, value))
+    for lang in sorted(pofiles_by_lang.iterkeys()):
+        translation = translations.get((lang, value))
+        if translation:
+            outfile.write('# %s[%s]=%s\n' % (key, lang, translation))
+
+
+infile = file(filename, 'rb', 1)
+outfile = output and file(output, 'wb') or sys.stdout
+
+in_block = False
+for line in infile:
+    if not in_block:
+        in_block = line.startswith('# [Gedit Tool]')
+        outfile.write(line)
+        continue
+    if line.startswith('##'):
+        outfile.write(line)
+        continue
+    if not line.startswith('# '):
+        outfile.write(line)
+        break
+
+    try:
+        (key, value) = [i.strip() for i in line[2:].split('=', 1)]
+    except ValueError:
+        outfile.write(line)
+        break
+
+    if key.startswith('_'):
+        insert_translations(key[1:], value, outfile)
+    else:
+        outfile.write(line)
+
+
+# Copy the remaining lines
+for line in infile:
+    outfile.write(line)
+
+infile.close()
+outfile.close()
+
+# ex:ts=4:et:
Index: plugins/externaltools/tools/library.py
===================================================================
RCS file: /cvs/gnome/gedit/plugins/externaltools/tools/library.py,v
retrieving revision 1.2
diff -u -p -B -r1.2 library.py
--- plugins/externaltools/tools/library.py	4 Dec 2006 10:48:36 -0000	1.2
+++ plugins/externaltools/tools/library.py	25 Dec 2006 20:50:19 -0000
@@ -17,6 +17,8 @@
 #    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
 import os
+import re
+import locale
 
 class ToolLibrary(object):
     _instance = None
@@ -176,6 +178,8 @@ class ToolDirectory(object):
 
 
 class Tool(object):
+    RE_KEY = re.compile('^([a-zA-Z_][a-zA-Z0-9_.\-]*)(\[([a-zA-Z_@]+)\])?$')
+
     def __init__(self, parent, filename = None):
         super(Tool, self).__init__()
         self.parent = parent
@@ -193,8 +197,10 @@ class Tool(object):
         if filename is None:
             return
 
-        fp = open(filename, 'r', 1)
+        fp = file(filename, 'r', 1)
         in_block = False
+        lang = locale.getlocale()[0]
+
         for line in fp:
             if not in_block:
                 in_block = line.startswith('# [Gedit Tool]')
@@ -201,9 +207,15 @@ class Tool(object):
                 continue
             if line.startswith('##'): continue
             if not line.startswith('# '): break
+
             try:
                 (key, value) = [i.strip() for i in line[2:].split('=', 1)]
-                self._properties[key] = value
+                m = self.RE_KEY.match(key)
+                if m.group(3) is None:
+                    if not self._properties.has_key(m.group(0)):
+                        self._properties[m.group(1)] = value
+                elif lang is not None and lang.startswith(m.group(3)):
+                    self._properties[m.group(1)] = value
             except ValueError:
                 break
         fp.close()
Index: po/POTFILES.in
===================================================================
RCS file: /cvs/gnome/gedit/po/POTFILES.in,v
retrieving revision 1.105
diff -u -p -B -r1.105 POTFILES.in
--- po/POTFILES.in	11 Dec 2006 01:37:44 -0000	1.105
+++ po/POTFILES.in	25 Dec 2006 20:50:19 -0000
@@ -53,6 +53,7 @@ plugins/externaltools/tools/functions.py
 plugins/externaltools/tools/manager.py
 plugins/externaltools/tools/outputpanel.py
 plugins/externaltools/tools/tools.glade
+plugins/externaltools/data/gettext_strings.h
 plugins/filebrowser/filebrowser.gedit-plugin.desktop.in
 plugins/filebrowser/gedit-file-browser.schemas.in
 plugins/filebrowser/gedit-file-browser-plugin.c
