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: git@vger.kernel.org
Cc: "Junio C Hamano" <gitster@pobox.com>,
	"Jonathan Nieder" <jrnieder@gmail.com>,
	"Marcin Cieslak" <saper@saper.info>,
	"Jens Lehmann" <Jens.Lehmann@web.de>,
	"Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
Subject: [PATCH/RFC 05/17] gettext: make the simple parts of git-init localizable
Date: Mon, 30 Aug 2010 21:28:11 +0000	[thread overview]
Message-ID: <1283203703-26923-6-git-send-email-avarab@gmail.com> (raw)
In-Reply-To: <1283203703-26923-1-git-send-email-avarab@gmail.com>

Change the user visible strings in init-db.c to use gettext
localizations. This only converts messages which needed to be changed
from "foo" to _("foo"), and didn't need any TRANSLATORS comments.

I haven't marked the messages in init_db_usage or init_db_options for
translation, since that would require additional changes in
parse-options.c. Those can be done later.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
---
 builtin/init-db.c |   46 +++++++++++++++++++++++-----------------------
 1 files changed, 23 insertions(+), 23 deletions(-)

diff --git a/builtin/init-db.c b/builtin/init-db.c
index 0271285..9c08985 100644
--- a/builtin/init-db.c
+++ b/builtin/init-db.c
@@ -31,7 +31,7 @@ static void safe_create_dir(const char *dir, int share)
 		}
 	}
 	else if (share && adjust_shared_perm(dir))
