Even more i18n.

* va/i18n-more:
  i18n: stash: mark messages for translation
  i18n: notes-merge: mark die messages for translation
  i18n: ident: mark hint for translation
  i18n: i18n: diff: mark die messages for translation
  i18n: connect: mark die messages for translation
  i18n: commit: mark message for translation
This commit is contained in:
Junio C Hamano 2016-09-26 16:09:17 -07:00
Родитель e447d3182c 850251f33b
Коммит 8969feac7e
10 изменённых файлов: 48 добавлений и 43 удалений

Просмотреть файл

@ -1511,9 +1511,9 @@ static int verify_utf8(struct strbuf *buf)
}
static const char commit_utf8_warn[] =
"Warning: commit message did not conform to UTF-8.\n"
"You may want to amend it after fixing the message, or set the config\n"
"variable i18n.commitencoding to the encoding your project uses.\n";
N_("Warning: commit message did not conform to UTF-8.\n"
"You may want to amend it after fixing the message, or set the config\n"
"variable i18n.commitencoding to the encoding your project uses.\n");
int commit_tree_extended(const char *msg, size_t msg_len,
const unsigned char *tree,
@ -1566,7 +1566,7 @@ int commit_tree_extended(const char *msg, size_t msg_len,
/* And check the encoding */
if (encoding_is_utf8 && !verify_utf8(&buffer))
fprintf(stderr, commit_utf8_warn);
fprintf(stderr, _(commit_utf8_warn));
if (sign_commit && do_sign_commit(&buffer, sign_commit))
return -1;

Просмотреть файл

@ -46,11 +46,11 @@ int check_ref_type(const struct ref *ref, int flags)
static void die_initial_contact(int unexpected)
{
if (unexpected)
die("The remote end hung up upon initial contact");
die(_("The remote end hung up upon initial contact"));
else
die("Could not read from remote repository.\n\n"
"Please make sure you have the correct access rights\n"
"and the repository exists.");
die(_("Could not read from remote repository.\n\n"
"Please make sure you have the correct access rights\n"
"and the repository exists."));
}
static void parse_one_symref_info(struct string_list *symref, const char *val, int len)

15
diff.c
Просмотреть файл

@ -56,6 +56,11 @@ static char diff_colors[][COLOR_MAXLEN] = {
GIT_COLOR_NORMAL, /* FUNCINFO */
};
static NORETURN void die_want_option(const char *option_name)
{
die(_("option '%s' requires a value"), option_name);
}
static int parse_diff_color_slot(const char *var)
{
if (!strcasecmp(var, "context") || !strcasecmp(var, "plain"))
@ -3341,7 +3346,7 @@ void diff_setup_done(struct diff_options *options)
if (options->output_format & DIFF_FORMAT_NO_OUTPUT)
count++;
if (count > 1)
die("--name-only, --name-status, --check and -s are mutually exclusive");
die(_("--name-only, --name-status, --check and -s are mutually exclusive"));
/*
* Most of the time we can say "there are changes"
@ -3537,7 +3542,7 @@ static int stat_opt(struct diff_options *options, const char **av)
if (*arg == '=')
width = strtoul(arg + 1, &end, 10);
else if (!*arg && !av[1])
die("Option '--stat-width' requires a value");
die_want_option("--stat-width");
else if (!*arg) {
width = strtoul(av[1], &end, 10);
argcount = 2;
@ -3546,7 +3551,7 @@ static int stat_opt(struct diff_options *options, const char **av)
if (*arg == '=')
name_width = strtoul(arg + 1, &end, 10);
else if (!*arg && !av[1])
die("Option '--stat-name-width' requires a value");
die_want_option("--stat-name-width");
else if (!*arg) {
name_width = strtoul(av[1], &end, 10);
argcount = 2;
@ -3555,7 +3560,7 @@ static int stat_opt(struct diff_options *options, const char **av)
if (*arg == '=')
graph_width = strtoul(arg + 1, &end, 10);
else if (!*arg && !av[1])
die("Option '--stat-graph-width' requires a value");
die_want_option("--stat-graph-width");
else if (!*arg) {
graph_width = strtoul(av[1], &end, 10);
argcount = 2;
@ -3564,7 +3569,7 @@ static int stat_opt(struct diff_options *options, const char **av)
if (*arg == '=')
count = strtoul(arg + 1, &end, 10);
else if (!*arg && !av[1])
die("Option '--stat-count' requires a value");
die_want_option("--stat-count");
else if (!*arg) {
count = strtoul(av[1], &end, 10);
argcount = 2;

Просмотреть файл

@ -100,7 +100,7 @@ create_stash () {
u_tree=$(git write-tree) &&
printf 'untracked files on %s\n' "$msg" | git commit-tree $u_tree &&
rm -f "$TMPindex"
) ) || die "Cannot save the untracked files"
) ) || die "$(gettext "Cannot save the untracked files")"
untracked_commit_option="-p $u_commit";
else
@ -248,7 +248,7 @@ save_stash () {
if test -n "$patch_mode" && test -n "$untracked"
then
die "Can't use --patch and --include-untracked or --all at the same time"
die "$(gettext "Can't use --patch and --include-untracked or --all at the same time")"
fi
stash_msg="$*"
@ -494,7 +494,7 @@ apply_stash () {
GIT_INDEX_FILE="$TMPindex" git-read-tree "$u_tree" &&
GIT_INDEX_FILE="$TMPindex" git checkout-index --all &&
rm -f "$TMPindex" ||
die 'Could not restore untracked files from stash'
die "$(gettext "Could not restore untracked files from stash")"
fi
eval "

32
ident.c
Просмотреть файл

@ -331,17 +331,17 @@ person_only:
}
static const char *env_hint =
"\n"
"*** Please tell me who you are.\n"
"\n"
"Run\n"
"\n"
" git config --global user.email \"you@example.com\"\n"
" git config --global user.name \"Your Name\"\n"
"\n"
"to set your account\'s default identity.\n"
"Omit --global to set the identity only in this repository.\n"
"\n";
N_("\n"
"*** Please tell me who you are.\n"
"\n"
"Run\n"
"\n"
" git config --global user.email \"you@example.com\"\n"
" git config --global user.name \"Your Name\"\n"
"\n"
"to set your account\'s default identity.\n"
"Omit --global to set the identity only in this repository.\n"
"\n");
const char *fmt_ident(const char *name, const char *email,
const char *date_str, int flag)
@ -356,13 +356,13 @@ const char *fmt_ident(const char *name, const char *email,
if (!name) {
if (strict && ident_use_config_only
&& !(ident_config_given & IDENT_NAME_GIVEN)) {
fputs(env_hint, stderr);
fputs(_(env_hint), stderr);
die("no name was given and auto-detection is disabled");
}
name = ident_default_name();
using_default = 1;
if (strict && default_name_is_bogus) {
fputs(env_hint, stderr);
fputs(_(env_hint), stderr);
die("unable to auto-detect name (got '%s')", name);
}
}
@ -370,7 +370,7 @@ const char *fmt_ident(const char *name, const char *email,
struct passwd *pw;
if (strict) {
if (using_default)
fputs(env_hint, stderr);
fputs(_(env_hint), stderr);
die("empty ident name (for <%s>) not allowed", email);
}
pw = xgetpwuid_self(NULL);
@ -381,12 +381,12 @@ const char *fmt_ident(const char *name, const char *email,
if (!email) {
if (strict && ident_use_config_only
&& !(ident_config_given & IDENT_MAIL_GIVEN)) {
fputs(env_hint, stderr);
fputs(_(env_hint), stderr);
die("no email was given and auto-detection is disabled");
}
email = ident_default_email();
if (strict && default_email_is_bogus) {
fputs(env_hint, stderr);
fputs(_(env_hint), stderr);
die("unable to auto-detect email address (got '%s')", email);
}
}

Просмотреть файл

@ -270,15 +270,15 @@ static void check_notes_merge_worktree(struct notes_merge_options *o)
if (file_exists(git_path(NOTES_MERGE_WORKTREE)) &&
!is_empty_dir(git_path(NOTES_MERGE_WORKTREE))) {
if (advice_resolve_conflict)
die("You have not concluded your previous "
die(_("You have not concluded your previous "
"notes merge (%s exists).\nPlease, use "
"'git notes merge --commit' or 'git notes "
"merge --abort' to commit/abort the "
"previous merge before you start a new "
"notes merge.", git_path("NOTES_MERGE_*"));
"notes merge."), git_path("NOTES_MERGE_*"));
else
die("You have not concluded your notes merge "
"(%s exists).", git_path("NOTES_MERGE_*"));
die(_("You have not concluded your notes merge "
"(%s exists)."), git_path("NOTES_MERGE_*"));
}
if (safe_create_leading_directories_const(git_path(

Просмотреть файл

@ -225,7 +225,7 @@ test_expect_success 'cannot do merge w/conflicts when previous merge is unfinish
test -d .git/NOTES_MERGE_WORKTREE &&
test_must_fail git notes merge z >output 2>&1 &&
# Output should indicate what is wrong
grep -q "\\.git/NOTES_MERGE_\\* exists" output
test_i18ngrep -q "\\.git/NOTES_MERGE_\\* exists" output
'
# Setup non-conflicting merge between x and new notes ref w

Просмотреть файл

@ -45,7 +45,7 @@ test_expect_success 'UTF-8 invalid characters refused' '
printf "Commit message\n\nInvalid surrogate:\355\240\200\n" \
>"$HOME/invalid" &&
git commit -a -F "$HOME/invalid" 2>"$HOME"/stderr &&
grep "did not conform" "$HOME"/stderr
test_i18ngrep "did not conform" "$HOME"/stderr
'
test_expect_success 'UTF-8 overlong sequences rejected' '
@ -55,7 +55,7 @@ test_expect_success 'UTF-8 overlong sequences rejected' '
printf "\340\202\251ommit message\n\nThis is not a space:\300\240\n" \
>"$HOME/invalid" &&
git commit -a -F "$HOME/invalid" 2>"$HOME"/stderr &&
grep "did not conform" "$HOME"/stderr
test_i18ngrep "did not conform" "$HOME"/stderr
'
test_expect_success 'UTF-8 non-characters refused' '
@ -64,7 +64,7 @@ test_expect_success 'UTF-8 non-characters refused' '
printf "Commit message\n\nNon-character:\364\217\277\276\n" \
>"$HOME/invalid" &&
git commit -a -F "$HOME/invalid" 2>"$HOME"/stderr &&
grep "did not conform" "$HOME"/stderr
test_i18ngrep "did not conform" "$HOME"/stderr
'
test_expect_success 'UTF-8 non-characters refused' '
@ -73,7 +73,7 @@ test_expect_success 'UTF-8 non-characters refused' '
printf "Commit message\n\nNon-character:\357\267\220\n" \
>"$HOME/invalid" &&
git commit -a -F "$HOME/invalid" 2>"$HOME"/stderr &&
grep "did not conform" "$HOME"/stderr
test_i18ngrep "did not conform" "$HOME"/stderr
'
for H in ISO8859-1 eucJP ISO-2022-JP

Просмотреть файл

@ -295,7 +295,7 @@ test_expect_success 'am --no-utf8 (U/L)' '
# commit-tree will warn that the commit message does not contain valid UTF-8
# as mailinfo did not convert it
grep "did not conform" err &&
test_i18ngrep "did not conform" err &&
check_encoding 2
'

Просмотреть файл

@ -99,7 +99,7 @@ test_expect_success 'confuses pattern as remote when no remote specified' '
# We could just as easily have used "master"; the "*" emphasizes its
# role as a pattern.
test_must_fail git ls-remote refs*master >actual 2>&1 &&
test_cmp exp actual
test_i18ncmp exp actual
'
test_expect_success 'die with non-2 for wrong repository even with --exit-code' '