Browse Source

Merge branch 'va/i18n-more'

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
maint
Junio C Hamano 8 years ago
parent
commit
8969feac7e
  1. 8
      commit.c
  2. 8
      connect.c
  3. 15
      diff.c
  4. 6
      git-stash.sh
  5. 32
      ident.c
  6. 8
      notes-merge.c
  7. 2
      t/t3310-notes-merge-manual-resolve.sh
  8. 8
      t/t3900-i18n-commit.sh
  9. 2
      t/t3901-i18n-patch.sh
  10. 2
      t/t5512-ls-remote.sh

8
commit.c

@ -1511,9 +1511,9 @@ static int verify_utf8(struct strbuf *buf)
} }


static const char commit_utf8_warn[] = static const char commit_utf8_warn[] =
"Warning: commit message did not conform to UTF-8.\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" "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"; "variable i18n.commitencoding to the encoding your project uses.\n");


int commit_tree_extended(const char *msg, size_t msg_len, int commit_tree_extended(const char *msg, size_t msg_len,
const unsigned char *tree, const unsigned char *tree,
@ -1566,7 +1566,7 @@ int commit_tree_extended(const char *msg, size_t msg_len,


/* And check the encoding */ /* And check the encoding */
if (encoding_is_utf8 && !verify_utf8(&buffer)) 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)) if (sign_commit && do_sign_commit(&buffer, sign_commit))
return -1; return -1;

8
connect.c

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


static void parse_one_symref_info(struct string_list *symref, const char *val, int len) 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 */ 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) static int parse_diff_color_slot(const char *var)
{ {
if (!strcasecmp(var, "context") || !strcasecmp(var, "plain")) 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) if (options->output_format & DIFF_FORMAT_NO_OUTPUT)
count++; count++;
if (count > 1) 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" * 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 == '=') if (*arg == '=')
width = strtoul(arg + 1, &end, 10); width = strtoul(arg + 1, &end, 10);
else if (!*arg && !av[1]) else if (!*arg && !av[1])
die("Option '--stat-width' requires a value"); die_want_option("--stat-width");
else if (!*arg) { else if (!*arg) {
width = strtoul(av[1], &end, 10); width = strtoul(av[1], &end, 10);
argcount = 2; argcount = 2;
@ -3546,7 +3551,7 @@ static int stat_opt(struct diff_options *options, const char **av)
if (*arg == '=') if (*arg == '=')
name_width = strtoul(arg + 1, &end, 10); name_width = strtoul(arg + 1, &end, 10);
else if (!*arg && !av[1]) else if (!*arg && !av[1])
die("Option '--stat-name-width' requires a value"); die_want_option("--stat-name-width");
else if (!*arg) { else if (!*arg) {
name_width = strtoul(av[1], &end, 10); name_width = strtoul(av[1], &end, 10);
argcount = 2; argcount = 2;
@ -3555,7 +3560,7 @@ static int stat_opt(struct diff_options *options, const char **av)
if (*arg == '=') if (*arg == '=')
graph_width = strtoul(arg + 1, &end, 10); graph_width = strtoul(arg + 1, &end, 10);
else if (!*arg && !av[1]) else if (!*arg && !av[1])
die("Option '--stat-graph-width' requires a value"); die_want_option("--stat-graph-width");
else if (!*arg) { else if (!*arg) {
graph_width = strtoul(av[1], &end, 10); graph_width = strtoul(av[1], &end, 10);
argcount = 2; argcount = 2;
@ -3564,7 +3569,7 @@ static int stat_opt(struct diff_options *options, const char **av)
if (*arg == '=') if (*arg == '=')
count = strtoul(arg + 1, &end, 10); count = strtoul(arg + 1, &end, 10);
else if (!*arg && !av[1]) else if (!*arg && !av[1])
die("Option '--stat-count' requires a value"); die_want_option("--stat-count");
else if (!*arg) { else if (!*arg) {
count = strtoul(av[1], &end, 10); count = strtoul(av[1], &end, 10);
argcount = 2; argcount = 2;

6
git-stash.sh

@ -100,7 +100,7 @@ create_stash () {
u_tree=$(git write-tree) && u_tree=$(git write-tree) &&
printf 'untracked files on %s\n' "$msg" | git commit-tree $u_tree && printf 'untracked files on %s\n' "$msg" | git commit-tree $u_tree &&
rm -f "$TMPindex" rm -f "$TMPindex"
) ) || die "Cannot save the untracked files" ) ) || die "$(gettext "Cannot save the untracked files")"


untracked_commit_option="-p $u_commit"; untracked_commit_option="-p $u_commit";
else else
@ -248,7 +248,7 @@ save_stash () {


if test -n "$patch_mode" && test -n "$untracked" if test -n "$patch_mode" && test -n "$untracked"
then 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 fi


stash_msg="$*" stash_msg="$*"
@ -494,7 +494,7 @@ apply_stash () {
GIT_INDEX_FILE="$TMPindex" git-read-tree "$u_tree" && GIT_INDEX_FILE="$TMPindex" git-read-tree "$u_tree" &&
GIT_INDEX_FILE="$TMPindex" git checkout-index --all && GIT_INDEX_FILE="$TMPindex" git checkout-index --all &&
rm -f "$TMPindex" || rm -f "$TMPindex" ||
die 'Could not restore untracked files from stash' die "$(gettext "Could not restore untracked files from stash")"
fi fi


eval " eval "

32
ident.c

@ -331,17 +331,17 @@ person_only:
} }


static const char *env_hint = static const char *env_hint =
"\n" N_("\n"
"*** Please tell me who you are.\n" "*** Please tell me who you are.\n"
"\n" "\n"
"Run\n" "Run\n"
"\n" "\n"
" git config --global user.email \"you@example.com\"\n" " git config --global user.email \"you@example.com\"\n"
" git config --global user.name \"Your Name\"\n" " git config --global user.name \"Your Name\"\n"
"\n" "\n"
"to set your account\'s default identity.\n" "to set your account\'s default identity.\n"
"Omit --global to set the identity only in this repository.\n" "Omit --global to set the identity only in this repository.\n"
"\n"; "\n");


const char *fmt_ident(const char *name, const char *email, const char *fmt_ident(const char *name, const char *email,
const char *date_str, int flag) const char *date_str, int flag)
@ -356,13 +356,13 @@ const char *fmt_ident(const char *name, const char *email,
if (!name) { if (!name) {
if (strict && ident_use_config_only if (strict && ident_use_config_only
&& !(ident_config_given & IDENT_NAME_GIVEN)) { && !(ident_config_given & IDENT_NAME_GIVEN)) {
fputs(env_hint, stderr); fputs(_(env_hint), stderr);
die("no name was given and auto-detection is disabled"); die("no name was given and auto-detection is disabled");
} }
name = ident_default_name(); name = ident_default_name();
using_default = 1; using_default = 1;
if (strict && default_name_is_bogus) { if (strict && default_name_is_bogus) {
fputs(env_hint, stderr); fputs(_(env_hint), stderr);
die("unable to auto-detect name (got '%s')", name); 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; struct passwd *pw;
if (strict) { if (strict) {
if (using_default) if (using_default)
fputs(env_hint, stderr); fputs(_(env_hint), stderr);
die("empty ident name (for <%s>) not allowed", email); die("empty ident name (for <%s>) not allowed", email);
} }
pw = xgetpwuid_self(NULL); pw = xgetpwuid_self(NULL);
@ -381,12 +381,12 @@ const char *fmt_ident(const char *name, const char *email,
if (!email) { if (!email) {
if (strict && ident_use_config_only if (strict && ident_use_config_only
&& !(ident_config_given & IDENT_MAIL_GIVEN)) { && !(ident_config_given & IDENT_MAIL_GIVEN)) {
fputs(env_hint, stderr); fputs(_(env_hint), stderr);
die("no email was given and auto-detection is disabled"); die("no email was given and auto-detection is disabled");
} }
email = ident_default_email(); email = ident_default_email();
if (strict && default_email_is_bogus) { if (strict && default_email_is_bogus) {
fputs(env_hint, stderr); fputs(_(env_hint), stderr);
die("unable to auto-detect email address (got '%s')", email); die("unable to auto-detect email address (got '%s')", email);
} }
} }

8
notes-merge.c

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


if (safe_create_leading_directories_const(git_path( if (safe_create_leading_directories_const(git_path(

2
t/t3310-notes-merge-manual-resolve.sh

@ -225,7 +225,7 @@ test_expect_success 'cannot do merge w/conflicts when previous merge is unfinish
test -d .git/NOTES_MERGE_WORKTREE && test -d .git/NOTES_MERGE_WORKTREE &&
test_must_fail git notes merge z >output 2>&1 && test_must_fail git notes merge z >output 2>&1 &&
# Output should indicate what is wrong # 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 # Setup non-conflicting merge between x and new notes ref w

8
t/t3900-i18n-commit.sh

@ -45,7 +45,7 @@ test_expect_success 'UTF-8 invalid characters refused' '
printf "Commit message\n\nInvalid surrogate:\355\240\200\n" \ printf "Commit message\n\nInvalid surrogate:\355\240\200\n" \
>"$HOME/invalid" && >"$HOME/invalid" &&
git commit -a -F "$HOME/invalid" 2>"$HOME"/stderr && 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' ' 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" \ printf "\340\202\251ommit message\n\nThis is not a space:\300\240\n" \
>"$HOME/invalid" && >"$HOME/invalid" &&
git commit -a -F "$HOME/invalid" 2>"$HOME"/stderr && 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' ' 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" \ printf "Commit message\n\nNon-character:\364\217\277\276\n" \
>"$HOME/invalid" && >"$HOME/invalid" &&
git commit -a -F "$HOME/invalid" 2>"$HOME"/stderr && 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' ' 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" \ printf "Commit message\n\nNon-character:\357\267\220\n" \
>"$HOME/invalid" && >"$HOME/invalid" &&
git commit -a -F "$HOME/invalid" 2>"$HOME"/stderr && 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 for H in ISO8859-1 eucJP ISO-2022-JP

2
t/t3901-i18n-patch.sh

@ -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 # commit-tree will warn that the commit message does not contain valid UTF-8
# as mailinfo did not convert it # as mailinfo did not convert it
grep "did not conform" err && test_i18ngrep "did not conform" err &&


check_encoding 2 check_encoding 2
' '

2
t/t5512-ls-remote.sh

@ -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 # We could just as easily have used "master"; the "*" emphasizes its
# role as a pattern. # role as a pattern.
test_must_fail git ls-remote refs*master >actual 2>&1 && 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' ' test_expect_success 'die with non-2 for wrong repository even with --exit-code' '

Loading…
Cancel
Save