? _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: ChangeLog
===================================================================
RCS file: /cvs/gnome/gedit/ChangeLog,v
retrieving revision 1.919
diff -u -p -B -r1.919 ChangeLog
--- ChangeLog	21 Dec 2006 11:16:17 -0000	1.919
+++ ChangeLog	28 Dec 2006 20:43:24 -0000
@@ -1,3 +1,40 @@
+2006-12-28  Steve Frécinaux  <code@istique.net>
+
+	Fix Bug 342042 – plugins create menus items which are not translatable.
+
+	* plugins/externaltools/tools/library.py: Support l10n of embedded
+	metadata keys, the way desktop files do.
+
+	* plugins/externaltools/data/Makefile.am:
+	* plugins/externaltools/data/build.desktop.in:
+	* plugins/externaltools/data/build.tool.in:
+	* plugins/externaltools/data/open-terminal-here.desktop.in:
+	* plugins/externaltools/data/open-terminal-here.tool.in:
+	* plugins/externaltools/data/remove-trailing-spaces.desktop.in:
+	* plugins/externaltools/data/remove-trailing-spaces.tool.in:
+	* plugins/externaltools/data/run-command.desktop.in:
+	* plugins/externaltools/data/run-command.tool.in:
+
+	Split the tools into a script file and a (translatable, intltoolable)
+	desktop file. Those are merged at build time by a custom script working
+	the way the script save code works in library.py.
+
+	* plugins/externaltools/data/build:
+	* plugins/externaltools/data/open-terminal-here:
+	* plugins/externaltools/data/remove-trailing-spaces:
+	* plugins/externaltools/data/run-command:
+	
+	Old files have been removed (now these files are autogenerated).
+
+	* plugins/externaltools/scripts/gedit-tool-merge.pl: New custom script
+	to merge desktop file and script file to create tool files.
+
+	* configure.ac:
+	* plugins/externaltools/Makefile.am:
+	* plugins/externaltools/scripts/Makefile.am:
+	
+	Add the new merge script to EXTRA_DIST.
+	
 2006-12-21  Paolo Borelli  <pborelli@katamail.com>
 
 	* plugins/docinfo/gedit-docinfo-plugin.c: do not crash when
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	28 Dec 2006 20:43:24 -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	28 Dec 2006 20:43:24 -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	28 Dec 2006 20:43:24 -0000
@@ -1,10 +1,28 @@
-# Python snippets plugin
-tools_SCRIPTS = \
-	open-terminal-here \
-	build \
-	remove-trailing-spaces \
-	run-command
-	
+TOOL_MERGE=perl $(top_srcdir)/plugins/externaltools/scripts/gedit-tool-merge.pl
+
+tools_in_files = \
+	open-terminal-here.tool.in \
+	build.tool.in \
+	remove-trailing-spaces.tool.in \
+	run-command.tool.in
+
+desktop_in_files = $(tools_in_files:.tool.in=.desktop.in)
+desktop_files    = $(tools_in_files:.tool.in=.desktop)
+tools_SCRIPTS    = $(tools_in_files:.tool.in=)
 toolsdir = $(datadir)/gedit-2/plugins/tools
 
