git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
To: Jonathan Nieder <jrnieder@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH/RFC v7 1/2] Add infrastructure for translating Git with  gettext
Date: Sat, 5 Jun 2010 15:19:33 +0000	[thread overview]
Message-ID: <AANLkTimHZdT3vfuUyG1cnanE3WLrhDGqqw5JyYfza6wD@mail.gmail.com> (raw)
In-Reply-To: <20100605033626.GA2252@progeny.tock>

On Sat, Jun 5, 2010 at 03:36, Jonathan Nieder <jrnieder@gmail.com> wrote:
> Ævar Arnfjörð Bjarmason wrote:
>> On Sat, Jun 5, 2010 at 02:57, Jonathan Nieder <jrnieder@gmail.com> wrote:
>
>>> This handles builtins.  ‘grep PROGRAM_OBJS Makefile’ reveals nine
>>> other source files with their own main() functions.
> [...]
>> They're mostly guts, but I guess imap-send should be translated.
>
> Ok, I just wanted to make sure it was intentional.

The main motivation is just to get the majority of messages in
translatable state.

> Is the porcelain/plumbing distinction meant to be honored here?
> It is possible the right thing to do would be to have run_builtin()
> call the function that calls setlocale(), if and only if the command
> has a USE_LOCALE flag set.

I looked at some of the PROGRAM_OBJS that were omitted and all of them
have some parts where they'll die with a message to STDERR. Those
should probably be translatable.

So in the interest of completion I've patched my copy so that all the
PROGRAM_OBJS include the gettext setup function. I can include it in
my next series if this is deemed a good idea.

> The downside: this would make the handle_internal_command table even
> wider than it already is.

IMO trying to plan in advance what we should and shouldn't translate
is a bit premature.

I think it's better to just add glue so that everything can be
translated, then we can try decide later if some arbitrary subset
shouldn't have translations (even for human readable error messages)
and act appropriately.

diff --git a/daemon.c b/daemon.c
index a90ab10..7f4691c 100644
--- a/daemon.c
+++ b/daemon.c
@@ -3,6 +3,7 @@
 #include "exec_cmd.h"
 #include "run-command.h"
 #include "strbuf.h"
+#include "gettext.h"

 #include <syslog.h>

@@ -974,6 +975,8 @@ int main(int argc, char **argv)
 	gid_t gid = 0;
 	int i;

