Merge branch 'va/i18n'

More i18n.

* va/i18n:
  i18n: diff: mark warnings for translation
  i18n: credential-cache--daemon: mark advice for translation
  i18n: convert mark error messages for translation
  i18n: apply: mark error message for translation
  i18n: apply: mark error messages for translation
  i18n: apply: mark info messages for translation
  i18n: apply: mark plural string for translation
maint
Junio C Hamano 2016-10-26 13:14:47 -07:00
commit a5ed26702b
6 changed files with 60 additions and 50 deletions

66
apply.c
View File

@ -122,9 +122,9 @@ int check_apply_state(struct apply_state *state, int force_apply)
int is_not_gitdir = !startup_info->have_repository; int is_not_gitdir = !startup_info->have_repository;


if (state->apply_with_reject && state->threeway) if (state->apply_with_reject && state->threeway)
return error("--reject and --3way cannot be used together."); return error(_("--reject and --3way cannot be used together."));
if (state->cached && state->threeway) if (state->cached && state->threeway)
return error("--cached and --3way cannot be used together."); return error(_("--cached and --3way cannot be used together."));
if (state->threeway) { if (state->threeway) {
if (is_not_gitdir) if (is_not_gitdir)
return error(_("--3way outside a repository")); return error(_("--3way outside a repository"));
@ -1586,8 +1586,8 @@ static int find_header(struct apply_state *state,
patch->new_name = xstrdup(patch->def_name); patch->new_name = xstrdup(patch->def_name);
} }
if (!patch->is_delete && !patch->new_name) { if (!patch->is_delete && !patch->new_name) {
error("git diff header lacks filename information " error(_("git diff header lacks filename information "
"(line %d)", state->linenr); "(line %d)"), state->linenr);
return -128; return -128;
} }
patch->is_toplevel_relative = 1; patch->is_toplevel_relative = 1;
@ -3095,8 +3095,8 @@ static int apply_binary_fragment(struct apply_state *state,
/* Binary patch is irreversible without the optional second hunk */ /* Binary patch is irreversible without the optional second hunk */
if (state->apply_in_reverse) { if (state->apply_in_reverse) {
if (!fragment->next) if (!fragment->next)
return error("cannot reverse-apply a binary patch " return error(_("cannot reverse-apply a binary patch "
"without the reverse hunk to '%s'", "without the reverse hunk to '%s'"),
patch->new_name patch->new_name
? patch->new_name : patch->old_name); ? patch->new_name : patch->old_name);
fragment = fragment->next; fragment = fragment->next;
@ -3141,8 +3141,8 @@ static int apply_binary(struct apply_state *state,
strlen(patch->new_sha1_prefix) != 40 || strlen(patch->new_sha1_prefix) != 40 ||
get_oid_hex(patch->old_sha1_prefix, &oid) || get_oid_hex(patch->old_sha1_prefix, &oid) ||
get_oid_hex(patch->new_sha1_prefix, &oid)) get_oid_hex(patch->new_sha1_prefix, &oid))
return error("cannot apply binary patch to '%s' " return error(_("cannot apply binary patch to '%s' "
"without full index line", name); "without full index line"), name);


if (patch->old_name) { if (patch->old_name) {
/* /*
@ -3151,16 +3151,16 @@ static int apply_binary(struct apply_state *state,
*/ */
hash_sha1_file(img->buf, img->len, blob_type, oid.hash); hash_sha1_file(img->buf, img->len, blob_type, oid.hash);
if (strcmp(oid_to_hex(&oid), patch->old_sha1_prefix)) if (strcmp(oid_to_hex(&oid), patch->old_sha1_prefix))
return error("the patch applies to '%s' (%s), " return error(_("the patch applies to '%s' (%s), "
"which does not match the " "which does not match the "
"current contents.", "current contents."),
name, oid_to_hex(&oid)); name, oid_to_hex(&oid));
} }
else { else {
/* Otherwise, the old one must be empty. */ /* Otherwise, the old one must be empty. */
if (img->len) if (img->len)
return error("the patch applies to an empty " return error(_("the patch applies to an empty "
"'%s' but it is not empty", name); "'%s' but it is not empty"), name);
} }


get_oid_hex(patch->new_sha1_prefix, &oid); get_oid_hex(patch->new_sha1_prefix, &oid);
@ -3177,8 +3177,8 @@ static int apply_binary(struct apply_state *state,


result = read_sha1_file(oid.hash, &type, &size); result = read_sha1_file(oid.hash, &type, &size);
if (!result) if (!result)
return error("the necessary postimage %s for " return error(_("the necessary postimage %s for "
"'%s' cannot be read", "'%s' cannot be read"),
patch->new_sha1_prefix, name); patch->new_sha1_prefix, name);
clear_image(img); clear_image(img);
img->buf = result; img->buf = result;
@ -3551,10 +3551,10 @@ static int try_threeway(struct apply_state *state,
write_sha1_file("", 0, blob_type, pre_oid.hash); write_sha1_file("", 0, blob_type, pre_oid.hash);
else if (get_sha1(patch->old_sha1_prefix, pre_oid.hash) || else if (get_sha1(patch->old_sha1_prefix, pre_oid.hash) ||
read_blob_object(&buf, &pre_oid, patch->old_mode)) read_blob_object(&buf, &pre_oid, patch->old_mode))
return error("repository lacks the necessary blob to fall back on 3-way merge."); return error(_("repository lacks the necessary blob to fall back on 3-way merge."));


if (state->apply_verbosity > verbosity_silent) if (state->apply_verbosity > verbosity_silent)
fprintf(stderr, "Falling back to three-way merge...\n"); fprintf(stderr, _("Falling back to three-way merge...\n"));


img = strbuf_detach(&buf, &len); img = strbuf_detach(&buf, &len);
prepare_image(&tmp_image, img, len, 1); prepare_image(&tmp_image, img, len, 1);
@ -3570,11 +3570,11 @@ static int try_threeway(struct apply_state *state,
/* our_oid is ours */ /* our_oid is ours */
if (patch->is_new) { if (patch->is_new) {
if (load_current(state, &tmp_image, patch)) if (load_current(state, &tmp_image, patch))
return error("cannot read the current contents of '%s'", return error(_("cannot read the current contents of '%s'"),
patch->new_name); patch->new_name);
} else { } else {
if (load_preimage(state, &tmp_image, patch, st, ce)) if (load_preimage(state, &tmp_image, patch, st, ce))
return error("cannot read the current contents of '%s'", return error(_("cannot read the current contents of '%s'"),
patch->old_name); patch->old_name);
} }
write_sha1_file(tmp_image.buf, tmp_image.len, blob_type, our_oid.hash); write_sha1_file(tmp_image.buf, tmp_image.len, blob_type, our_oid.hash);
@ -3586,7 +3586,7 @@ static int try_threeway(struct apply_state *state,
if (status < 0) { if (status < 0) {
if (state->apply_verbosity > verbosity_silent) if (state->apply_verbosity > verbosity_silent)
fprintf(stderr, fprintf(stderr,
"Failed to fall back on three-way merge...\n"); _("Failed to fall back on three-way merge...\n"));
return status; return status;
} }


@ -3600,12 +3600,12 @@ static int try_threeway(struct apply_state *state,
oidcpy(&patch->threeway_stage[2], &post_oid); oidcpy(&patch->threeway_stage[2], &post_oid);
if (state->apply_verbosity > verbosity_silent) if (state->apply_verbosity > verbosity_silent)
fprintf(stderr, fprintf(stderr,
"Applied patch to '%s' with conflicts.\n", _("Applied patch to '%s' with conflicts.\n"),
patch->new_name); patch->new_name);
} else { } else {
if (state->apply_verbosity > verbosity_silent) if (state->apply_verbosity > verbosity_silent)
fprintf(stderr, fprintf(stderr,
"Applied patch to '%s' cleanly.\n", _("Applied patch to '%s' cleanly.\n"),
patch->new_name); patch->new_name);
} }
return 0; return 0;
@ -4072,18 +4072,18 @@ static int build_fake_ancestor(struct apply_state *state, struct patch *list)
if (!preimage_oid_in_gitlink_patch(patch, &oid)) if (!preimage_oid_in_gitlink_patch(patch, &oid))
; /* ok, the textual part looks sane */ ; /* ok, the textual part looks sane */
else else
return error("sha1 information is lacking or " return error(_("sha1 information is lacking or "
"useless for submodule %s", name); "useless for submodule %s"), name);
} else if (!get_sha1_blob(patch->old_sha1_prefix, oid.hash)) { } else if (!get_sha1_blob(patch->old_sha1_prefix, oid.hash)) {
; /* ok */ ; /* ok */
} else if (!patch->lines_added && !patch->lines_deleted) { } else if (!patch->lines_added && !patch->lines_deleted) {
/* mode-only change: update the current */ /* mode-only change: update the current */
if (get_current_oid(state, patch->old_name, &oid)) if (get_current_oid(state, patch->old_name, &oid))
return error("mode change for %s, which is not " return error(_("mode change for %s, which is not "
"in current HEAD", name); "in current HEAD"), name);
} else } else
return error("sha1 information is lacking or useless " return error(_("sha1 information is lacking or useless "
"(%s).", name); "(%s)."), name);


ce = make_cache_entry(patch->old_mode, oid.hash, name, 0, 0); ce = make_cache_entry(patch->old_mode, oid.hash, name, 0, 0);
if (!ce) if (!ce)
@ -4091,7 +4091,7 @@ static int build_fake_ancestor(struct apply_state *state, struct patch *list)
name); name);
if (add_index_entry(&result, ce, ADD_CACHE_OK_TO_ADD)) { if (add_index_entry(&result, ce, ADD_CACHE_OK_TO_ADD)) {
free(ce); free(ce);
return error("Could not add %s to temporary index", return error(_("could not add %s to temporary index"),
name); name);
} }
} }
@ -4101,7 +4101,7 @@ static int build_fake_ancestor(struct apply_state *state, struct patch *list)
discard_index(&result); discard_index(&result);


