Thread (44 messages) flat view 44 messages, 5 authors, 2016-06-15
STALE3734d

[PATCH/RFC 06/17] gettext: localize the main git-init message

From: Ævar Arnfjörð Bjarmason <hidden>
Date: 2016-06-15 22:49:24
Subsystem: the rest · Maintainer: Linus Torvalds

Change the git-init "Initialized empty Git repository" message and its
variants to use gettext.

This is one of the messages that could do with splitting up, I had a
WIP patch to do that that began like this:

    const char *reinit_shared   = _("Reinitialized existing shared Git repository in %s\n");
    const char *init_shared	    = _("Initialized empty shared Git repository in %s\n");
    const char *reinit_noshared = _("Reinitialized existing Git repository in %s\n");
    const char *init_noshared   = _("Initialized empty Git repository in %s\n");

But in the first round of gettextization I'm aiming to keep code
changes to a minimum for ease of review.

We can solicit input from translators about which messages that use
too much sprintf-ing are troublesome, and change those later.

Note that the TRANSLATORS comment doesn't use the usual Git
style. This is because everything from "/* TRANSLATORS: " to "*/" will
extracted as-is xgettext(1) and presented to translators, including
newlines and leading "*"'s. There seems to be no way to change that,
short of patching xgettext itself.

Signed-off-by: Ævar Arnfjörð Bjarmason <redacted>
---
 builtin/init-db.c |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/builtin/init-db.c b/builtin/init-db.c
index 9c08985..0224dee 100644
--- a/builtin/init-db.c
+++ b/builtin/init-db.c
@@ -348,9 +348,13 @@ int init_db(const char *template_dir, unsigned int flags)
 	if (!(flags & INIT_DB_QUIET)) {
 		const char *git_dir = get_git_dir();
 		int len = strlen(git_dir);
-		printf("%s%s Git repository in %s%s\n",
-		       reinit ? "Reinitialized existing" : "Initialized empty",
-		       shared_repository ? " shared" : "",
+
+		/* TRANSLATORS: The first '%s' is either "Reinitialized
+		   existing" or "Initialized empty", the second " shared" or
+		   "", and the last '%s%s' is the verbatim directory name. */
+		printf(_("%s%s Git repository in %s%s\n"),
+		       reinit ? _("Reinitialized existing") : _("Initialized empty"),
+		       shared_repository ? _(" shared") : "",
 		       git_dir, len && git_dir[len-1] != '/' ? "/" : "");
 	}
 
-- 
1.7.2.2.536.g3f548
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help