+	git_setup_gettext();
+
 	git_extract_argv0_path(argv[0]);

 	for (i = 1; i < argc; i++) {
	Modified fast-import.c
diff --git a/fast-import.c b/fast-import.c
index 129a786..6947f7a 100644
--- a/fast-import.c
+++ b/fast-import.c
@@ -156,6 +156,7 @@ Format of STDIN stream:
 #include "csum-file.h"
 #include "quote.h"
 #include "exec_cmd.h"
+#include "gettext.h"

 #define PACK_ID_BITS 16
 #define MAX_PACK_ID ((1<<PACK_ID_BITS)-1)
@@ -2904,6 +2905,8 @@ int main(int argc, const char **argv)

 	git_extract_argv0_path(argv[0]);

+	git_setup_gettext();
+
 	if (argc == 2 && !strcmp(argv[1], "-h"))
 		usage(fast_import_usage);

	Modified http-backend.c
diff --git a/http-backend.c b/http-backend.c
index d1e83d0..b6d9bd5 100644
--- a/http-backend.c
+++ b/http-backend.c
@@ -6,6 +6,7 @@
 #include "exec_cmd.h"
 #include "run-command.h"
 #include "string-list.h"
+#include "gettext.h"

 static const char content_type[] = "Content-Type";
 static const char content_length[] = "Content-Length";
@@ -605,6 +606,8 @@ int main(int argc, char **argv)
 	char *cmd_arg = NULL;
 	int i;

+	git_setup_gettext();
+
 	git_extract_argv0_path(argv[0]);
 	set_die_routine(die_webcgi);

	Modified http-fetch.c
diff --git a/http-fetch.c b/http-fetch.c
index 762c750..b889c36 100644
--- a/http-fetch.c
+++ b/http-fetch.c
@@ -2,6 +2,7 @@
 #include "exec_cmd.h"
 #include "http.h"
 #include "walker.h"
+#include "gettext.h"

 static const char http_fetch_usage[] = "git http-fetch "
 "[-c] [-t] [-a] [-v] [--recover] [-w ref] [--stdin] commit-id url";
@@ -24,6 +25,8 @@ int main(int argc, const char **argv)
 	int get_verbosely = 0;
 	int get_recover = 0;

+	git_setup_gettext();
+
 	git_extract_argv0_path(argv[0]);

 	while (arg < argc && argv[arg][0] == '-') {
	Modified http-push.c
diff --git a/http-push.c b/http-push.c
index 415b1ab..ba0338c 100644
--- a/http-push.c
+++ b/http-push.c
@@ -10,6 +10,7 @@
 #include "remote.h"
 #include "list-objects.h"
 #include "sigchain.h"
+#include "gettext.h"

 #include <expat.h>

@@ -1791,6 +1792,8 @@ int main(int argc, char **argv)
 	struct remote *remote;
 	char *rewritten_url = NULL;

+	git_setup_gettext();
+
 	git_extract_argv0_path(argv[0]);

 	repo = xcalloc(sizeof(*repo), 1);
	Modified imap-send.c
diff --git a/imap-send.c b/imap-send.c
index 9d0097c..4f5f269 100644
--- a/imap-send.c
+++ b/imap-send.c
@@ -25,6 +25,7 @@
 #include "cache.h"
 #include "exec_cmd.h"
 #include "run-command.h"
+#include "gettext.h"
 #ifdef NO_OPENSSL
 typedef void *SSL;
 #else
@@ -1535,6 +1536,8 @@ int main(int argc, char **argv)

 	git_extract_argv0_path(argv[0]);

+	git_setup_gettext();
+
 	if (argc != 1)
 		usage(imap_send_usage);

	Modified shell.c
diff --git a/shell.c b/shell.c
index e4864e0..ba27c6b 100644
--- a/shell.c
+++ b/shell.c
@@ -2,6 +2,7 @@
 #include "quote.h"
 #include "exec_cmd.h"
 #include "strbuf.h"
+#include "gettext.h"

 static int do_generic_cmd(const char *me, char *arg)
 {
@@ -51,6 +52,8 @@ int main(int argc, char **argv)
 	struct commands *cmd;
 	int devnull_fd;

+	git_setup_gettext();
+
 	/*
 	 * Always open file descriptors 0/1/2 to avoid clobbering files
 	 * in die().  It also avoids not messing up when the pipes are
	Modified show-index.c
diff --git a/show-index.c b/show-index.c
index 4c0ac13..c2f5448 100644
--- a/show-index.c
+++ b/show-index.c
@@ -1,5 +1,6 @@
 #include "cache.h"
 #include "pack.h"
+#include "gettext.h"

 static const char show_index_usage[] =
 "git show-index < <packed archive index>";
@@ -11,6 +12,8 @@ int main(int argc, char **argv)
 	unsigned int version;
 	static unsigned int top_index[256];

+	git_setup_gettext();
+
 	if (argc != 1)
 		usage(show_index_usage);
 	if (fread(top_index, 2 * 4, 1, stdin) != 1)
	Modified upload-pack.c
diff --git a/upload-pack.c b/upload-pack.c
index dc464d7..ece9a4b 100644
--- a/upload-pack.c
+++ b/upload-pack.c
@@ -10,6 +10,7 @@
 #include "revision.h"
 #include "list-objects.h"
 #include "run-command.h"
+#include "gettext.h"

 static const char upload_pack_usage[] = "git upload-pack [--strict]
[--timeout=nn] <dir>";

@@ -686,6 +687,8 @@ int main(int argc, char **argv)
 	int i;
 	int strict = 0;

+	git_setup_gettext();
+
 	git_extract_argv0_path(argv[0]);
 	read_replace_refs = 0;

  reply	other threads:[~2010-06-05 15:24 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-05  2:13 [PATCH/RFC v7 0/2] Add infrastructure for translating Git with gettext Ævar Arnfjörð Bjarmason
2010-06-05  2:13 ` [PATCH/RFC v7 1/2] " Ævar Arnfjörð Bjarmason
2010-06-05  2:57   ` Jonathan Nieder
2010-06-05  3:28     ` Ævar Arnfjörð Bjarmason
2010-06-05  3:36       ` Jonathan Nieder
2010-06-05 15:19         ` Ævar Arnfjörð Bjarmason [this message]
2010-06-05 19:27           ` Jonathan Nieder
2010-06-05 19:47             ` Ævar Arnfjörð Bjarmason
2010-06-12 17:26               ` Jonathan Nieder
2010-06-05  3:01   ` Jonathan Nieder
2010-06-05  3:30     ` Ævar Arnfjörð Bjarmason
2010-06-05  3:38       ` Jonathan Nieder
2010-06-05 14:10         ` Ævar Arnfjörð Bjarmason
2010-06-05 18:59           ` Jonathan Nieder
2010-06-05 19:33             ` Ævar Arnfjörð Bjarmason
2010-06-05 20:16               ` Inline functions (Re: [PATCH/RFC v7 1/2] Add infrastructure for translating Git with gettext) Jonathan Nieder
2010-06-05 13:57   ` [PATCH/RFC v7 1/2] Add infrastructure for translating Git with gettext Jakub Narebski
2010-06-05 16:19     ` Ævar Arnfjörð Bjarmason
2010-06-05  2:13 ` [PATCH/RFC v7 2/2] Add initial C, Shell and Perl gettext translations Ævar Arnfjörð Bjarmason

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=AANLkTimHZdT3vfuUyG1cnanE3WLrhDGqqw5JyYfza6wD@mail.gmail.com \
    --to=avarab@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=jrnieder@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).