i18n: git-init basic messages
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> Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Ævar Arnfjörð Bjarmason committed
Feb 22, 2011 at 23:41 UTC
33e92e47c5b3eaa66d375cb94c3cfd1a0946bf93
1 file changed
+23
-23
builtin/init-db.c
+23
-23
@@ -31,7 +31,7 @@ static void safe_create_dir(const char *dir, int share)
31
}
32
}
33
else if (share && adjust_shared_perm(dir))
34
- die("Could not make %s writable by group", dir);
34
+ die(_("Could not make %s writable by group"), dir);
35
}
36
37
static void copy_templates_1(char *path, int baselen,
@@ -58,25 +58,25 @@ static void copy_templates_1(char *path, int baselen,
58
namelen = strlen(de->d_name);
59
if ((PATH_MAX <= baselen + namelen) ||
60
(PATH_MAX <= template_baselen + namelen))
61
- die("insanely long template name %s", de->d_name);
61
+ die(_("insanely long template name %s"), de->d_name);
62
memcpy(path + baselen, de->d_name, namelen+1);
63
memcpy(template + template_baselen, de->d_name, namelen+1);
64
if (lstat(path, &st_git)) {
65
if (errno != ENOENT)
66
- die_errno("cannot stat '%s'", path);
66
+ die_errno(_("cannot stat '%s'"), path);
67
}
68
else
69
exists = 1;
70
71
if (lstat(template, &st_template))
72
- die_errno("cannot stat template '%s'", template);
72
+ die_errno(_("cannot stat template '%s'"), template);
73
74
if (S_ISDIR(st_template.st_mode)) {
75
DIR *subdir = opendir(template);
76
int baselen_sub = baselen + namelen;
77
int template_baselen_sub = template_baselen + namelen;
78
if (!subdir)
79
- die_errno("cannot opendir '%s'", template);
79
+ die_errno(_("cannot opendir '%s'"), template);
80
path[baselen_sub++] =
81
template[template_baselen_sub++] = '/';
82
path[baselen_sub] =
@@ -93,20 +93,20 @@ static void copy_templates_1(char *path, int baselen,
93
int len;
94
len = readlink(template, lnk, sizeof(lnk));
95
if (len < 0)
96
- die_errno("cannot readlink '%s'", template);
96
+ die_errno(_("cannot readlink '%s'"), template);
97
if (sizeof(lnk) <= len)
98
- die("insanely long symlink %s", template);
98
+ die(_("insanely long symlink %s"), template);
99
lnk[len] = 0;
100
if (symlink(lnk, path))
101
- die_errno("cannot symlink '%s' '%s'", lnk, path);
101
+ die_errno(_("cannot symlink '%s' '%s'"), lnk, path);
102
}
103
else if (S_ISREG(st_template.st_mode)) {
104
if (copy_file(path, template, st_template.st_mode))
105
- die_errno("cannot copy '%s' to '%s'", template,
105
+ die_errno(_("cannot copy '%s' to '%s'"), template,
106
path);
107
}
108
else
109
- error("ignoring template %s", template);
109
+ error(_("ignoring template %s"), template);
110
}
111
}
112
@@ -129,7 +129,7 @@ static void copy_templates(const char *template_dir)
129
return;
130
template_len = strlen(template_dir);
131
if (PATH_MAX <= (template_len+strlen("/config")))
132
- die("insanely long template path %s", template_dir);
132
+ die(_("insanely long template path %s"), template_dir);
133
strcpy(template_path, template_dir);
134
if (template_path[template_len-1] != '/') {
135
template_path[template_len++] = '/';
@@ -137,7 +137,7 @@ static void copy_templates(const char *template_dir)
137
}
138
dir = opendir(template_path);
139
if (!dir) {
140
- warning("templates not found %s", template_dir);
140
+ warning(_("templates not found %s"), template_dir);
141
return;
142
}
143
@@ -150,8 +150,8 @@ static void copy_templates(const char *template_dir)
150
151
if (repository_format_version &&
152
repository_format_version != GIT_REPO_VERSION) {
153
- warning("not copying templates of "
154
- "a wrong format version %d from '%s'",
153
+ warning(_("not copying templates of "
154
+ "a wrong format version %d from '%s'"),
155
repository_format_version,
156
template_dir);
157
closedir(dir);
@@ -188,7 +188,7 @@ static int create_default_files(const char *template_path)
188
int filemode;
189
190
if (len > sizeof(path)-50)
191
- die("insane git directory %s", git_dir);
191
+ die(_("insane git directory %s"), git_dir);
192
memcpy(path, git_dir, len);
193
194
if (len && path[len-1] != '/')
@@ -375,7 +375,7 @@ static int guess_repository_type(const char *git_dir)
375
if (!strcmp(".", git_dir))
376
return 1;
377
if (!getcwd(cwd, sizeof(cwd)))
378
- die_errno("cannot tell cwd");
378
+ die_errno(_("cannot tell cwd"));
379
if (!strcmp(git_dir, cwd))
380
return 1;
381
/*
@@ -450,18 +450,18 @@ int cmd_init_db(int argc, const char **argv, const char *prefix)
450
errno = EEXIST;
451
/* fallthru */
452
case -1:
453
- die_errno("cannot mkdir %s", argv[0]);
453
+ die_errno(_("cannot mkdir %s"), argv[0]);
454
break;
455
default:
456
break;
457
}
458
shared_repository = saved;
459
if (mkdir(argv[0], 0777) < 0)
460
- die_errno("cannot mkdir %s", argv[0]);
460
+ die_errno(_("cannot mkdir %s"), argv[0]);
461
mkdir_tried = 1;
462
goto retry;
463
}
464
- die_errno("cannot chdir to %s", argv[0]);
464
+ die_errno(_("cannot chdir to %s"), argv[0]);
465
}
466
} else if (0 < argc) {
467
usage(init_db_usage[0]);
@@ -483,8 +483,8 @@ int cmd_init_db(int argc, const char **argv, const char *prefix)
483
git_dir = getenv(GIT_DIR_ENVIRONMENT);
484
work_tree = getenv(GIT_WORK_TREE_ENVIRONMENT);
485
if ((!git_dir || is_bare_repository_cfg == 1) && work_tree)
486
- die("%s (or --work-tree=<directory>) not allowed without "
487
- "specifying %s (or --git-dir=<directory>)",
486
+ die(_("%s (or --work-tree=<directory>) not allowed without "
487
+ "specifying %s (or --git-dir=<directory>)"),
488
GIT_WORK_TREE_ENVIRONMENT,
489
GIT_DIR_ENVIRONMENT);
490
@@ -509,14 +509,14 @@ int cmd_init_db(int argc, const char **argv, const char *prefix)
509
if (!git_work_tree_cfg) {
510
git_work_tree_cfg = xcalloc(PATH_MAX, 1);
511
if (!getcwd(git_work_tree_cfg, PATH_MAX))
512
- die_errno ("Cannot access current working directory");
512
+ die_errno (_("Cannot access current working directory"));
513
}
514
if (work_tree)
515
set_git_work_tree(make_absolute_path(work_tree));
516
else
517
set_git_work_tree(git_work_tree_cfg);
518
if (access(get_git_work_tree(), X_OK))
519
- die_errno ("Cannot access work tree '%s'",
519
+ die_errno (_("Cannot access work tree '%s'"),
520
get_git_work_tree());
521
}
522
else {