-		die("Could not make %s writable by group", dir);
+		die(_("Could not make %s writable by group"), dir);
 }
 
 static void copy_templates_1(char *path, int baselen,
@@ -58,25 +58,25 @@ static void copy_templates_1(char *path, int baselen,
 		namelen = strlen(de->d_name);
 		if ((PATH_MAX <= baselen + namelen) ||
 		    (PATH_MAX <= template_baselen + namelen))
-			die("insanely long template name %s", de->d_name);
+			die(_("insanely long template name %s"), de->d_name);
 		memcpy(path + baselen, de->d_name, namelen+1);
 		memcpy(template + template_baselen, de->d_name, namelen+1);
 		if (lstat(path, &st_git)) {
 			if (errno != ENOENT)
-				die_errno("cannot stat '%s'", path);
+				die_errno(_("cannot stat '%s'"), path);
 		}
 		else
 			exists = 1;
 
 		if (lstat(template, &st_template))
-			die_errno("cannot stat template '%s'", template);
+			die_errno(_("cannot stat template '%s'"), template);
 
 		if (S_ISDIR(st_template.st_mode)) {
 			DIR *subdir = opendir(template);
 			int baselen_sub = baselen + namelen;
 			int template_baselen_sub = template_baselen + namelen;
 			if (!subdir)
-				die_errno("cannot opendir '%s'", template);
+				die_errno(_("cannot opendir '%s'"), template);
 			path[baselen_sub++] =
 				template[template_baselen_sub++] = '/';
 			path[baselen_sub] =
@@ -93,20 +93,20 @@ static void copy_templates_1(char *path, int baselen,
 			int len;
 			len = readlink(template, lnk, sizeof(lnk));
 			if (len < 0)
-				die_errno("cannot readlink '%s'", template);
+				die_errno(_("cannot readlink '%s'"), template);
 			if (sizeof(lnk) <= len)
-				die("insanely long symlink %s", template);
+				die(_("insanely long symlink %s"), template);
 			lnk[len] = 0;
 			if (symlink(lnk, path))
-				die_errno("cannot symlink '%s' '%s'", lnk, path);
+				die_errno(_("cannot symlink '%s' '%s'"), lnk, path);
 		}
 		else if (S_ISREG(st_template.st_mode)) {
 			if (copy_file(path, template, st_template.st_mode))
-				die_errno("cannot copy '%s' to '%s'", template,
+				die_errno(_("cannot copy '%s' to '%s'"), template,
 					  path);
 		}
 		else
-			error("ignoring template %s", template);
+			error(_("ignoring template %s"), template);
 	}
 }
 
@@ -129,7 +129,7 @@ static void copy_templates(const char *template_dir)
 		return;
 	template_len = strlen(template_dir);
 	if (PATH_MAX <= (template_len+strlen("/config")))
-		die("insanely long template path %s", template_dir);
+		die(_("insanely long template path %s"), template_dir);
 	strcpy(template_path, template_dir);
 	if (template_path[template_len-1] != '/') {
 		template_path[template_len++] = '/';
@@ -137,7 +137,7 @@ static void copy_templates(const char *template_dir)
 	}
 	dir = opendir(template_path);
 	if (!dir) {
-		warning("templates not found %s", template_dir);
+		warning(_("templates not found %s"), template_dir);
 		return;
 	}
 
@@ -150,8 +150,8 @@ static void copy_templates(const char *template_dir)
 
 	if (repository_format_version &&
 	    repository_format_version != GIT_REPO_VERSION) {
-		warning("not copying templates of "
-			"a wrong format version %d from '%s'",
+		warning(_("not copying templates of "
+			"a wrong format version %d from '%s'"),
 			repository_format_version,
 			template_dir);
 		closedir(dir);
@@ -188,7 +188,7 @@ static int create_default_files(const char *template_path)
 	int filemode;
 
 	if (len > sizeof(path)-50)
-		die("insane git directory %s", git_dir);
+		die(_("insane git directory %s"), git_dir);
 	memcpy(path, git_dir, len);
 
 	if (len && path[len-1] != '/')
@@ -369,7 +369,7 @@ static int guess_repository_type(const char *git_dir)
 	if (!strcmp(".", git_dir))
 		return 1;
 	if (!getcwd(cwd, sizeof(cwd)))
-		die_errno("cannot tell cwd");
+		die_errno(_("cannot tell cwd"));
 	if (!strcmp(git_dir, cwd))
 		return 1;
 	/*
@@ -443,18 +443,18 @@ int cmd_init_db(int argc, const char **argv, const char *prefix)
 					errno = EEXIST;
 					/* fallthru */
 				case -1:
-					die_errno("cannot mkdir %s", argv[0]);
+					die_errno(_("cannot mkdir %s"), argv[0]);
 					break;
 				default:
 					break;
 				}
 				shared_repository = saved;
 				if (mkdir(argv[0], 0777) < 0)
-					die_errno("cannot mkdir %s", argv[0]);
+					die_errno(_("cannot mkdir %s"), argv[0]);
 				mkdir_tried = 1;
 				goto retry;
 			}
-			die_errno("cannot chdir to %s", argv[0]);
+			die_errno(_("cannot chdir to %s"), argv[0]);
 		}
 	} else if (0 < argc) {
 		usage(init_db_usage[0]);
@@ -476,8 +476,8 @@ int cmd_init_db(int argc, const char **argv, const char *prefix)
 	git_dir = getenv(GIT_DIR_ENVIRONMENT);
 	if ((!git_dir || is_bare_repository_cfg == 1)
 	    && getenv(GIT_WORK_TREE_ENVIRONMENT))
-		die("%s (or --work-tree=<directory>) not allowed without "
-		    "specifying %s (or --git-dir=<directory>)",
+		die(_("%s (or --work-tree=<directory>) not allowed without "
+			  "specifying %s (or --git-dir=<directory>)"),
 		    GIT_WORK_TREE_ENVIRONMENT,
 		    GIT_DIR_ENVIRONMENT);
 
@@ -502,10 +502,10 @@ int cmd_init_db(int argc, const char **argv, const char *prefix)
 		if (!git_work_tree_cfg) {
 			git_work_tree_cfg = xcalloc(PATH_MAX, 1);
 			if (!getcwd(git_work_tree_cfg, PATH_MAX))
-				die_errno ("Cannot access current working directory");
+				die_errno (_("Cannot access current working directory"));
 		}
 		if (access(get_git_work_tree(), X_OK))
-			die_errno ("Cannot access work tree '%s'",
+			die_errno (_("Cannot access work tree '%s'"),
 				   get_git_work_tree());
 	}
 
-- 
1.7.2.2.536.g3f548

  parent reply	other threads:[~2010-08-30 21:28 UTC|newest]

Thread overview: 55+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-30 21:28 [PATCH/RFC 00/17] Begin gettextizing Git Ævar Arnfjörð Bjarmason
2010-08-30 21:28 ` [PATCH/RFC 01/17] Makefile: A variable for options used by xgettext(1) calls Ævar Arnfjörð Bjarmason
2010-08-31 14:51   ` Jonathan Nieder
2010-08-31 16:36     ` Ævar Arnfjörð Bjarmason
2010-08-30 21:28 ` [PATCH/RFC 02/17] Makefile: provide a --msgid-bugs-address to xgettext(1) Ævar Arnfjörð Bjarmason
2010-08-30 21:28 ` [PATCH/RFC 03/17] Makefile: tell xgettext(1) that our source is in UTF-8 Ævar Arnfjörð Bjarmason
2010-08-30 21:28 ` [PATCH/RFC 04/17] builtin.h: Include gettext.h Ævar Arnfjörð Bjarmason
2010-08-30 21:28 ` Ævar Arnfjörð Bjarmason [this message]
2010-08-31 15:03   ` [PATCH/RFC 05/17] gettext: make the simple parts of git-init localizable Jonathan Nieder
2010-08-31 15:37     ` Ævar Arnfjörð Bjarmason
2010-08-31 15:44       ` Jonathan Nieder
2010-08-31 16:05         ` Ævar Arnfjörð Bjarmason
2010-08-31 16:09           ` Jonathan Nieder
2010-08-31 16:27           ` Junio C Hamano
2010-08-30 21:28 ` [PATCH/RFC 06/17] gettext: localize the main git-init message Ævar Arnfjörð Bjarmason
2010-08-31 15:10   ` Jonathan Nieder
2010-08-31 15:39     ` Ævar Arnfjörð Bjarmason
2010-08-31 15:48       ` Jonathan Nieder
2010-08-30 21:28 ` [PATCH/RFC 07/17] gettext.c: work around us not using setlocale(LC_CTYPE, "") Ævar Arnfjörð Bjarmason
2010-08-31 15:18   ` Jonathan Nieder
2010-08-31 15:37     ` Marcin Cieslak
2010-08-31 15:49       ` Jonathan Nieder
2010-08-31 16:51     ` Ævar Arnfjörð Bjarmason
2010-08-31 22:45       ` Jonathan Nieder
2010-08-31 22:58         ` Erik Faye-Lund
2010-08-30 21:28 ` [PATCH/RFC 08/17] gettext tests: test if $VERSION exists before using it Ævar Arnfjörð Bjarmason
2010-08-30 21:28 ` [PATCH/RFC 09/17] gettext tests: update test/is.po to match t/t0200/test.c Ævar Arnfjörð Bjarmason
2010-08-30 21:28 ` [PATCH/RFC 10/17] gettext tests: add detection for is_IS.ISO-8859-1 locale Ævar Arnfjörð Bjarmason
2010-08-30 21:28 ` [PATCH/RFC 11/17] gettext tests: test message re-encoding under Shell Ævar Arnfjörð Bjarmason
2010-08-30 21:28 ` [PATCH/RFC 12/17] gettext tests: test re-encoding with a UTF-8 msgid " Ævar Arnfjörð Bjarmason
2010-08-30 21:28 ` [PATCH/RFC 13/17] gettext tests: mark a test message as not needing translation Ævar Arnfjörð Bjarmason
2010-08-30 21:28 ` [PATCH/RFC 14/17] po/is.po: msgmerge and add Language: header Ævar Arnfjörð Bjarmason
2010-08-30 21:28 ` [PATCH/RFC 15/17] po/is.po: add Icelandic translation Ævar Arnfjörð Bjarmason
2010-08-31 15:29   ` Jonathan Nieder
2010-08-31 17:01     ` Ævar Arnfjörð Bjarmason
2010-08-31 19:14       ` Erik Faye-Lund
2010-08-31 19:32         ` Ævar Arnfjörð Bjarmason
2010-08-31 19:49           ` Erik Faye-Lund
2010-08-30 21:28 ` [PATCH/RFC 16/17] po/pl.po: add Polish translation Ævar Arnfjörð Bjarmason
2010-08-30 21:28 ` [PATCH/RFC 17/17] gettext tests: test message re-encoding under C Ævar Arnfjörð Bjarmason
2010-08-30 21:42 ` [PATCH/RFC 00/17] Begin gettextizing Git Junio C Hamano
2010-08-31  9:02   ` [PATCH] gettext: Make NO_GETTEXT=YesPlease the default in releases Ævar Arnfjörð Bjarmason
2010-08-31 17:18   ` [PATCH/RFC 00/17] Begin gettextizing Git Ævar Arnfjörð Bjarmason
2010-08-31 18:08     ` Jonathan Nieder
2010-08-31 18:24       ` Ævar Arnfjörð Bjarmason
2010-08-31 19:22         ` Jonathan Nieder
2010-08-31 19:35           ` Ævar Arnfjörð Bjarmason
2010-08-31 19:42             ` Jonathan Nieder
2010-08-31 11:08 ` Peter Krefting
2010-08-31 11:42   ` Ævar Arnfjörð Bjarmason
2010-08-31 11:48     ` Peter Krefting
2010-08-31 12:02     ` Matthieu Moy
2010-08-31 12:43       ` Ævar Arnfjörð Bjarmason
2010-08-31 15:32 ` Jonathan Nieder
2010-08-31 16:05   ` Æ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=1283203703-26923-6-git-send-email-avarab@gmail.com \
    --to=avarab@gmail.com \
    --cc=Jens.Lehmann@web.de \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=jrnieder@gmail.com \
    --cc=saper@saper.info \
    /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).