if (res) if (res)
return error("Could not write temporary index to %s", return error(_("could not write temporary index to %s"),
state->fake_ancestor); state->fake_ancestor);


return 0; return 0;
@ -4869,10 +4869,12 @@ int apply_all_patches(struct apply_state *state,
goto end; goto end;
} }
if (state->applied_after_fixing_ws && state->apply) if (state->applied_after_fixing_ws && state->apply)
warning("%d line%s applied after" warning(Q_("%d line applied after"
" fixing whitespace errors.", " fixing whitespace errors.",
state->applied_after_fixing_ws, "%d lines applied after"
state->applied_after_fixing_ws == 1 ? "" : "s"); " fixing whitespace errors.",
state->applied_after_fixing_ws),
state->applied_after_fixing_ws);
else if (state->whitespace_error) else if (state->whitespace_error)
warning(Q_("%d line adds whitespace errors.", warning(Q_("%d line adds whitespace errors.",
"%d lines add whitespace errors.", "%d lines add whitespace errors.",

View File

@ -197,17 +197,21 @@ static void check_safe_crlf(const char *path, enum crlf_action crlf_action,
* CRLFs would not be restored by checkout * CRLFs would not be restored by checkout
*/ */
if (checksafe == SAFE_CRLF_WARN) if (checksafe == SAFE_CRLF_WARN)
warning("CRLF will be replaced by LF in %s.\nThe file will have its original line endings in your working directory.", path); warning(_("CRLF will be replaced by LF in %s.\n"
"The file will have its original line"
" endings in your working directory."), path);
else /* i.e. SAFE_CRLF_FAIL */ else /* i.e. SAFE_CRLF_FAIL */
die("CRLF would be replaced by LF in %s.", path); die(_("CRLF would be replaced by LF in %s."), path);
} else if (old_stats->lonelf && !new_stats->lonelf ) { } else if (old_stats->lonelf && !new_stats->lonelf ) {
/* /*
* CRLFs would be added by checkout * CRLFs would be added by checkout
*/ */
if (checksafe == SAFE_CRLF_WARN) if (checksafe == SAFE_CRLF_WARN)
warning("LF will be replaced by CRLF in %s.\nThe file will have its original line endings in your working directory.", path); warning(_("LF will be replaced by CRLF in %s.\n"
"The file will have its original line"
" endings in your working directory."), path);
else /* i.e. SAFE_CRLF_FAIL */ else /* i.e. SAFE_CRLF_FAIL */
die("LF would be replaced by CRLF in %s", path); die(_("LF would be replaced by CRLF in %s"), path);
} }
} }



View File

@ -219,11 +219,11 @@ static void serve_cache(const char *socket_path, int debug)
close(fd); close(fd);
} }