-EXTRA_DIST = $(tools_SCRIPTS)
+@INTLTOOL_DESKTOP_RULE@
+
+# Tools are generated by merging a script file (.tool.in) with a data file
+# (.desktop), which happen to be translated using intltool.
+$(tools_SCRIPTS): %: %.tool.in %.desktop $(TOOL_MERGE)
+	$(TOOL_MERGE) -o $@ $< $(word 2,$^)
+	chmod --reference=$< $@
+
+EXTRA_DIST = \
+	$(desktop_in_files) \
+	$(tools_in_files)
+
+CLEAN_FILES = \
+	$(desktop_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.desktop.in
===================================================================
RCS file: plugins/externaltools/data/build.desktop.in
diff -N plugins/externaltools/data/build.desktop.in
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ plugins/externaltools/data/build.desktop.in	28 Dec 2006 20:43:24 -0000
@@ -0,0 +1,7 @@
+[Gedit Tool]
+_Name=Build
+_Comment=Run "make" in the document directory
+Input=nothing
+Output=output-panel
+Shortcut=F8
+Applicability=local
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	28 Dec 2006 20:43:24 -0000
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+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.desktop.in
===================================================================
RCS file: plugins/externaltools/data/open-terminal-here.desktop.in
diff -N plugins/externaltools/data/open-terminal-here.desktop.in
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ plugins/externaltools/data/open-terminal-here.desktop.in	28 Dec 2006 20:43:24 -0000
@@ -0,0 +1,6 @@
+[Gedit Tool]
+_Name=Open terminal here
+_Comment=Open a terminal in the document location
+Input=nothing
+Output=output-panel
+Applicability=local
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	28 Dec 2006 20:43:24 -0000
@@ -0,0 +1,4 @@
+#!/bin/sh
+
+#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.desktop.in
===================================================================
RCS file: plugins/externaltools/data/remove-trailing-spaces.desktop.in
diff -N plugins/externaltools/data/remove-trailing-spaces.desktop.in
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ plugins/externaltools/data/remove-trailing-spaces.desktop.in	28 Dec 2006 20:43:24 -0000
@@ -0,0 +1,7 @@
+[Gedit Tool]
+_Name=Remove trailing spaces
+_Comment=Remove useless trailing spaces in your file
+Input=document
+Output=replace-document
+Shortcut=<Alt>F12
+Applicability=all
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	28 Dec 2006 20:43:24 -0000
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+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.desktop.in
===================================================================
RCS file: plugins/externaltools/data/run-command.desktop.in
diff -N plugins/externaltools/data/run-command.desktop.in
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ plugins/externaltools/data/run-command.desktop.in	28 Dec 2006 20:43:24 -0000
@@ -0,0 +1,6 @@
+[Gedit Tool]
+_Name=Run command
+_Comment=Execute a custom command and put its output in a new document
+Input=nothing
+Output=new-document
+Applicability=all
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	28 Dec 2006 20:43:24 -0000
@@ -0,0 +1,4 @@
+#!/bin/sh
+
+#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	28 Dec 2006 20:43:24 -0000
@@ -0,0 +1,2 @@
+EXTRA_DIST = gedit-tool-merge.py
+
Index: plugins/externaltools/scripts/gedit-tool-merge.pl
===================================================================
RCS file: plugins/externaltools/scripts/gedit-tool-merge.pl
diff -N plugins/externaltools/scripts/gedit-tool-merge.pl
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ plugins/externaltools/scripts/gedit-tool-merge.pl	28 Dec 2006 20:43:24 -0000
@@ -0,0 +1,78 @@
+#!/usr/bin/perl
+
+# gedit-tool-merge.pl
+# 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
+
+# This script merges a script file with a desktop file containing
+# metadata about the external tool. This is required in order to
+# have translatable tools (bug #342042) since intltool can't extract
+# string directly from tool files (a tool file being the combination
+# of a script file and a metadata section).
+#
+# The desktop file is embedded in a comment of the script file, under
+# the assumption that any scripting language supports # as a comment
+# mark (this is likely to be true since the shebang uses #!). The
+# section is placed at the top of the tool file, after the shebang and
+# modelines if present.
+
+use strict;
+use warnings;
+use Getopt::Long;
+
+sub usage {
+	print <<EOF;
+Usage: ${0} [OPTION]... [SCRIPT] [DESKTOP]
+Merges a script file with a desktop file, embedding it in a comment.
+
+    -o, --output=FILE Specify the output file name. [default: stdout]
+EOF
+	exit;
+}
+
+my $output = "";
+my $help;
+
+GetOptions ("help|h" => \$help, "output|o=s" => \$output) or &usage;
+usage if $help or @ARGV lt 2;
+
+open INFILE, "<", $ARGV[0];
+open DFILE, "<", $ARGV[1];
+open STDOUT, ">", $output if $output;
+
+# Put shebang and various modelines at the top of the generated file.
+$_ = <INFILE>;
+print and $_ = <INFILE> if /^#!/;
+print and $_ = <INFILE> if /-\*-/;
+print and $_ = <INFILE> if /(ex|vi|vim):/;
+
+# Put a blank line before the info block if there is one in INFILE.
+print and $_ = <INFILE> if /^\s*$/;
+seek INFILE, -length, 1;
+
+# Embed the desktop file...
+print "# $_" while <DFILE>;
+print "\n";
+
+# ...and write the remaining part of the script.
+print while <INFILE>;
+
+close INFILE;
+close DFILE;
+close STDOUT;
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	28 Dec 2006 20:43:24 -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,17 +197,25 @@ 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]')
                 continue
-            if line.startswith('##'): continue
+            if line.startswith('##') or 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/ChangeLog
===================================================================
RCS file: /cvs/gnome/gedit/po/ChangeLog,v
retrieving revision 1.1831
diff -u -p -B -r1.1831 ChangeLog
--- po/ChangeLog	28 Dec 2006 19:12:41 -0000	1.1831
+++ po/ChangeLog	28 Dec 2006 20:43:24 -0000
@@ -1,3 +1,7 @@
+2006-12-28  Steve Frécinaux  <code@istique.net>
+
+	* POTFILES.in: add stock external tool metadata files.
+
 2006-12-28  David Lodge <dave@cirt.net>
 
 	* en_GB.po: Updated English (British) translation
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	28 Dec 2006 20:43:24 -0000
@@ -53,6 +53,10 @@ plugins/externaltools/tools/functions.py
 plugins/externaltools/tools/manager.py
 plugins/externaltools/tools/outputpanel.py
 plugins/externaltools/tools/tools.glade
+plugins/externaltools/data/build.desktop.in
+plugins/externaltools/data/open-terminal-here.desktop.in
+plugins/externaltools/data/remove-trailing-spaces.desktop.in
+plugins/externaltools/data/run-command.desktop.in
 plugins/filebrowser/filebrowser.gedit-plugin.desktop.in
 plugins/filebrowser/gedit-file-browser.schemas.in
 plugins/filebrowser/gedit-file-browser-plugin.c
