From: Ævar Arnfjörð Bjarmason Date: Sat, 28 Aug 2010 15:32:15 +0000 (+0000) Subject: gettextize: git-init "Initialized [...] repository" message X-Git-Tag: ko-pu~10^2~143 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=bad5fe6ba226250dd448c141ea3d9196243f4790;p=git.git gettextize: git-init "Initialized [...] repository" message 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 --- diff --git a/builtin/init-db.c b/builtin/init-db.c index 7b339adf8..28e20f960 100644 --- a/builtin/init-db.c +++ b/builtin/init-db.c @@ -354,9 +354,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] != '/' ? "/" : ""); } diff --git a/t/t0001-init.sh b/t/t0001-init.sh index 7fe8883ae..b45df242b 100755 --- a/t/t0001-init.sh +++ b/t/t0001-init.sh @@ -124,7 +124,7 @@ test_expect_success 'GIT_DIR & GIT_WORK_TREE (2)' ' fi ' -test_expect_success 'reinit' ' +test_expect_success NO_GETTEXT_POISON 'reinit' ' ( unset GIT_CONFIG GIT_WORK_TREE GIT_CONFIG