static const char permissions_advice[] = static const char permissions_advice[] = N_(
"The permissions on your socket directory are too loose; other\n" "The permissions on your socket directory are too loose; other\n"
"users may be able to read your cached credentials. Consider running:\n" "users may be able to read your cached credentials. Consider running:\n"
"\n" "\n"
" chmod 0700 %s"; " chmod 0700 %s");
static void init_socket_directory(const char *path) static void init_socket_directory(const char *path)
{ {
struct stat st; struct stat st;
@ -232,7 +232,7 @@ static void init_socket_directory(const char *path)


if (!stat(dir, &st)) { if (!stat(dir, &st)) {
if (st.st_mode & 077) if (st.st_mode & 077)
die(permissions_advice, dir); die(_(permissions_advice), dir);
} else { } else {
/* /*
* We must be sure to create the directory with the correct mode, * We must be sure to create the directory with the correct mode,

14
diff.c
View File

@ -4680,25 +4680,25 @@ static int is_summary_empty(const struct diff_queue_struct *q)
} }


static const char rename_limit_warning[] = static const char rename_limit_warning[] =
"inexact rename detection was skipped due to too many files."; N_("inexact rename detection was skipped due to too many files.");


static const char degrade_cc_to_c_warning[] = static const char degrade_cc_to_c_warning[] =
"only found copies from modified paths due to too many files."; N_("only found copies from modified paths due to too many files.");


static const char rename_limit_advice[] = static const char rename_limit_advice[] =
"you may want to set your %s variable to at least " N_("you may want to set your %s variable to at least "
"%d and retry the command."; "%d and retry the command.");


void diff_warn_rename_limit(const char *varname, int needed, int degraded_cc) void diff_warn_rename_limit(const char *varname, int needed, int degraded_cc)
{ {
if (degraded_cc) if (degraded_cc)
warning(degrade_cc_to_c_warning); warning(_(degrade_cc_to_c_warning));
else if (needed) else if (needed)
warning(rename_limit_warning); warning(_(rename_limit_warning));
else else
return; return;
if (0 < needed && needed < 32767) if (0 < needed && needed < 32767)
warning(rename_limit_advice, varname, needed); warning(_(rename_limit_advice), varname, needed);
} }


void diff_flush(struct diff_options *options) void diff_flush(struct diff_options *options)

View File

@ -83,7 +83,11 @@ test_expect_success 'safecrlf: print warning only once' '
git add doublewarn && git add doublewarn &&
git commit -m "nowarn" && git commit -m "nowarn" &&
for w in Oh here is CRLFQ in text; do echo $w; done | q_to_cr >doublewarn && for w in Oh here is CRLFQ in text; do echo $w; done | q_to_cr >doublewarn &&
test $(git add doublewarn 2>&1 | grep "CRLF will be replaced by LF" | wc -l) = 1 git add doublewarn 2>err &&
if test_have_prereq C_LOCALE_OUTPUT
then
test $(grep "CRLF will be replaced by LF" err | wc -l) = 1
fi
' '





View File

@ -31,7 +31,7 @@ test_expect_success 'try to apply corrupted patch' '
test_expect_success 'compare diagnostic; ensure file is still here' ' test_expect_success 'compare diagnostic; ensure file is still here' '
echo "error: git diff header lacks filename information (line 4)" >expected && echo "error: git diff header lacks filename information (line 4)" >expected &&
test_path_is_file f && test_path_is_file f &&
test_cmp expected actual test_i18ncmp expected actual
' '


test_done test_done