This series makes the first 4 C mainporcelain common commands
translatable with gettext.
I'm avoiding translating things like git-bisect for now simply because
I have some scripts to make this easier that are currently aimed at
the C code.
$ grep 'mainporcelain common' *txt
* git-add mainporcelain common
git-bisect mainporcelain common
* git-branch mainporcelain common
* git-checkout mainporcelain common
* git-clone mainporcelain common
git-commit mainporcelain common
...
This is around 3 patches per command (so at this rate I should finish
all 22 commands in ~63 patches).
I'm making an effort to split these up into different types of
messages for discussion.
Ævar Arnfjörð Bjarmason (13):
git-clone: use builtin.h to get gettext.h
gettextize: git-clone basic messages
gettextize: git-clone "Cloning into" message
gettextize: git-add basic messages
gettextize: git-add refresh_index message
gettextize: git-branch basic messages
gettextize: git-branch "remote branch '%s' not found" message
gettextize: git-branch "git branch -v" messages
gettextize: git-branch "(no branch)" message
gettextize: git-checkout: our/their version message
gettextize: git-checkout basic messages
gettextize: git-checkout describe_detached_head messages
gettextize: git-checkout "Switched to a .. branch" message
builtin/add.c | 46 +++++++++++++-------------
builtin/branch.c | 69 +++++++++++++++++++-------------------
builtin/checkout.c | 93 +++++++++++++++++++++++++++-------------------------
builtin/clone.c | 63 ++++++++++++++++++-----------------
4 files changed, 138 insertions(+), 133 deletions(-)
--
1.7.2.2.579.g2183d
Change builtin/clone.c to use builtin.h. The only other command in
'mainporcelain common' which doesn't include it yet is builtin/reset.c
Signed-off-by: Ævar Arnfjörð Bjarmason <redacted>
---
This is just here so that the series applies stand-alone to pu. It's
made redundant by my "[PATCH] builtin: use builtin.h for all builtin/
commands" patch, but Junio expressed some reservations about it, so
here's a more minimal version sufficient for this series.
builtin/clone.c | 3 +--
1 files changed, 1 insertions(+), 2 deletions(-)
Split up the "Cloning into %s" and "Cloning into bare repository %s"
messages to make them easier to translate.
Signed-off-by: Ævar Arnfjörð Bjarmason <redacted>
---
builtin/clone.c | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
@@ -466,8 +466,10 @@ int cmd_clone(int argc, const char **argv, const char *prefix)set_git_dir(make_absolute_path(git_dir));if(0<=option_verbosity)-printf("Cloning into %s%s...\n",-option_bare?"bare repository ":"",dir);+if(option_bare)+printf(_("Cloning into bare repository %s"),dir);+else+printf(_("Cloning into %s"),dir);init_db(option_template,INIT_DB_QUIET);/*
@@ -117,7 +117,7 @@ static int check_all_stages(struct cache_entry *ce, int pos)ce_stage(active_cache[pos+1])!=2||strcmp(active_cache[pos+2]->name,ce->name)||ce_stage(active_cache[pos+2])!=3)-returnerror("path '%s' does not have all three versions",+returnerror(_("path '%s' does not have all three versions"),ce->name);return0;}
@@ -152,7 +152,7 @@ static int checkout_merged(int pos, struct checkout *state)ce_stage(active_cache[pos+1])!=2||strcmp(active_cache[pos+2]->name,path)||ce_stage(active_cache[pos+2])!=3)-returnerror("path '%s' does not have all 3 versions",path);+returnerror(_("path '%s' does not have all 3 versions"),path);read_mmblob(&ancestor,active_cache[pos]->sha1);read_mmblob(&ours,active_cache[pos+1]->sha1);
@@ -186,12 +186,12 @@ static int checkout_merged(int pos, struct checkout *state)*/if(write_sha1_file(result_buf.ptr,result_buf.size,blob_type,sha1))-die("Unable to add merge result for '%s'",path);+die(_("Unable to add merge result for '%s'"),path);ce=make_cache_entry(create_ce_mode(active_cache[pos+1]->ce_mode),sha1,path,2,0);if(!ce)-die("make_cache_entry failed for path '%s'",path);+die(_("make_cache_entry failed for path '%s'"),path);status=checkout_entry(ce,state,NULL);returnstatus;}
@@ -213,7 +213,7 @@ static int checkout_paths(struct tree *source_tree, const char **pathspec,newfd=hold_locked_index(lock_file,1);if(read_cache_preload(pathspec)<0)-returnerror("corrupt index file");+returnerror(_("corrupt index file"));if(source_tree)read_tree_some(source_tree,pathspec);
@@ -241,14 +241,14 @@ static int checkout_paths(struct tree *source_tree, const char **pathspec,if(!ce_stage(ce))continue;if(opts->force){-warning("path '%s' is unmerged",ce->name);+warning(_("path '%s' is unmerged"),ce->name);}elseif(stage){errs|=check_stage(stage,ce,pos);}elseif(opts->merge){errs|=check_all_stages(ce,pos);}else{errs=1;-error("path '%s' is unmerged",ce->name);+error(_("path '%s' is unmerged"),ce->name);}pos=skip_same_name(ce,pos)-1;}
@@ -277,7 +277,7 @@ static int checkout_paths(struct tree *source_tree, const char **pathspec,if(write_cache(newfd,active_cache,active_nr)||commit_locked_index(lock_file))-die("unable to write new index file");+die(_("unable to write new index file"));resolve_ref("HEAD",rev,0,&flag);head=lookup_commit_reference_gently(rev,1);
@@ -368,7 +368,7 @@ static int merge_working_tree(struct checkout_opts *opts,intnewfd=hold_locked_index(lock_file,1);if(read_cache_preload(NULL)<0)-returnerror("corrupt index file");+returnerror(_("corrupt index file"));resolve_undo_clear();if(opts->force){
@@ -390,7 +390,7 @@ static int merge_working_tree(struct checkout_opts *opts,refresh_cache(REFRESH_QUIET);if(unmerged_cache()){-error("you need to resolve your current index first");+error(_("you need to resolve your current index first"));return1;}
@@ -475,7 +475,7 @@ static int merge_working_tree(struct checkout_opts *opts,if(write_cache(newfd,active_cache,active_nr)||commit_locked_index(lock_file))-die("unable to write new index file");+die(_("unable to write new index file"));if(!opts->force&&!opts->quiet)show_local_changes(&new->commit->object,&opts->diff_options);
@@ -524,7 +524,7 @@ static void update_refs_for_switch(struct checkout_opts *opts,temp=log_all_ref_updates;log_all_ref_updates=1;if(log_ref_setup(ref_name,log_file,sizeof(log_file))){-fprintf(stderr,"Can not do reflog for '%s'\n",+fprintf(stderr,_("Can not do reflog for '%s'\n"),opts->new_orphan_branch);log_all_ref_updates=temp;return;
@@ -550,14 +550,14 @@ static void update_refs_for_switch(struct checkout_opts *opts,create_symref("HEAD",new->path,msg.buf);if(!opts->quiet){if(old->path&&!strcmp(new->path,old->path))-fprintf(stderr,"Already on '%s'\n",+fprintf(stderr,_("Already on '%s'\n"),new->name);elseif(opts->new_branch)fprintf(stderr,"Switched to%s branch '%s'\n",opts->branch_exists?" and reset":" a new",new->name);else-fprintf(stderr,"Switched to branch '%s'\n",+fprintf(stderr,_("Switched to branch '%s'\n"),new->name);}if(old->path&&old->name){
@@ -602,7 +602,7 @@ static int switch_branches(struct checkout_opts *opts, struct branch_info *new)new->name="HEAD";new->commit=old.commit;if(!new->commit)-die("You are on a branch yet to be born");+die(_("You are on a branch yet to be born"));parse_commit(new->commit);}
@@ -731,7 +731,7 @@ int cmd_checkout(int argc, const char **argv, const char *prefix)/* we can assume from now on new_branch = !new_branch_force */if(opts.new_branch&&opts.new_branch_force)-die("-B cannot be used with -b");+die(_("-B cannot be used with -b"));/* copy -B over to -b, so that we can just check the latter */if(opts.new_branch_force)
@@ -739,28 +739,28 @@ int cmd_checkout(int argc, const char **argv, const char *prefix)if(patch_mode&&(opts.track>0||opts.new_branch||opts.new_branch_log||opts.merge||opts.force))-die("--patch is incompatible with all other options");+die(_("--patch is incompatible with all other options"));/* --track without -b should DWIM */if(0<opts.track&&!opts.new_branch){constchar*argv0=argv[0];if(!argc||!strcmp(argv0,"--"))-die("--track needs a branch name");+die(_("--track needs a branch name"));if(!prefixcmp(argv0,"refs/"))argv0+=5;if(!prefixcmp(argv0,"remotes/"))argv0+=8;argv0=strchr(argv0,'/');if(!argv0||!argv0[1])-die("Missing branch name; try -b");+die(_("Missing branch name; try -b"));opts.new_branch=argv0+1;}if(opts.new_orphan_branch){if(opts.new_branch)-die("--orphan and -b|-B are mutually exclusive");+die(_("--orphan and -b|-B are mutually exclusive"));if(opts.track>0)-die("--orphan cannot be used with -t");+die(_("--orphan cannot be used with -t"));opts.new_branch=opts.new_orphan_branch;}
@@ -770,7 +770,7 @@ int cmd_checkout(int argc, const char **argv, const char *prefix)}if(opts.force&&opts.merge)-die("git checkout: -f and -m are incompatible");+die(_("git checkout: -f and -m are incompatible"));/**case1:gitcheckout<ref>--[<paths>]
@@ -816,7 +816,7 @@ int cmd_checkout(int argc, const char **argv, const char *prefix)if(get_sha1_mb(arg,rev)){if(has_dash_dash)/* case (1) */-die("invalid reference: %s",arg);+die(_("invalid reference: %s"),arg);if(!patch_mode&&dwim_new_local_branch&&opts.track==BRANCH_TRACK_UNSPECIFIED&&
@@ -853,7 +853,7 @@ int cmd_checkout(int argc, const char **argv, const char *prefix)source_tree=parse_tree_indirect(rev);if(!source_tree)/* case (1): want a tree */-die("reference is not a tree: %s",arg);+die(_("reference is not a tree: %s"),arg);if(!has_dash_dash){/* case (3 -> 1) *//**Donotcomplainthemostcommoncase
@@ -887,14 +887,14 @@ no_reference:/* Checkout paths */if(opts.new_branch){if(argc==1){-die("git checkout: updating paths is incompatible with switching branches.\nDid you intend to checkout '%s' which can not be resolved as commit?",argv[0]);+die(_("git checkout: updating paths is incompatible with switching branches.\nDid you intend to checkout '%s' which can not be resolved as commit?"),argv[0]);}else{-die("git checkout: updating paths is incompatible with switching branches.");+die(_("git checkout: updating paths is incompatible with switching branches."));}}if(1<!!opts.writeout_stage+!!opts.force+!!opts.merge)-die("git checkout: --ours/--theirs, --force and --merge are incompatible when\nchecking out of the index.");+die(_("git checkout: --ours/--theirs, --force and --merge are incompatible when\nchecking out of the index."));returncheckout_paths(source_tree,pathspec,&opts);}
@@ -905,22 +905,22 @@ no_reference:if(opts.new_branch){structstrbufbuf=STRBUF_INIT;if(strbuf_check_branch_ref(&buf,opts.new_branch))-die("git checkout: we do not like '%s' as a branch name.",+die(_("git checkout: we do not like '%s' as a branch name."),opts.new_branch);if(!get_sha1(buf.buf,rev)){opts.branch_exists=1;if(!opts.new_branch_force)-die("git checkout: branch %s already exists",+die(_("git checkout: branch %s already exists"),opts.new_branch);}strbuf_release(&buf);}if(new.name&&!new.commit){-die("Cannot switch branch to a non-commit.");+die(_("Cannot switch branch to a non-commit."));}if(opts.writeout_stage)-die("--ours/--theirs is incompatible with switching branches.");+die(_("--ours/--theirs is incompatible with switching branches."));returnswitch_branches(&opts,&new);}
This is possibly a plumbing message.
Signed-off-by: Ævar Arnfjörð Bjarmason <redacted>
---
ditto about the maybe plumbing output, but I think not.
builtin/branch.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
@@ -205,7 +205,7 @@ static void setup_reference(const char *repo)if(is_directory(mkpath("%s/.git/objects",ref_git)))ref_git=mkpath("%s/.git",ref_git);elseif(!is_directory(mkpath("%s/objects",ref_git)))-die("reference repository '%s' is not a local directory.",+die(_("reference repository '%s' is not a local directory."),option_reference);ref_git_copy=xstrdup(ref_git);
@@ -232,15 +232,15 @@ static void copy_or_link_directory(struct strbuf *src, struct strbuf *dest)dir=opendir(src->buf);if(!dir)-die_errno("failed to open '%s'",src->buf);+die_errno(_("failed to open '%s'"),src->buf);if(mkdir(dest->buf,0777)){if(errno!=EEXIST)-die_errno("failed to create directory '%s'",dest->buf);+die_errno(_("failed to create directory '%s'"),dest->buf);elseif(stat(dest->buf,&buf))-die_errno("failed to stat '%s'",dest->buf);+die_errno(_("failed to stat '%s'"),dest->buf);elseif(!S_ISDIR(buf.st_mode))-die("%s exists and is not a directory",dest->buf);+die(_("%s exists and is not a directory"),dest->buf);}strbuf_addch(src,'/');
@@ -254,7 +254,7 @@ static void copy_or_link_directory(struct strbuf *src, struct strbuf *dest)strbuf_setlen(dest,dest_len);strbuf_addstr(dest,de->d_name);if(stat(src->buf,&buf)){-warning("failed to stat %s\n",src->buf);+warning(_("failed to stat %s\n"),src->buf);continue;}if(S_ISDIR(buf.st_mode)){
@@ -264,16 +264,16 @@ static void copy_or_link_directory(struct strbuf *src, struct strbuf *dest)}if(unlink(dest->buf)&&errno!=ENOENT)-die_errno("failed to unlink '%s'",dest->buf);+die_errno(_("failed to unlink '%s'"),dest->buf);if(!option_no_hardlinks){if(!link(src->buf,dest->buf))continue;if(option_local)-die_errno("failed to create link '%s'",dest->buf);+die_errno(_("failed to create link '%s'"),dest->buf);option_no_hardlinks=1;}if(copy_file_with_time(dest->buf,src->buf,0666))-die_errno("failed to copy file to '%s'",dest->buf);+die_errno(_("failed to copy file to '%s'"),dest->buf);}closedir(dir);}
@@ -384,11 +384,11 @@ int cmd_clone(int argc, const char **argv, const char *prefix)builtin_clone_usage,0);if(argc>2)-usage_msg_opt("Too many arguments.",+usage_msg_opt(_("Too many arguments."),builtin_clone_usage,builtin_clone_options);if(argc==0)-usage_msg_opt("You must specify a repository to clone.",+usage_msg_opt(_("You must specify a repository to clone."),builtin_clone_usage,builtin_clone_options);if(option_mirror)
@@ -396,7 +396,7 @@ int cmd_clone(int argc, const char **argv, const char *prefix)if(option_bare){if(option_origin)-die("--bare and --origin %s options are incompatible.",+die(_("--bare and --origin %s options are incompatible."),option_origin);option_no_checkout=1;}
@@ -415,7 +415,7 @@ int cmd_clone(int argc, const char **argv, const char *prefix)repo=repo_name;is_local=path&&!is_bundle;if(is_local&&option_depth)-warning("--depth is ignored in local clones; use file:// instead.");+warning(_("--depth is ignored in local clones; use file:// instead."));if(argc==2)dir=xstrdup(argv[1]);
@@ -425,8 +425,8 @@ int cmd_clone(int argc, const char **argv, const char *prefix)dest_exists=!stat(dir,&buf);if(dest_exists&&!is_empty_dir(dir))-die("destination path '%s' already exists and is not "-"an empty directory.",dir);+die(_("destination path '%s' already exists and is not "+"an empty directory."),dir);strbuf_addf(&reflog_msg,"clone: from %s",repo);
@@ -435,7 +435,7 @@ int cmd_clone(int argc, const char **argv, const char *prefix)else{work_tree=getenv("GIT_WORK_TREE");if(work_tree&&!stat(work_tree,&buf))-die("working tree '%s' already exists.",work_tree);+die(_("working tree '%s' already exists."),work_tree);}if(option_bare||work_tree)
@@ -448,10 +448,10 @@ int cmd_clone(int argc, const char **argv, const char *prefix)if(!option_bare){junk_work_tree=work_tree;if(safe_create_leading_directories_const(work_tree)<0)-die_errno("could not create leading directories of '%s'",+die_errno(_("could not create leading directories of '%s'"),work_tree);if(!dest_exists&&mkdir(work_tree,0755))-die_errno("could not create work tree dir '%s'.",+die_errno(_("could not create work tree dir '%s'."),work_tree);set_git_work_tree(work_tree);}
@@ -462,7 +462,7 @@ int cmd_clone(int argc, const char **argv, const char *prefix)setenv(CONFIG_ENVIRONMENT,mkpath("%s/config",git_dir),1);if(safe_create_leading_directories_const(git_dir)<0)-die("could not create leading directories of '%s'",git_dir);+die(_("could not create leading directories of '%s'"),git_dir);set_git_dir(make_absolute_path(git_dir));if(0<=option_verbosity)
@@ -524,7 +524,7 @@ int cmd_clone(int argc, const char **argv, const char *prefix)transport=transport_get(remote,remote->url[0]);if(!transport->get_refs_list||!transport->fetch)-die("Don't know how to clone %s",transport->url);+die(_("Don't know how to clone %s"),transport->url);transport_set_option(transport,TRANS_OPT_KEEP,"yes");
@@ -563,8 +563,8 @@ int cmd_clone(int argc, const char **argv, const char *prefix)strbuf_release(&head);if(!our_head_points_at){-warning("Remote branch %s not found in "-"upstream %s, using HEAD instead",+warning(_("Remote branch %s not found in "+"upstream %s, using HEAD instead"),option_branch,option_origin);our_head_points_at=remote_head_points_at;}
@@ -573,7 +573,7 @@ int cmd_clone(int argc, const char **argv, const char *prefix)our_head_points_at=remote_head_points_at;}else{-warning("You appear to have cloned an empty repository.");+warning(_("You appear to have cloned an empty repository."));our_head_points_at=NULL;remote_head_points_at=NULL;remote_head=NULL;
@@ -615,8 +615,8 @@ int cmd_clone(int argc, const char **argv, const char *prefix)}else{/* Nothing to checkout out */if(!option_no_checkout)-warning("remote HEAD refers to nonexistent ref, "-"unable to checkout.\n");+warning(_("remote HEAD refers to nonexistent ref, "+"unable to checkout.\n"));option_no_checkout=1;}
@@ -652,7 +652,7 @@ int cmd_clone(int argc, const char **argv, const char *prefix)if(write_cache(fd,active_cache,active_nr)||commit_locked_index(lock_file))-die("unable to write new index file");+die(_("unable to write new index file"));err|=run_hook(NULL,"post-checkout",sha1_to_hex(null_sha1),sha1_to_hex(our_head_points_at->old_sha1),"1",
Signed-off-by: Ævar Arnfjörð Bjarmason <redacted>
---
This is comparable to the basic messages, but I put it in its own
patch mainly as a reminder to myself, this maybe needs to be split
into a %s format in the future.
builtin/checkout.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
@@ -574,7 +574,7 @@ static void update_refs_for_switch(struct checkout_opts *opts,if(!opts->quiet){if(old->path&&advice_detached_head)detach_advice(old->path,new->name);-describe_detached_head("HEAD is now at",new->commit);+describe_detached_head(_("HEAD is now at"),new->commit);}}remove_branch_state();
@@ -616,7 +616,7 @@ static int switch_branches(struct checkout_opts *opts, struct branch_info *new)*toremindtheuserthatitmightbelost.*/if(!opts->quiet&&!old.path&&old.commit&&new->commit!=old.commit)-describe_detached_head("Previous HEAD position was",old.commit);+describe_detached_head(_("Previous HEAD position was"),old.commit);update_refs_for_switch(opts,&old,new);
Signed-off-by: Ævar Arnfjörð Bjarmason <redacted>
---
I can't find the command that makes this message appear, but it seems
to be a human-readable header printed by "git-add".
builtin/add.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
@@ -188,7 +188,7 @@ static void refresh(int verbose, const char **pathspec)/* nothing */;seen=xcalloc(specs,1);refresh_index(&the_index,verbose?REFRESH_IN_PORCELAIN:REFRESH_QUIET,-pathspec,seen,"Unstaged changes after refreshing the index:");+pathspec,seen,_("Unstaged changes after refreshing the index:"));for(i=0;i<specs;i++){if(!seen[i])die(_("pathspec '%s' did not match any files"),pathspec[i]);
From: Jonathan Nieder <hidden> Date: 2016-06-15 22:49:28
On Wed, Sep 01, 2010 at 08:43:57PM +0000, Ævar Arnfjörð Bjarmason wrote:
Signed-off-by: Ævar Arnfjörð Bjarmason <redacted>
---
I can't find the command that makes this message appear
$ git reset HEAD^ 2>/dev/null
$ git add -v --refresh .
Unstaged changes after refreshing the index:
M builtin/apply.c
M builtin/bundle.c
M builtin/config.c
M builtin/grep.c
M builtin/index-pack.c
M builtin/ls-remote.c
M builtin/merge-file.c
M builtin/shortlog.c
M builtin/var.c
M cache.h
M environment.c
M git.c
M setup.c
M t/t1501-worktree.sh
M t/t7006-pager.sh
Definitely porcelain.
Split up the "does not have our/their version" message to make it
easier to translate.
Signed-off-by: Ævar Arnfjörð Bjarmason <redacted>
---
I'm splitting this sort of thing into an if/else rather than:
printf(foo ? _("bar") : _("blah"), ...)
because I think the alternative is harder to read.
builtin/checkout.c | 14 ++++++++------
1 files changed, 8 insertions(+), 6 deletions(-)
@@ -103,9 +103,10 @@ static int check_stage(int stage, struct cache_entry *ce, int pos)return0;pos++;}-returnerror("path '%s' does not have %s version",-ce->name,-(stage==2)?"our":"their");+if(stage==2)+returnerror(_("path '%s' does not have our version"),ce->name);+else+returnerror(_("path '%s' does not have their version"),ce->name);}staticintcheck_all_stages(structcache_entry*ce,intpos)
@@ -130,9 +131,10 @@ static int checkout_stage(int stage, struct cache_entry *ce, int pos,returncheckout_entry(active_cache[pos],state,NULL);pos++;}-returnerror("path '%s' does not have %s version",-ce->name,-(stage==2)?"our":"their");+if(stage==2)+returnerror(_("path '%s' does not have our version"),ce->name);+else+returnerror(_("path '%s' does not have their version"),ce->name);}staticintcheckout_merged(intpos,structcheckout*state)
Split up the "Switched to and reset branch" and "Switched to a new
branch" messages to make them easier to translate.
Signed-off-by: Ævar Arnfjörð Bjarmason <redacted>
---
builtin/checkout.c | 7 ++++---
1 files changed, 4 insertions(+), 3 deletions(-)
@@ -553,9 +553,10 @@ static void update_refs_for_switch(struct checkout_opts *opts,fprintf(stderr,_("Already on '%s'\n"),new->name);elseif(opts->new_branch)-fprintf(stderr,"Switched to%s branch '%s'\n",-opts->branch_exists?" and reset":" a new",-new->name);+if(opts->branch_exists)+fprintf(stderr,_("Switched to and reset branch '%s'\n"),new->name);+else+fprintf(stderr,_("Switched to a new branch '%s'\n"),new->name);elsefprintf(stderr,_("Switched to branch '%s'\n"),new->name);
@@ -172,7 +172,7 @@ static void treat_gitlinks(const char **pathspec)/* strip trailing slash */pathspec[j]=xstrndup(ce->name,len);else-die("Path '%s' is in submodule '%.*s'",+die(_("Path '%s' is in submodule '%.*s'"),pathspec[j],len,ce->name);}}
@@ -191,7 +191,7 @@ static void refresh(int verbose, const char **pathspec)pathspec,seen,"Unstaged changes after refreshing the index:");for(i=0;i<specs;i++){if(!seen[i])-die("pathspec '%s' did not match any files",pathspec[i]);+die(_("pathspec '%s' did not match any files"),pathspec[i]);}free(seen);}
@@ -205,7 +205,7 @@ static const char **validate_pathspec(int argc, const char **argv, const char *pfor(p=pathspec;*p;p++){if(has_symlink_leading_path(*p,strlen(*p))){intlen=prefix?strlen(prefix):0;-die("'%s' is beyond a symbolic link",*p+len);+die(_("'%s' is beyond a symbolic link"),*p+len);}}}
@@ -272,7 +272,7 @@ static int edit_patch(int argc, const char **argv, const char *prefix)git_config(git_diff_basic_config,NULL);/* no "diff" UI options */if(read_cache()<0)-die("Could not read the index");+die(_("Could not read the index"));init_revisions(&rev,prefix);rev.diffopt.context=7;
@@ -281,24 +281,24 @@ static int edit_patch(int argc, const char **argv, const char *prefix)rev.diffopt.output_format=DIFF_FORMAT_PATCH;out=open(file,O_CREAT|O_WRONLY,0644);if(out<0)-die("Could not open '%s' for writing.",file);+die(_("Could not open '%s' for writing."),file);rev.diffopt.file=xfdopen(out,"w");rev.diffopt.close_file=1;if(run_diff_files(&rev,0))-die("Could not write patch");+die(_("Could not write patch"));launch_editor(file,NULL,NULL);if(stat(file,&st))-die_errno("Could not stat '%s'",file);+die_errno(_("Could not stat '%s'"),file);if(!st.st_size)-die("Empty patch. Aborted.");+die(_("Empty patch. Aborted."));memset(&child,0,sizeof(child));child.git_cmd=1;child.argv=apply_argv;if(run_command(&child))-die("Could not apply '%s'",file);+die(_("Could not apply '%s'"),file);unlink(file);return0;
@@ -346,14 +346,14 @@ static int add_files(struct dir_struct *dir, int flags)fprintf(stderr,ignore_error);for(i=0;i<dir->ignored_nr;i++)fprintf(stderr,"%s\n",dir->ignored[i]->name);-fprintf(stderr,"Use -f if you really want to add them.\n");-die("no files added");+fprintf(stderr,_("Use -f if you really want to add them.\n"));+die(_("no files added"));}for(i=0;i<dir->nr;i++)if(add_file_to_cache(dir->entries[i]->name,flags)){if(!ignore_add_errors)-die("adding files failed");+die(_("adding files failed"));exit_status=1;}returnexit_status;
@@ -385,9 +385,9 @@ int cmd_add(int argc, const char **argv, const char *prefix)argv++;if(addremove&&take_worktree_changes)-die("-A and -u are mutually incompatible");+die(_("-A and -u are mutually incompatible"));if(!show_only&&ignore_missing)-die("Option --ignore-missing can only be used together with --dry-run");+die(_("Option --ignore-missing can only be used together with --dry-run"));if((addremove||take_worktree_changes)&&!argc){staticconstchar*here[2]={".",NULL};argc=1;
@@ -407,14 +407,14 @@ int cmd_add(int argc, const char **argv, const char *prefix)?ADD_CACHE_IGNORE_REMOVAL:0));if(require_pathspec&&argc==0){-fprintf(stderr,"Nothing specified, nothing added.\n");-fprintf(stderr,"Maybe you wanted to say 'git add .'?\n");+fprintf(stderr,_("Nothing specified, nothing added.\n"));+fprintf(stderr,_("Maybe you wanted to say 'git add .'?\n"));return0;}pathspec=validate_pathspec(argc,argv,prefix);if(read_cache()<0)-die("index file corrupt");+die(_("index file corrupt"));treat_gitlinks(pathspec);if(add_new_files){
@@ -449,7 +449,7 @@ int cmd_add(int argc, const char **argv, const char *prefix)if(excluded(&dir,pathspec[i],DT_UNKNOWN))dir_add_ignored(&dir,pathspec[i],strlen(pathspec[i]));}else-die("pathspec '%s' did not match any files",+die(_("pathspec '%s' did not match any files"),pathspec[i]);}}
@@ -465,7 +465,7 @@ int cmd_add(int argc, const char **argv, const char *prefix)if(active_cache_changed){if(write_cache(newfd,active_cache,active_nr)||commit_locked_index(&lock_file))-die("Unable to write new index file");+die(_("Unable to write new index file"));}returnexit_status;
This could be done better by splitting it up, but it would change too
much code, which I'm trying to avoid at this point. Instead add a
TRANSLATORS comment to explain what "remote " does.
Signed-off-by: Ævar Arnfjörð Bjarmason <redacted>
---
builtin/branch.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
@@ -157,7 +157,8 @@ static int delete_branches(int argc, const char **argv, int force, int kinds)switch(kinds){caseREF_REMOTE_BRANCH:fmt="refs/remotes/%s";-remote="remote ";+/* TRANSLATORS: This is "remote " in "remote branch '%s' not found" */+remote=_("remote ");force=1;break;caseREF_LOCAL_BRANCH:
@@ -133,12 +133,12 @@ static int branch_merged(int kind, const char *name,if((head_rev!=reference_rev)&&in_merge_bases(rev,&head_rev,1)!=merged){if(merged)-warning("deleting branch '%s' that has been merged to\n"-" '%s', but it is not yet merged to HEAD.",+warning(_("deleting branch '%s' that has been merged to\n"+" '%s', but it is not yet merged to HEAD."),name,reference_name);else-warning("not deleting branch '%s' that is not yet merged to\n"-" '%s', even though it is merged to HEAD.",+warning(_("not deleting branch '%s' that is not yet merged to\n"+" '%s', even though it is merged to HEAD."),name,reference_name);}returnmerged;
@@ -165,19 +165,19 @@ static int delete_branches(int argc, const char **argv, int force, int kinds)remote="";break;default:-die("cannot use -a with -d");+die(_("cannot use -a with -d"));}if(!force){head_rev=lookup_commit_reference(head_sha1);if(!head_rev)-die("Couldn't look up commit object for HEAD");+die(_("Couldn't look up commit object for HEAD"));}for(i=0;i<argc;i++,strbuf_release(&bname)){strbuf_branchname(&bname,argv[i]);if(kinds==REF_LOCAL_BRANCH&&!strcmp(head,bname.buf)){-error("Cannot delete the branch '%s' "-"which you are currently on.",bname.buf);+error(_("Cannot delete the branch '%s' "+"which you are currently on."),bname.buf);ret=1;continue;}
@@ -186,7 +186,7 @@ static int delete_branches(int argc, const char **argv, int force, int kinds)name=xstrdup(mkpath(fmt,bname.buf));if(!resolve_ref(name,sha1,1,NULL)){-error("%sbranch '%s' not found.",+error(_("%sbranch '%s' not found."),remote,bname.buf);ret=1;continue;
@@ -194,31 +194,31 @@ static int delete_branches(int argc, const char **argv, int force, int kinds)rev=lookup_commit_reference(sha1);if(!rev){-error("Couldn't look up commit object for '%s'",name);+error(_("Couldn't look up commit object for '%s'"),name);ret=1;continue;}if(!force&&!branch_merged(kinds,bname.buf,rev,head_rev)){-error("The branch '%s' is not fully merged.\n"+error(_("The branch '%s' is not fully merged.\n""If you are sure you want to delete it, "-"run 'git branch -D %s'.",bname.buf,bname.buf);+"run 'git branch -D %s'."),bname.buf,bname.buf);ret=1;continue;}if(delete_ref(name,sha1,0)){-error("Error deleting %sbranch '%s'",remote,+error(_("Error deleting %sbranch '%s'"),remote,bname.buf);ret=1;}else{structstrbufbuf=STRBUF_INIT;-printf("Deleted %sbranch %s (was %s).\n",remote,+printf(_("Deleted %sbranch %s (was %s).\n"),remote,bname.buf,find_unique_abbrev(sha1,DEFAULT_ABBREV));strbuf_addf(&buf,"branch.%s",bname.buf);if(git_config_rename_section(buf.buf,NULL)<0)-warning("Update of config-file failed");+warning(_("Update of config-file failed"));strbuf_release(&buf);}}
@@ -300,7 +300,7 @@ static int append_ref(const char *refname, const unsigned char *sha1, int flags,if(ref_list->verbose||ref_list->with_commit||merge_filter!=NO_FILTER){commit=lookup_commit_reference_gently(sha1,1);if(!commit){-cb->ret=error("branch '%s' does not point at a commit",refname);+cb->ret=error(_("branch '%s' does not point at a commit"),refname);return0;}
@@ -540,7 +540,7 @@ static int print_ref_list(int kinds, int detached, int verbose, int abbrev, strufree_ref_list(&ref_list);if(cb.ret)-error("some refs could not be read");+error(_("some refs could not be read"));returncb.ret;}
@@ -553,7 +553,7 @@ static void rename_branch(const char *oldname, const char *newname, int force)intrecovery=0;if(!oldname)-die("cannot rename the current branch while not on any.");+die(_("cannot rename the current branch while not on any."));if(strbuf_check_branch_ref(&oldref,oldname)){/*
@@ -563,35 +563,35 @@ static void rename_branch(const char *oldname, const char *newname, int force)if(resolve_ref(oldref.buf,sha1,1,NULL))recovery=1;else-die("Invalid branch name: '%s'",oldname);+die(_("Invalid branch name: '%s'"),oldname);}if(strbuf_check_branch_ref(&newref,newname))-die("Invalid branch name: '%s'",newname);+die(_("Invalid branch name: '%s'"),newname);if(resolve_ref(newref.buf,sha1,1,NULL)&&!force)-die("A branch named '%s' already exists.",newref.buf+11);+die(_("A branch named '%s' already exists."),newref.buf+11);strbuf_addf(&logmsg,"Branch: renamed %s to %s",oldref.buf,newref.buf);if(rename_ref(oldref.buf,newref.buf,logmsg.buf))-die("Branch rename failed");+die(_("Branch rename failed"));strbuf_release(&logmsg);if(recovery)-warning("Renamed a misnamed branch '%s' away",oldref.buf+11);+warning(_("Renamed a misnamed branch '%s' away"),oldref.buf+11);/* no need to pass logmsg here as HEAD didn't really move */if(!strcmp(oldname,head)&&create_symref("HEAD",newref.buf,NULL))-die("Branch renamed to %s, but HEAD is not updated!",newname);+die(_("Branch renamed to %s, but HEAD is not updated!"),newname);strbuf_addf(&oldsection,"branch.%s",oldref.buf+11);strbuf_release(&oldref);strbuf_addf(&newsection,"branch.%s",newref.buf+11);strbuf_release(&newref);if(git_config_rename_section(oldsection.buf,newsection.buf)<0)-die("Branch is renamed, but update of config-file failed");+die(_("Branch is renamed, but update of config-file failed"));strbuf_release(&oldsection);strbuf_release(&newsection);}
@@ -606,7 +606,7 @@ static int opt_parse_merge_filter(const struct option *opt, const char *arg, intif(!arg)arg="HEAD";if(get_sha1(arg,merge_filter_ref))-die("malformed object name %s",arg);+die(_("malformed object name %s"),arg);return0;}
@@ -676,13 +676,13 @@ int cmd_branch(int argc, const char **argv, const char *prefix)head=resolve_ref("HEAD",head_sha1,0,NULL);if(!head)-die("Failed to resolve HEAD as a valid ref.");+die(_("Failed to resolve HEAD as a valid ref."));head=xstrdup(head);if(!strcmp(head,"HEAD")){detached=1;}else{if(prefixcmp(head,"refs/heads/"))-die("HEAD not found below refs/heads!");+die(_("HEAD not found below refs/heads!"));head+=11;}hashcpy(merge_filter_ref,head_sha1);
@@ -702,7 +702,7 @@ int cmd_branch(int argc, const char **argv, const char *prefix)rename_branch(argv[0],argv[1],rename>1);elseif(argc<=2){if(kinds!=REF_LOCAL_BRANCH)-die("-a and -r options to 'git branch' do not make sense with a branch name");+die(_("-a and -r options to 'git branch' do not make sense with a branch name"));create_branch(head,argv[0],(argc==2)?argv[1]:head,force_create,reflog,track);}else
This series continues where "gettextize the first 4 C mainporcelain
common commands" left off and translates all the C mainporcelain
common commands (the only non-C ones left are bisect/pull/rebase).
With this Git is up to 482 translatable messages.
For reviewing all the patches that say "basic messages" were (mostly)
converted by an automated script and should be really
straightforward. Most of these are just plain die/error/printf calls
with a single message.
See further comments on individual patches below. Most comment only
apply to the patch immediately above them.
Ævar Arnfjörð Bjarmason (25):
gettextize: git-commit basic messages
gettextize: git-commit formatting messages
The message you get in the editor with git add . && git-commit
gettextize: git-commit advice messages
An example of N_() and _() usage.
gettextize: git-diff basic messages
gettextize: git-fetch basic messages
gettextize: git-fetch formatting messages
The status output you get on "git fetch" where it's telling you what
changed.
gettextize: git-grep basic messages
gettextize: git-log basic messages
This is more than just git-log actually, e.g. git-show too.
gettextize: git-format-patch --cover-letter message
I think this should be made translatable.
gettextize: git-merge basic messages
This need careful review. In many cases git-merge is writing out to
some .git/* file and I *don't* want to translate that, but it could
use a second set of eyes to see if I missed something.
gettextize: git-merge "In-index merge" message
gettextize: git-merge "Merge made by %s." message
gettextize: git-merge remaining cmd_merge messages
These I reviewed carefully and they should be trivial.
gettextize: git-mv basic messages
gettextize: git-mv "bad" messages
gettextize: git-rm basic messages
ditto, these should all be fine.
builtin: use builtin.h in git-reset
as before, this is not needed if "builtin: use builtin.h for all
builtin/ commands" is applied. But it's here for convenience. If the
previously submitted builtin.h patch is applied this can be dropped.
gettextize: git-reset basic messages
gettextize: git-reset reset_type_names messages
Another N_() and _() patch.
gettextize: git-tag basic messages
gettextize: git-tag tag_template message
Another N_() and _() patch.
gettextize: git-push basic messages
builtin: use builtin.h in git-status
This is *not* in my previously submitted "builtin: use builtin.h for
all builtin/ commands" patch.
gettextize: git-status basic messages
An old resurrected patch ...
gettextize: git-status shortstatus messages
... but wt-status changed since then, so this was needed too.
builtin/commit.c | 156 +++++++++++++++++++++++++++---------------------------
builtin/diff.c | 20 ++++----
builtin/fetch.c | 74 +++++++++++++-------------
builtin/grep.c | 34 ++++++------
builtin/log.c | 76 +++++++++++++-------------
builtin/merge.c | 136 +++++++++++++++++++++++-----------------------
builtin/mv.c | 32 ++++++------
builtin/push.c | 42 +++++++-------
builtin/reset.c | 44 ++++++++--------
builtin/rm.c | 22 ++++----
builtin/tag.c | 66 +++++++++++-----------
wt-status.c | 115 ++++++++++++++++++++--------------------
12 files changed, 409 insertions(+), 408 deletions(-)
--
1.7.2.2.614.g1dc9
@@ -647,28 +647,28 @@ static int prepare_to_commit(const char *index_file, const char *prefix,if(in_merge)fprintf(fp,-"#\n"+_("#\n""# It looks like you may be committing a MERGE.\n""# If this is not correct, please remove the file\n""# %s\n""# and try again.\n"-"#\n",+"#\n"),git_path("MERGE_HEAD"));fprintf(fp,-"\n"-"# Please enter the commit message for your changes.");+_("\n"+"# Please enter the commit message for your changes."));if(cleanup_mode==CLEANUP_ALL)fprintf(fp,-" Lines starting\n"+_(" Lines starting\n""# with '#' will be ignored, and an empty"-" message aborts the commit.\n");+" message aborts the commit.\n"));else/* CLEANUP_SPACE, that is. */fprintf(fp,-" Lines starting\n"+_(" Lines starting\n""# with '#' will be kept; you may remove them"" yourself if you want to.\n"-"# An empty message aborts the commit.\n");+"# An empty message aborts the commit.\n"));if(only_include_assumed)fprintf(fp,"# %s\n",only_include_assumed);
@@ -268,7 +268,7 @@ static void create_base_index(void)opts.fn=oneway_merge;tree=parse_tree_indirect(head_sha1);if(!tree)-die("failed to unpack HEAD tree object");+die(_("failed to unpack HEAD tree object"));parse_tree(tree);init_tree_desc(&t,tree->buffer,tree->size);if(unpack_trees(1,&t,&opts))
@@ -377,7 +377,7 @@ static char *prepare_index(int argc, const char **argv, const char *prefix, intcommit_style=COMMIT_PARTIAL;if(in_merge)-die("cannot do a partial commit during a merge.");+die(_("cannot do a partial commit during a merge."));memset(&partial,0,sizeof(partial));partial.strdup_strings=1;
@@ -386,14 +386,14 @@ static char *prepare_index(int argc, const char **argv, const char *prefix, intdiscard_cache();if(read_cache()<0)-die("cannot read the index");+die(_("cannot read the index"));fd=hold_locked_index(&index_lock,1);add_remove_files(&partial);refresh_cache(REFRESH_QUIET);if(write_cache(fd,active_cache,active_nr)||close_lock_file(&index_lock))-die("unable to write new_index file");+die(_("unable to write new_index file"));fd=hold_lock_file_for_update(&false_lock,git_path("next-index-%"PRIuMAX,
@@ -406,7 +406,7 @@ static char *prepare_index(int argc, const char **argv, const char *prefix, intif(write_cache(fd,active_cache,active_nr)||close_lock_file(&false_lock))-die("unable to write temporary index file");+die(_("unable to write temporary index file"));discard_cache();read_cache_from(false_lock.filename);
@@ -453,7 +453,7 @@ static int is_a_merge(const unsigned char *sha1){structcommit*commit=lookup_commit(sha1);if(!commit||parse_commit(commit))-die("could not parse HEAD commit");+die(_("could not parse HEAD commit"));return!!(commit->parents&&commit->parents->next);}
@@ -570,33 +570,33 @@ static int prepare_to_commit(const char *index_file, const char *prefix,hook_arg1="message";}elseif(logfile&&!strcmp(logfile,"-")){if(isatty(0))-fprintf(stderr,"(reading log message from standard input)\n");+fprintf(stderr,_("(reading log message from standard input)\n"));if(strbuf_read(&sb,0,0)<0)-die_errno("could not read log from standard input");+die_errno(_("could not read log from standard input"));hook_arg1="message";}elseif(logfile){if(strbuf_read_file(&sb,logfile,0)<0)-die_errno("could not read log file '%s'",+die_errno(_("could not read log file '%s'"),logfile);hook_arg1="message";}elseif(use_message){buffer=strstr(use_message_buffer,"\n\n");if(!buffer||buffer[2]=='\0')-die("commit has empty message");+die(_("commit has empty message"));strbuf_add(&sb,buffer+2,strlen(buffer+2));hook_arg1="commit";hook_arg2=use_message;}elseif(!stat(git_path("MERGE_MSG"),&statbuf)){if(strbuf_read_file(&sb,git_path("MERGE_MSG"),0)<0)-die_errno("could not read MERGE_MSG");+die_errno(_("could not read MERGE_MSG"));hook_arg1="merge";}elseif(!stat(git_path("SQUASH_MSG"),&statbuf)){if(strbuf_read_file(&sb,git_path("SQUASH_MSG"),0)<0)-die_errno("could not read SQUASH_MSG");+die_errno(_("could not read SQUASH_MSG"));hook_arg1="squash";}elseif(template_file&&!stat(template_file,&statbuf)){if(strbuf_read_file(&sb,template_file,0)<0)-die_errno("could not read '%s'",template_file);+die_errno(_("could not read '%s'"),template_file);hook_arg1="template";}
@@ -609,7 +609,7 @@ static int prepare_to_commit(const char *index_file, const char *prefix,fp=fopen(git_path(commit_editmsg),"w");if(fp==NULL)-die_errno("could not open '%s'",git_path(commit_editmsg));+die_errno(_("could not open '%s'"),git_path(commit_editmsg));if(cleanup_mode!=CLEANUP_NONE)stripspace(&sb,0);
@@ -633,7 +633,7 @@ static int prepare_to_commit(const char *index_file, const char *prefix,}if(fwrite(sb.buf,1,sb.len,fp)<sb.len)-die_errno("could not write commit template");+die_errno(_("could not write commit template"));strbuf_release(&sb);
@@ -734,7 +734,7 @@ static int prepare_to_commit(const char *index_file, const char *prefix,active_cache_tree=cache_tree();if(cache_tree_update(active_cache_tree,active_cache,active_nr,0,0)<0){-error("Error building trees");+error(_("Error building trees"));return0;}
@@ -749,7 +749,7 @@ static int prepare_to_commit(const char *index_file, const char *prefix,snprintf(index,sizeof(index),"GIT_INDEX_FILE=%s",index_file);if(launch_editor(git_path(commit_editmsg),NULL,env)){fprintf(stderr,-"Please supply the message using either -m or -F option.\n");+_("Please supply the message using either -m or -F option.\n"));exit(1);}}
@@ -829,7 +829,7 @@ static const char *find_author_by_nickname(const char *name)format_commit_message(commit,"%an <%ae>",&buf,&ctx);returnstrbuf_detach(&buf,NULL);}-die("No existing author found with '%s'",name);+die(_("No existing author found with '%s'"),name);}
@@ -861,7 +861,7 @@ static int parse_and_validate_options(int argc, const char *argv[],force_author=find_author_by_nickname(force_author);if(force_author&&renew_authorship)-die("Using both --reset-author and --author does not make sense");+die(_("Using both --reset-author and --author does not make sense"));if(logfile||message.len||use_message)use_editor=0;
@@ -875,9 +875,9 @@ static int parse_and_validate_options(int argc, const char *argv[],/* Sanity check options */if(amend&&initial_commit)-die("You have nothing to amend.");+die(_("You have nothing to amend."));if(amend&&in_merge)-die("You are in the middle of a merge -- cannot amend.");+die(_("You are in the middle of a merge -- cannot amend."));if(use_message)f++;
@@ -886,15 +886,15 @@ static int parse_and_validate_options(int argc, const char *argv[],if(logfile)f++;if(f>1)-die("Only one of -c/-C/-F can be used.");+die(_("Only one of -c/-C/-F can be used."));if(message.len&&f>0)-die("Option -m cannot be combined with -c/-C/-F.");+die(_("Option -m cannot be combined with -c/-C/-F."));if(edit_message)use_message=edit_message;if(amend&&!use_message)use_message="HEAD";if(!use_message&&renew_authorship)-die("--reset-author can be used only with -C, -c or --amend.");+die(_("--reset-author can be used only with -C, -c or --amend."));if(use_message){unsignedcharsha1[20];staticcharutf8[]="UTF-8";
@@ -903,10 +903,10 @@ static int parse_and_validate_options(int argc, const char *argv[],structcommit*commit;if(get_sha1(use_message,sha1))-die("could not lookup commit %s",use_message);+die(_("could not lookup commit %s"),use_message);commit=lookup_commit_reference(sha1);if(!commit||parse_commit(commit))-die("could not parse commit %s",use_message);+die(_("could not parse commit %s"),use_message);enc=strstr(commit->buffer,"\nencoding");if(enc){
@@ -934,13 +934,13 @@ static int parse_and_validate_options(int argc, const char *argv[],}if(!!also+!!only+!!all+!!interactive>1)-die("Only one of --include/--only/--all/--interactive can be used.");+die(_("Only one of --include/--only/--all/--interactive can be used."));if(argc==0&&(also||(only&&!amend)))-die("No paths with --include/--only does not make sense.");+die(_("No paths with --include/--only does not make sense."));if(argc==0&&only&&amend)-only_include_assumed="Clever... amending the last one with dirty index.";+only_include_assumed=_("Clever... amending the last one with dirty index.");if(argc>0&&!also&&!only)-only_include_assumed="Explicit paths specified without -i nor -o; assuming --only paths...";+only_include_assumed=_("Explicit paths specified without -i nor -o; assuming --only paths...");if(!cleanup_arg||!strcmp(cleanup_arg,"default"))cleanup_mode=use_editor?CLEANUP_ALL:CLEANUP_SPACE;elseif(!strcmp(cleanup_arg,"verbatim"))
@@ -950,14 +950,14 @@ static int parse_and_validate_options(int argc, const char *argv[],elseif(!strcmp(cleanup_arg,"strip"))cleanup_mode=CLEANUP_ALL;else-die("Invalid cleanup mode %s",cleanup_arg);+die(_("Invalid cleanup mode %s"),cleanup_arg);handle_untracked_files_arg(s);if(all&&argc>0)-die("Paths with -a does not make sense.");+die(_("Paths with -a does not make sense."));elseif(interactive&&argc>0)-die("Paths with --interactive does not make sense.");+die(_("Paths with --interactive does not make sense."));if(null_termination&&status_format==STATUS_FORMAT_LONG)status_format=STATUS_FORMAT_PORCELAIN;
@@ -1139,9 +1139,9 @@ static void print_summary(const char *prefix, const unsigned char *sha1)commit=lookup_commit(sha1);if(!commit)-die("couldn't look up newly created commit");+die(_("couldn't look up newly created commit"));if(!commit||parse_commit(commit))-die("could not parse newly created commit");+die(_("could not parse newly created commit"));strbuf_addstr(&format,"format:%h] %s");
@@ -1291,7 +1291,7 @@ int cmd_commit(int argc, const char **argv, const char *prefix)reflog_msg="commit (amend)";commit=lookup_commit(head_sha1);if(!commit||parse_commit(commit))-die("could not parse HEAD commit");+die(_("could not parse HEAD commit"));for(c=commit->parents;c;c=c->next)pptr=&commit_list_insert(c->item,pptr)->next;
@@ -1304,19 +1304,19 @@ int cmd_commit(int argc, const char **argv, const char *prefix)pptr=&commit_list_insert(lookup_commit(head_sha1),pptr)->next;fp=fopen(git_path("MERGE_HEAD"),"r");if(fp==NULL)-die_errno("could not open '%s' for reading",+die_errno(_("could not open '%s' for reading"),git_path("MERGE_HEAD"));while(strbuf_getline(&m,fp,'\n')!=EOF){unsignedcharsha1[20];if(get_sha1_hex(m.buf,sha1)<0)-die("Corrupt MERGE_HEAD file (%s)",m.buf);+die(_("Corrupt MERGE_HEAD file (%s)"),m.buf);pptr=&commit_list_insert(lookup_commit(sha1),pptr)->next;}fclose(fp);strbuf_release(&m);if(!stat(git_path("MERGE_MODE"),&statbuf)){if(strbuf_read_file(&sb,git_path("MERGE_MODE"),0)<0)-die_errno("could not read MERGE_MODE");+die_errno(_("could not read MERGE_MODE"));if(!strcmp(sb.buf,"no-ff"))allow_fast_forward=0;}
@@ -1333,7 +1333,7 @@ int cmd_commit(int argc, const char **argv, const char *prefix)if(strbuf_read_file(&sb,git_path(commit_editmsg),0)<0){intsaved_errno=errno;rollback_index_files();-die("could not read commit message: %s",strerror(saved_errno));+die(_("could not read commit message: %s"),strerror(saved_errno));}/* Truncate the message just before the diff, if any. */
@@ -1347,7 +1347,7 @@ int cmd_commit(int argc, const char **argv, const char *prefix)stripspace(&sb,cleanup_mode==CLEANUP_ALL);if(message_is_empty(&sb)&&!allow_empty_message){rollback_index_files();-fprintf(stderr,"Aborting commit due to empty commit message.\n");+fprintf(stderr,_("Aborting commit due to empty commit message.\n"));exit(1);}
@@ -1355,7 +1355,7 @@ int cmd_commit(int argc, const char **argv, const char *prefix)fmt_ident(author_name,author_email,author_date,IDENT_ERROR_ON_NO_NAME))){rollback_index_files();-die("failed to write commit object");+die(_("failed to write commit object"));}ref_lock=lock_any_ref_for_update("HEAD",
@@ -1372,11 +1372,11 @@ int cmd_commit(int argc, const char **argv, const char *prefix)if(!ref_lock){rollback_index_files();-die("cannot lock HEAD ref");+die(_("cannot lock HEAD ref"));}if(write_ref_sha1(ref_lock,commit_sha1,sb.buf)<0){rollback_index_files();-die("cannot update HEAD ref");+die(_("cannot update HEAD ref"));}unlink(git_path("MERGE_HEAD"));
@@ -1385,9 +1385,9 @@ int cmd_commit(int argc, const char **argv, const char *prefix)unlink(git_path("SQUASH_MSG"));if(commit_index_files())-die("Repository has been updated, but unable to write\n"+die(_("Repository has been updated, but unable to write\n""new_index file. Check that disk is not full or quota is\n"-"not exceeded, and then \"git reset HEAD\" to recover.");+"not exceeded, and then \"git reset HEAD\" to recover."));rerere(0);run_hook(get_index_file(),"post-commit",NULL);
@@ -38,7 +38,7 @@ static const char * const builtin_status_usage[] = {};staticconstcharimplicit_ident_advice[]=-"Your name and email address were configured automatically based\n"+N_("Your name and email address were configured automatically based\n""on your username and hostname. Please check that they are accurate.\n""You can suppress this message by setting them explicitly:\n""\n"
@@ -47,12 +47,12 @@ static const char implicit_ident_advice[] ="\n""If the identity used for this commit is wrong, you can fix it with:\n""\n"-" git commit --amend --author='Your Name <you@example.com>'\n";+" git commit --amend --author='Your Name <you@example.com>'\n");staticconstcharempty_amend_advice[]=-"You asked to amend the most recent commit, but doing so would make\n"+N_("You asked to amend the most recent commit, but doing so would make\n""it empty. You can repeat your command with --allow-empty, or you can\n"-"remove the commit entirely with \"git reset HEAD^\".\n";+"remove the commit entirely with \"git reset HEAD^\".\n");staticunsignedcharhead_sha1[20];
@@ -71,9 +71,9 @@ static int builtin_diff_b_f(struct rev_info *revs,usage(builtin_diff_usage);if(lstat(path,&st))-die_errno("failed to stat '%s'",path);+die_errno(_("failed to stat '%s'"),path);if(!(S_ISREG(st.st_mode)||S_ISLNK(st.st_mode)))-die("'%s': not a regular file or symlink",path);+die(_("'%s': not a regular file or symlink"),path);diff_set_mnemonic_prefix(&revs->diffopt,"o/","w/");
@@ -222,7 +222,7 @@ static int builtin_diff_files(struct rev_info *revs, int argc, const char **argvelseif(!strcmp(argv[1],"-h"))usage(builtin_diff_usage);else-returnerror("invalid option: %s",argv[1]);+returnerror(_("invalid option: %s"),argv[1]);argv++;argc--;}
@@ -299,12 +299,12 @@ int cmd_diff(int argc, const char **argv, const char *prefix)DIFF_OPT_SET(&rev.diffopt,ALLOW_TEXTCONV);if(nongit)-die("Not a git repository");+die(_("Not a git repository"));argc=setup_revisions(argc,argv,&rev,NULL);if(!rev.diffopt.output_format){rev.diffopt.output_format=DIFF_FORMAT_PATCH;if(diff_setup_done(&rev.diffopt)<0)-die("diff_setup_done failed");+die(_("diff_setup_done failed"));}DIFF_OPT_SET(&rev.diffopt,RECURSIVE);
@@ -331,7 +331,7 @@ int cmd_diff(int argc, const char **argv, const char *prefix)!strcmp(arg,"--staged")){add_head_to_pending(&rev);if(!rev.pending.nr)-die("No HEAD commit to compare with (yet)");+die(_("No HEAD commit to compare with (yet)"));break;}}
@@ -346,12 +346,12 @@ int cmd_diff(int argc, const char **argv, const char *prefix)obj=parse_object(obj->sha1);obj=deref_tag(obj,NULL,0);if(!obj)-die("invalid object '%s' given.",name);+die(_("invalid object '%s' given."),name);if(obj->type==OBJ_COMMIT)obj=&((structcommit*)obj)->tree->object;if(obj->type==OBJ_TREE){if(ARRAY_SIZE(ent)<=ents)-die("more than %d trees given: '%s'",+die(_("more than %d trees given: '%s'"),(int)ARRAY_SIZE(ent),name);obj->flags|=flags;ent[ents].item=obj;
@@ -361,7 +361,7 @@ int cmd_diff(int argc, const char **argv, const char *prefix)}if(obj->type==OBJ_BLOB){if(2<=blobs)-die("more than two blobs given: '%s'",name);+die(_("more than two blobs given: '%s'"),name);hashcpy(blob[blobs].sha1,obj->sha1);blob[blobs].name=name;blob[blobs].mode=list->mode;
@@ -231,7 +231,7 @@ static int update_local_ref(struct ref *ref,*display=0;type=sha1_object_info(ref->new_sha1,NULL);if(type<0)-die("object %s not found",sha1_to_hex(ref->new_sha1));+die(_("object %s not found"),sha1_to_hex(ref->new_sha1));if(!hashcmp(ref->old_sha1,ref->new_sha1)){if(verbosity>0)
@@ -331,7 +331,7 @@ static int store_updated_refs(const char *raw_url, const char *remote_name,fp=fopen(filename,"a");if(!fp)-returnerror("cannot open %s: %s\n",filename,strerror(errno));+returnerror(_("cannot open %s: %s\n"),filename,strerror(errno));if(raw_url)url=transport_anonymize_url(raw_url);
@@ -420,9 +420,9 @@ static int store_updated_refs(const char *raw_url, const char *remote_name,free(url);fclose(fp);if(rc&STORE_REF_ERROR_DF_CONFLICT)-error("some local refs could not be updated; try running\n"+error(_("some local refs could not be updated; try running\n"" 'git remote prune %s' to remove any old, conflicting "-"branches",remote_name);+"branches"),remote_name);returnrc;}
@@ -470,7 +470,7 @@ static int quickfetch(struct ref *ref_map)err=start_command(&revlist);if(err){-error("could not run rev-list");+error(_("could not run rev-list"));returnerr;}
@@ -484,14 +484,14 @@ static int quickfetch(struct ref *ref_map)if(write_in_full(revlist.in,sha1_to_hex(ref->old_sha1),40)<0||write_str_in_full(revlist.in,"\n")<0){if(errno!=EPIPE&&errno!=EINVAL)-error("failed write to rev-list: %s",strerror(errno));+error(_("failed write to rev-list: %s"),strerror(errno));err=-1;break;}}if(close(revlist.in)){-error("failed to close rev-list's stdin: %s",strerror(errno));+error(_("failed to close rev-list's stdin: %s"),strerror(errno));err=-1;}
@@ -644,8 +644,8 @@ static void check_not_current_branch(struct ref *ref_map)for(;ref_map;ref_map=ref_map->next)if(ref_map->peer_ref&&!strcmp(current_branch->refname,ref_map->peer_ref->name))-die("Refusing to fetch into current branch %s "-"of non-bare repository",current_branch->refname);+die(_("Refusing to fetch into current branch %s "+"of non-bare repository"),current_branch->refname);}staticinttruncate_fetch_head(void)
@@ -654,7 +654,7 @@ static int truncate_fetch_head(void)FILE*fp=fopen(filename,"w");if(!fp)-returnerror("cannot open %s: %s\n",filename,strerror(errno));+returnerror(_("cannot open %s: %s\n"),filename,strerror(errno));fclose(fp);return0;}
@@ -678,7 +678,7 @@ static int do_fetch(struct transport *transport,}if(!transport->get_refs_list||!transport->fetch)-die("Don't know how to fetch from %s",transport->url);+die(_("Don't know how to fetch from %s"),transport->url);/* if not appending, truncate FETCH_HEAD */if(!append&&!dry_run){
@@ -732,10 +732,10 @@ static void set_option(const char *name, const char *value){intr=transport_set_option(transport,name,value);if(r<0)-die("Option \"%s\" value \"%s\" is not valid for %s",+die(_("Option \"%s\" value \"%s\" is not valid for %s"),name,value,transport->url);if(r>0)-warning("Option \"%s\" is ignored for %s\n",+warning(_("Option \"%s\" is ignored for %s\n"),name,transport->url);}
@@ -824,9 +824,9 @@ static int fetch_multiple(struct string_list *list)argv[argc]=name;argv[argc+1]=NULL;if(verbosity>=0)-printf("Fetching %s\n",name);+printf(_("Fetching %s\n"),name);if(run_command_v_opt(argv,RUN_GIT_CMD)){-error("Could not fetch %s",name);+error(_("Could not fetch %s"),name);result=1;}}
@@ -842,8 +842,8 @@ static int fetch_one(struct remote *remote, int argc, const char **argv)intexit_code;if(!remote)-die("No remote repository specified. Please, specify either a URL or a\n"-"remote name from which new revisions should be fetched.");+die(_("No remote repository specified. Please, specify either a URL or a\n"+"remote name from which new revisions should be fetched."));transport=transport_get(remote,NULL);transport_set_verbosity(transport,verbosity,progress);
@@ -862,7 +862,7 @@ static int fetch_one(struct remote *remote, int argc, const char **argv)char*ref;i++;if(i>=argc)-die("You need to specify a tag name.");+die(_("You need to specify a tag name."));ref=xmalloc(strlen(argv[i])*2+22);strcpy(ref,"refs/tags/");strcat(ref,argv[i]);
@@ -902,9 +902,9 @@ int cmd_fetch(int argc, const char **argv, const char *prefix)if(all){if(argc==1)-die("fetch --all does not take a repository argument");+die(_("fetch --all does not take a repository argument"));elseif(argc>1)-die("fetch --all does not make sense with refspecs");+die(_("fetch --all does not make sense with refspecs"));(void)for_each_remote(get_one_remote_for_fetch,&list);result=fetch_multiple(&list);}elseif(argc==0){
@@ -915,7 +915,7 @@ int cmd_fetch(int argc, const char **argv, const char *prefix)/* All arguments are assumed to be remotes or groups */for(i=0;i<argc;i++)if(!add_remote_or_group(argv[i],&list))-die("No such remote or remote group: %s",argv[i]);+die(_("No such remote or remote group: %s"),argv[i]);result=fetch_multiple(&list);}else{/* Single remote or group */
@@ -923,7 +923,7 @@ int cmd_fetch(int argc, const char **argv, const char *prefix)if(list.nr>1){/* More than one remote */if(argc>1)-die("Fetching a group and specifying refspecs does not make sense");+die(_("Fetching a group and specifying refspecs does not make sense"));result=fetch_multiple(&list);}else{/* Zero or one remotes */
Translate some of the formatting messages that appear on git-fetch
showing how branches/tags etc. were updated.
Signed-off-by: Ævar Arnfjörð Bjarmason <redacted>
---
builtin/fetch.c | 28 ++++++++++++++--------------
1 files changed, 14 insertions(+), 14 deletions(-)
@@ -518,16 +518,16 @@ static int prune_refs(struct transport *transport, struct ref *ref_map)intresult=0;structref*ref,*stale_refs=get_stale_heads(transport->remote,ref_map);constchar*dangling_msg=dry_run-?" (%s will become dangling)\n"-:" (%s has become dangling)\n";+?_(" (%s will become dangling)\n")+:_(" (%s has become dangling)\n");for(ref=stale_refs;ref;ref=ref->next){if(!dry_run)result|=delete_ref(ref->name,NULL,0);if(verbosity>=0){fprintf(stderr," x %-*s %-*s -> %s\n",-TRANSPORT_SUMMARY_WIDTH,"[deleted]",-REFCOL_WIDTH,"(none)",prettify_refname(ref->name));+TRANSPORT_SUMMARY_WIDTH,_("[deleted]"),+REFCOL_WIDTH,_("(none)"),prettify_refname(ref->name));warn_dangling_symref(stderr,dangling_msg,ref->name);}}
From: Jonathan Nieder <hidden> Date: 2016-06-15 22:49:28
(+cc: some fetch ui authors, just as a heads up)
Ævar Arnfjörð Bjarmason wrote:
quoted hunk
--- a/builtin/fetch.c+++ b/builtin/fetch.c
@@ -236,7 +236,7 @@ static int update_local_ref(struct ref *ref,if(!hashcmp(ref->old_sha1,ref->new_sha1)){if(verbosity>0)sprintf(display,"= %-*s %-*s -> %s",TRANSPORT_SUMMARY_WIDTH,-"[up to date]",REFCOL_WIDTH,remote,+_("[up to date]"),REFCOL_WIDTH,remote,pretty_ref);
Longer-term question: do people like to translate this kind of thing
(with the arrows and so on) differently for right-to-left languages or
is that considered overkill?
quoted hunk
@@ -249,8 +249,8 @@ static int update_local_ref(struct ref *ref, * If this is the head, and it's not okay to update * the head, and the old value of the head isn't empty... */- sprintf(display, "! %-*s %-*s -> %s (can't fetch in current branch)",- TRANSPORT_SUMMARY_WIDTH, "[rejected]", REFCOL_WIDTH, remote,+ sprintf(display, _("! %-*s %-*s -> %s (can't fetch in current branch)"),+ TRANSPORT_SUMMARY_WIDTH, _("[rejected]"), REFCOL_WIDTH, remote,
Regardless of the answer, we should probably be either consistently
translating or not translating it within this patch. e.g. for not
translating (though I suspect translating is the better choice):
sprintf(display, "! %-*s %-*s -> %s %s",
TRANSPORT_SUMMARY_WIDTH, "[rejected]", REFCOL_WIDTH, remote,
pretty_ref, _("(can't fetch in current branch)"));
quoted hunk
@@ -260,8 +260,8 @@ static int update_local_ref(struct ref *ref, int r; r = s_update_ref("updating tag", ref, 0); sprintf(display, "%c %-*s %-*s -> %s%s", r ? '!' : '-',- TRANSPORT_SUMMARY_WIDTH, "[tag update]", REFCOL_WIDTH, remote,- pretty_ref, r ? " (unable to update local ref)" : "");+ TRANSPORT_SUMMARY_WIDTH, _("[tag update]"), REFCOL_WIDTH, remote,+ pretty_ref, r ? _(" (unable to update local ref)") : "");
Maybe we could stick to "%c %-*s %-*s -> %s%s", to make consistent
translation easier.
On Thu, Sep 2, 2010 at 19:59, Jonathan Nieder [off-list ref] wrote:
(+cc: some fetch ui authors, just as a heads up)
Ævar Arnfjörð Bjarmason wrote:
quoted
--- a/builtin/fetch.c+++ b/builtin/fetch.c
@@ -236,7 +236,7 @@ static int update_local_ref(struct ref *ref,
if (!hashcmp(ref->old_sha1, ref->new_sha1)) {
if (verbosity > 0)
sprintf(display, "= %-*s %-*s -> %s", TRANSPORT_SUMMARY_WIDTH,
- "[up to date]", REFCOL_WIDTH, remote,
+ _("[up to date]"), REFCOL_WIDTH, remote,
pretty_ref);
Longer-term question: do people like to translate this kind of thing
(with the arrows and so on) differently for right-to-left languages or
is that considered overkill?
They do, on a RTL language the arrows are pointing the wrong way
round. But for now I'm not trying to solve RTL issues (or indeed, word
order or plural issues), just getting something basic going.
quoted
@@ -249,8 +249,8 @@ static int update_local_ref(struct ref *ref,
* If this is the head, and it's not okay to update
* the head, and the old value of the head isn't empty...
*/
- sprintf(display, "! %-*s %-*s -> %s (can't fetch in current branch)",
- TRANSPORT_SUMMARY_WIDTH, "[rejected]", REFCOL_WIDTH, remote,
+ sprintf(display, _("! %-*s %-*s -> %s (can't fetch in current branch)"),
+ TRANSPORT_SUMMARY_WIDTH, _("[rejected]"), REFCOL_WIDTH, remote,
Regardless of the answer, we should probably be either consistently
translating or not translating it within this patch. e.g. for not
translating (though I suspect translating is the better choice):
I added a _() there because there's English language text in the
message. I wouldn't have marked it if it was just "! %-*s %-*s -> %s".
And I haven't split up "! %-*s %-*s -> %s" and " (can't fetch in
current branch)" because I'm trying to make minimal changes so that
this can get through in a timely manner, before I have a mountain of
merge conflicts on my hands.
But yeah, we want to fix that in the future.
sprintf(display, "! %-*s %-*s -> %s %s",
TRANSPORT_SUMMARY_WIDTH, "[rejected]", REFCOL_WIDTH, remote,
pretty_ref, _("(can't fetch in current branch)"));
quoted
@@ -260,8 +260,8 @@ static int update_local_ref(struct ref *ref,
int r;
r = s_update_ref("updating tag", ref, 0);
sprintf(display, "%c %-*s %-*s -> %s%s", r ? '!' : '-',
- TRANSPORT_SUMMARY_WIDTH, "[tag update]", REFCOL_WIDTH, remote,
- pretty_ref, r ? " (unable to update local ref)" : "");
+ TRANSPORT_SUMMARY_WIDTH, _("[tag update]"), REFCOL_WIDTH, remote,
+ pretty_ref, r ? _(" (unable to update local ref)") : "");
Maybe we could stick to "%c %-*s %-*s -> %s%s", to make consistent
translation easier.
Yeah, maybe. That's pretty much the only part of this series that
deals with issues like that. So it's probably worth a fixup.
(I.e. ignore what I said earlier :)
From: Jeff King <hidden> Date: 2016-06-15 22:49:28
On Thu, Sep 02, 2010 at 02:59:37PM -0500, Jonathan Nieder wrote:
(+cc: some fetch ui authors, just as a heads up)
Thanks. I think Nico actually did the fetch code, though, and I more or
less copied it for push.
quoted
@@ -249,8 +249,8 @@ static int update_local_ref(struct ref *ref, * If this is the head, and it's not okay to update * the head, and the old value of the head isn't empty... */- sprintf(display, "! %-*s %-*s -> %s (can't fetch in current branch)",- TRANSPORT_SUMMARY_WIDTH, "[rejected]", REFCOL_WIDTH, remote,+ sprintf(display, _("! %-*s %-*s -> %s (can't fetch in current branch)"),+ TRANSPORT_SUMMARY_WIDTH, _("[rejected]"), REFCOL_WIDTH, remote,
Regardless of the answer, we should probably be either consistently
translating or not translating it within this patch. e.g. for not
translating (though I suspect translating is the better choice):
sprintf(display, "! %-*s %-*s -> %s %s",
TRANSPORT_SUMMARY_WIDTH, "[rejected]", REFCOL_WIDTH, remote,
pretty_ref, _("(can't fetch in current branch)"));
I think you can translate "[rejected]" here, too.
However, do be aware of the --porcelain output for git-push. It was
tacked on much later, and I fear it may use some of the same strings.
Some of them are perhaps OK to translate (the human readable bit at the
end, e.g.), but others maybe not. I haven't looked closely.
-Peff
On Thu, Sep 2, 2010 at 20:28, Jeff King [off-list ref] wrote:
On Thu, Sep 02, 2010 at 02:59:37PM -0500, Jonathan Nieder wrote:
quoted
(+cc: some fetch ui authors, just as a heads up)
Thanks. I think Nico actually did the fetch code, though, and I more or
less copied it for push.
quoted
quoted
@@ -249,8 +249,8 @@ static int update_local_ref(struct ref *ref,
* If this is the head, and it's not okay to update
* the head, and the old value of the head isn't empty...
*/
- sprintf(display, "! %-*s %-*s -> %s (can't fetch in current branch)",
- TRANSPORT_SUMMARY_WIDTH, "[rejected]", REFCOL_WIDTH, remote,
+ sprintf(display, _("! %-*s %-*s -> %s (can't fetch in current branch)"),
+ TRANSPORT_SUMMARY_WIDTH, _("[rejected]"), REFCOL_WIDTH, remote,
Regardless of the answer, we should probably be either consistently
translating or not translating it within this patch. e.g. for not
translating (though I suspect translating is the better choice):
sprintf(display, "! %-*s %-*s -> %s %s",
TRANSPORT_SUMMARY_WIDTH, "[rejected]", REFCOL_WIDTH, remote,
pretty_ref, _("(can't fetch in current branch)"));
I think you can translate "[rejected]" here, too.
Thanks. I missed that one.
However, do be aware of the --porcelain output for git-push. It was
tacked on much later, and I fear it may use some of the same strings.
Some of them are perhaps OK to translate (the human readable bit at the
end, e.g.), but others maybe not. I haven't looked closely.
There's probably more potential issues like that because I didn't know
the code well, but hopefully not too many.
@@ -141,9 +141,9 @@ static void cmd_log_init(int argc, const char **argv, const char *prefix,free((void*)fullpath);if(range->nr==0){if(range->next){-die("Path %s need a -L <range> option\n"+die(_("Path %s need a -L <range> option\n""If you want follow the history of the whole file "-"use 'git log -L 1,$ <path>'",range->spec->path);+"use 'git log -L 1,$ <path>'"),range->spec->path);}else{parse_options_next(&ctx,1);continue;
@@ -167,7 +167,7 @@ parse_done:/* die if '-L <range>' with no pathspec follow */if(range->nr>0&&range->spec==NULL)-die("Each -L should follow a path");+die(_("Each -L should follow a path"));/* clear up the last range */if(range->nr==0){structdiff_line_range*r=range->next;
@@ -358,7 +358,7 @@ static int cmd_log_walk(struct rev_info *rev)setup_early_output(rev);if(prepare_revision_walk(rev))-die("revision walk setup failed");+die(_("revision walk setup failed"));if(rev->early_output)finish_early_output(rev);
@@ -450,7 +450,7 @@ static int show_object(const unsigned char *sha1, int show_tag_object,intoffset=0;if(!buf)-returnerror("Could not read object %s",sha1_to_hex(sha1));+returnerror(_("Could not read object %s"),sha1_to_hex(sha1));if(show_tag_object)while(offset<size&&buf[offset]!='\n'){
@@ -537,7 +537,7 @@ int cmd_show(int argc, const char **argv, const char *prefix)break;o=parse_object(t->tagged->sha1);if(!o)-ret=error("Could not read object %s",+ret=error(_("Could not read object %s"),sha1_to_hex(t->tagged->sha1));objects[i].item=o;i--;
@@ -664,7 +664,7 @@ static int git_format_config(const char *var, const char *value, void *cb){if(!strcmp(var,"format.headers")){if(!value)-die("format.headers without value");+die(_("format.headers without value"));add_header(value);return0;}
@@ -736,7 +736,7 @@ static int reopen_stdout(struct commit *commit, struct rev_info *rev)strbuf_addstr(&filename,output_directory);if(filename.len>=PATH_MAX-FORMAT_PATCH_NAME_MAX-suffix_len)-returnerror("name of output directory is too long");+returnerror(_("name of output directory is too long"));if(filename.buf[filename.len-1]!='/')strbuf_addch(&filename,'/');}
@@ -747,7 +747,7 @@ static int reopen_stdout(struct commit *commit, struct rev_info *rev)fprintf(realstdout,"%s\n",filename.buf+outdir_offset);if(freopen(filename.buf,"w",stdout)==NULL)-returnerror("Cannot open patch file %s",filename.buf);+returnerror(_("Cannot open patch file %s"),filename.buf);strbuf_release(&filename);return0;
@@ -761,7 +761,7 @@ static void get_patch_ids(struct rev_info *rev, struct patch_ids *ids, const chaunsignedflags1,flags2;if(rev->pending.nr!=2)-die("Need exactly one range.");+die(_("Need exactly one range."));o1=rev->pending.objects[0].item;flags1=o1->flags;
@@ -769,7 +769,7 @@ static void get_patch_ids(struct rev_info *rev, struct patch_ids *ids, const chaflags2=o2->flags;if((flags1&UNINTERESTING)==(flags2&UNINTERESTING))-die("Not a range.");+die(_("Not a range."));init_patch_ids(ids);
@@ -1192,7 +1192,7 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)committer=git_committer_info(IDENT_ERROR_ON_NO_NAME);endpos=strchr(committer,'>');if(!endpos)-die("bogus committer info %s",committer);+die(_("bogus committer info %s"),committer);add_signoff=xmemdupz(committer,endpos-committer+1);}
@@ -1237,20 +1237,20 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)numbered=0;if(numbered&&keep_subject)-die("-n and -k are mutually exclusive.");+die(_("-n and -k are mutually exclusive."));if(keep_subject&&subject_prefix)-die("--subject-prefix and -k are mutually exclusive.");+die(_("--subject-prefix and -k are mutually exclusive."));argc=setup_revisions(argc,argv,&rev,&s_r_opt);if(argc>1)-die("unrecognized argument: %s",argv[1]);+die(_("unrecognized argument: %s"),argv[1]);if(rev.diffopt.output_format&DIFF_FORMAT_NAME)-die("--name-only does not make sense");+die(_("--name-only does not make sense"));if(rev.diffopt.output_format&DIFF_FORMAT_NAME_STATUS)-die("--name-status does not make sense");+die(_("--name-status does not make sense"));if(rev.diffopt.output_format&DIFF_FORMAT_CHECKDIFF)-die("--check does not make sense");+die(_("--check does not make sense"));if(!use_patch_format&&(!rev.diffopt.output_format||
@@ -1271,9 +1271,9 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)if(output_directory){if(use_stdout)-die("standard output, or directory, which one?");+die(_("standard output, or directory, which one?"));if(mkdir(output_directory,0777)<0&&errno!=EEXIST)-die_errno("Could not create directory '%s'",+die_errno(_("Could not create directory '%s'"),output_directory);}
@@ -1327,7 +1327,7 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)realstdout=xfdopen(xdup(1),"w");if(prepare_revision_walk(&rev))-die("revision walk setup failed");+die(_("revision walk setup failed"));rev.boundary=1;while((commit=get_revision(&rev))!=NULL){if(commit->object.flags&BOUNDARY){
@@ -1408,7 +1408,7 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)if(!use_stdout&&reopen_stdout(numbered_files?NULL:commit,&rev))-die("Failed to create output files");+die(_("Failed to create output files"));shown=log_tree_commit(&rev,commit);free(commit->buffer);commit->buffer=NULL;
@@ -1495,9 +1495,9 @@ int cmd_cherry(int argc, const char **argv, const char *prefix)if(!current_branch||!current_branch->merge||!current_branch->merge[0]||!current_branch->merge[0]->dst){-fprintf(stderr,"Could not find a tracked"+fprintf(stderr,_("Could not find a tracked"" remote branch, please"-" specify <upstream> manually.\n");+" specify <upstream> manually.\n"));usage_with_options(cherry_usage,options);}
@@ -1511,9 +1511,9 @@ int cmd_cherry(int argc, const char **argv, const char *prefix)DIFF_OPT_SET(&revs.diffopt,RECURSIVE);if(add_pending_commit(head,&revs,0))-die("Unknown commit %s",head);+die(_("Unknown commit %s"),head);if(add_pending_commit(upstream,&revs,UNINTERESTING))-die("Unknown commit %s",upstream);+die(_("Unknown commit %s"),upstream);/* Don't say anything if head and upstream are the same. */if(revs.pending.nr==2){
@@ -1525,11 +1525,11 @@ int cmd_cherry(int argc, const char **argv, const char *prefix)get_patch_ids(&revs,&ids,prefix);if(limit&&add_pending_commit(limit,&revs,UNINTERESTING))-die("Unknown commit %s",limit);+die(_("Unknown commit %s"),limit);/* reverse the list of commits */if(prepare_revision_walk(&revs))-die("revision walk setup failed");+die(_("revision walk setup failed"));while((commit=get_revision(&revs))!=NULL){/* ignore merges */if(commit->parents&&commit->parents->next)
@@ -516,7 +516,7 @@ static void *load_file(const char *filename, size_t *sz)gotoerr_ret;data=xmalloc(*sz+1);if(st.st_size!=read_in_full(i,data,*sz)){-error("'%s': short read %s",filename,strerror(errno));+error(_("'%s': short read %s"),filename,strerror(errno));close(i);free(data);return0;
@@ -578,7 +578,7 @@ static void run_pager(struct grep_opt *opt, const char *prefix)argv[path_list->nr]=NULL;if(prefix&&chdir(prefix))-die("Failed to chdir: %s",prefix);+die(_("Failed to chdir: %s"),prefix);status=run_command_v_opt(argv,RUN_USING_SHELL);if(status)exit(status);
@@ -668,7 +668,7 @@ static int grep_tree(struct grep_opt *opt, const char **paths,data=lock_and_read_sha1_file(entry.sha1,&type,&size);if(!data)-die("unable to read tree (%s)",+die(_("unable to read tree (%s)"),sha1_to_hex(entry.sha1));init_tree_desc(&sub,data,size);hit|=grep_tree(opt,paths,&sub,tree_name,down);
@@ -694,13 +694,13 @@ static int grep_object(struct grep_opt *opt, const char **paths,data=read_object_with_reference(obj->sha1,tree_type,&size,NULL);if(!data)-die("unable to read tree (%s)",sha1_to_hex(obj->sha1));+die(_("unable to read tree (%s)"),sha1_to_hex(obj->sha1));init_tree_desc(&tree,data,size);hit=grep_tree(opt,paths,&tree,name,"");free(data);returnhit;}-die("unable to grep from object of type %s",typename(obj->type));+die(_("unable to grep from object of type %s"),typename(obj->type));}staticintgrep_objects(structgrep_opt*opt,constchar**paths,
@@ -752,7 +752,7 @@ static int context_callback(const struct option *opt, const char *arg,}value=strtol(arg,(char**)&endp,10);if(*endp){-returnerror("switch `%c' expects a numerical value",+returnerror(_("switch `%c' expects a numerical value"),opt->short_name);}grep_opt->pre_context=grep_opt->post_context=value;
@@ -768,7 +768,7 @@ static int file_callback(const struct option *opt, const char *arg, int unset)patterns=fopen(arg,"r");if(!patterns)-die_errno("cannot open '%s'",arg);+die_errno(_("cannot open '%s'"),arg);while(strbuf_getline(&sb,patterns,'\n')==0){char*s;size_tlen;
@@ -1009,11 +1009,11 @@ int cmd_grep(int argc, const char **argv, const char *prefix)}if(!opt.pattern_list)-die("no pattern given.");+die(_("no pattern given."));if(!opt.fixed&&opt.ignore_case)opt.regflags|=REG_ICASE;if((opt.regflags!=REG_NEWLINE)&&opt.fixed)-die("cannot mix --fixed-strings and regexp");+die(_("cannot mix --fixed-strings and regexp"));#ifndef NO_PTHREADSif(online_cpus()==1||!grep_threads_ok(&opt))
@@ -1065,7 +1065,7 @@ int cmd_grep(int argc, const char **argv, const char *prefix)}if(show_in_pager&&(cached||list.nr))-die("--open-files-in-pager only works on the worktree");+die(_("--open-files-in-pager only works on the worktree"));if(show_in_pager&&opt.pattern_list&&!opt.pattern_list->next){constchar*pager=path_list.items[0].string;
@@ -1090,9 +1090,9 @@ int cmd_grep(int argc, const char **argv, const char *prefix)if(!use_index){if(cached)-die("--cached cannot be used with --no-index.");+die(_("--cached cannot be used with --no-index."));if(list.nr)-die("--no-index cannot be used with revs.");+die(_("--no-index cannot be used with revs."));hit=grep_directory(&opt,paths);}elseif(!list.nr){if(!cached)
@@ -1101,7 +1101,7 @@ int cmd_grep(int argc, const char **argv, const char *prefix)hit=grep_cache(&opt,paths,cached);}else{if(cached)-die("both --cached and trees are given.");+die(_("both --cached and trees are given."));hit=grep_objects(&opt,paths,&list);}
Make the "SUBJECT HERE" and "BLURB HERE" output in git-format-patch
translatable. This is going to be edited by a human anyway.
Signed-off-by: Ævar Arnfjörð Bjarmason <redacted>
---
builtin/log.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
@@ -826,7 +826,7 @@ static void make_cover_letter(struct rev_info *rev, int use_stdout,{constchar*committer;constchar*subject_start=NULL;-constchar*body="*** SUBJECT HERE ***\n\n*** BLURB HERE ***\n";+constchar*body=_("*** SUBJECT HERE ***\n\n*** BLURB HERE ***\n");constchar*msg;constchar*extra_headers=rev->extra_headers;structshortloglog;
Make the "In-index merge" message translatable. This just emits to
stdout via finish(), so translating it should be fine.
Signed-off-by: Ævar Arnfjörð Bjarmason <redacted>
---
builtin/merge.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
@@ -223,17 +223,17 @@ static void save_state(void)cp.git_cmd=1;if(start_command(&cp))-die("could not run stash.");+die(_("could not run stash."));len=strbuf_read(&buffer,cp.out,1024);close(cp.out);if(finish_command(&cp)||len<0)-die("stash failed");+die(_("stash failed"));elseif(!len)return;strbuf_setlen(&buffer,buffer.len-1);if(get_sha1(buffer.buf,stash))-die("not a valid object: %s",buffer.buf);+die(_("not a valid object: %s"),buffer.buf);}staticvoidreset_hard(unsignedconstchar*sha1,intverbose)
@@ -279,7 +279,7 @@ static void restore_state(void)staticvoidfinish_up_to_date(constchar*msg){if(verbosity>=0)-printf("%s%s\n",squash?" (nothing to squash)":"",msg);+printf("%s%s\n",squash?_(" (nothing to squash)"):"",msg);drop_save();}
@@ -292,10 +292,10 @@ static void squash_message(void)intfd;structpretty_print_contextctx={0};-printf("Squash commit -- not updating HEAD\n");+printf(_("Squash commit -- not updating HEAD\n"));fd=open(git_path("SQUASH_MSG"),O_WRONLY|O_CREAT,0666);if(fd<0)-die_errno("Could not write to '%s'",git_path("SQUASH_MSG"));+die_errno(_("Could not write to '%s'"),git_path("SQUASH_MSG"));init_revisions(&rev,NULL);rev.ignore_merges=1;
@@ -310,7 +310,7 @@ static void squash_message(void)setup_revisions(0,NULL,&rev,NULL);if(prepare_revision_walk(&rev))-die("revision walk setup failed");+die(_("revision walk setup failed"));ctx.abbrev=rev.abbrev;ctx.date_mode=rev.date_mode;
@@ -396,7 +396,7 @@ static void merge_name(const char *remote, struct strbuf *msg)memset(branch_head,0,sizeof(branch_head));remote_head=peel_to_type(remote,0,NULL,OBJ_COMMIT);if(!remote_head)-die("'%s' does not point to a commit",remote);+die(_("'%s' does not point to a commit"),remote);if(dwim_ref(remote,strlen(remote),branch_head,&found_ref)>0){if(!prefixcmp(found_ref,"refs/heads/")){
@@ -461,7 +461,7 @@ static void merge_name(const char *remote, struct strbuf *msg)fp=fopen(git_path("FETCH_HEAD"),"r");if(!fp)-die_errno("could not open '%s' for reading",+die_errno(_("could not open '%s' for reading"),git_path("FETCH_HEAD"));strbuf_getline(&line,fp,'\n');fclose(fp);
@@ -560,7 +560,7 @@ static int read_tree_trivial(unsigned char *common, unsigned char *head,staticvoidwrite_tree_trivial(unsignedchar*sha1){if(write_cache_as_tree(sha1,0,NULL))-die("git write-tree failed to write a tree");+die(_("git write-tree failed to write a tree"));}inttry_merge_command(constchar*strategy,structcommit_list*common,
@@ -601,7 +601,7 @@ int try_merge_command(const char *strategy, struct commit_list *common,free(args);discard_cache();if(read_cache()<0)-die("failed to read the cache");+die(_("failed to read the cache"));resolve_undo_clear();returnret;
@@ -618,7 +618,7 @@ static int try_merge_strategy(const char *strategy, struct commit_list *common,if(active_cache_changed&&(write_cache(index_fd,active_cache,active_nr)||commit_locked_index(lock)))-returnerror("Unable to write index.");+returnerror(_("Unable to write index."));rollback_lock_file(lock);if(!strcmp(strategy,"recursive")||!strcmp(strategy,"subtree")){
@@ -631,7 +631,7 @@ static int try_merge_strategy(const char *strategy, struct commit_list *common,structcommit_list*j;if(remoteheads->next){-error("Not handling anything other than two heads merge.");+error(_("Not handling anything other than two heads merge."));return2;}
@@ -643,7 +643,7 @@ static int try_merge_strategy(const char *strategy, struct commit_list *common,for(x=0;x<xopts_nr;x++)if(parse_merge_opt(&o,xopts[x]))-die("Unknown option for merge-recursive: -X%s",xopts[x]);+die(_("Unknown option for merge-recursive: -X%s"),xopts[x]);o.branch1=head_arg;o.branch2=remoteheads->item->util;
@@ -657,7 +657,7 @@ static int try_merge_strategy(const char *strategy, struct commit_list *common,if(active_cache_changed&&(write_cache(index_fd,active_cache,active_nr)||commit_locked_index(lock)))-die("unable to write %s",get_index_file());+die(_("unable to write %s"),get_index_file());rollback_lock_file(lock);returnclean?0:1;}else{
@@ -731,7 +731,7 @@ int checkout_fast_forward(const unsigned char *head, const unsigned char *remotereturn-1;if(write_cache(fd,active_cache,active_nr)||commit_locked_index(lock_file))-die("unable to write new index file");+die(_("unable to write new index file"));return0;}
@@ -785,7 +785,7 @@ static int merge_trivial(void)structcommit_list*parent=xmalloc(sizeof(*parent));write_tree_trivial(result_tree);-printf("Wonderful.\n");+printf(_("Wonderful.\n"));parent->item=lookup_commit(head);parent->next=xmalloc(sizeof(*parent->next));parent->next->item=remoteheads->item;
@@ -834,7 +834,7 @@ static int suggest_conflicts(int renormalizing)fp=fopen(git_path("MERGE_MSG"),"a");if(!fp)-die_errno("Could not open '%s' for writing",+die_errno(_("Could not open '%s' for writing"),git_path("MERGE_MSG"));fprintf(fp,"\nConflicts:\n");for(pos=0;pos<active_nr;pos++){
@@ -850,8 +850,8 @@ static int suggest_conflicts(int renormalizing)}fclose(fp);rerere(allow_rerere_auto);-printf("Automatic merge failed; "-"fix conflicts and then commit the result.\n");+printf(_("Automatic merge failed; "+"fix conflicts and then commit the result.\n"));return1;}
@@ -865,7 +865,7 @@ static struct commit *is_old_style_invocation(int argc, const char **argv)returnNULL;second_token=lookup_commit_reference_gently(second_sha1,0);if(!second_token)-die("'%s' is not a commit",argv[1]);+die(_("'%s' is not a commit"),argv[1]);if(hashcmp(second_token->object.sha1,head))returnNULL;}
@@ -915,10 +915,10 @@ int cmd_merge(int argc, const char **argv, const char *prefix)*add/rm<file>',just'gitcommit'.*/if(advice_resolve_conflict)-die("You have not concluded your merge (MERGE_HEAD exists).\n"-"Please, commit your changes before you can merge.");+die(_("You have not concluded your merge (MERGE_HEAD exists).\n"+"Please, commit your changes before you can merge."));else-die("You have not concluded your merge (MERGE_HEAD exists).");+die(_("You have not concluded your merge (MERGE_HEAD exists)."));}resolve_undo_clear();
@@ -945,12 +945,12 @@ int cmd_merge(int argc, const char **argv, const char *prefix)if(squash){if(!allow_fast_forward)-die("You cannot combine --squash with --no-ff.");+die(_("You cannot combine --squash with --no-ff."));option_commit=0;}if(!allow_fast_forward&&fast_forward_only)-die("You cannot combine --no-ff with --ff-only.");+die(_("You cannot combine --no-ff with --ff-only."));if(!argc)usage_with_options(builtin_merge_usage,
@@ -978,16 +978,16 @@ int cmd_merge(int argc, const char **argv, const char *prefix)*Wedothesamefor"git pull".*/if(argc!=1)-die("Can merge only exactly one commit into "-"empty head");+die(_("Can merge only exactly one commit into "+"empty head"));if(squash)-die("Squash commit into empty head not supported yet");+die(_("Squash commit into empty head not supported yet"));if(!allow_fast_forward)-die("Non-fast-forward commit does not make sense into "-"an empty head");+die(_("Non-fast-forward commit does not make sense into "+"an empty head"));remote_head=peel_to_type(argv[0],0,NULL,OBJ_COMMIT);if(!remote_head)-die("%s - not something we can merge",argv[0]);+die(_("%s - not something we can merge"),argv[0]);update_ref("initial pull","HEAD",remote_head->sha1,NULL,0,DIE_ON_ERR);reset_hard(remote_head->sha1,0);
@@ -1033,7 +1033,7 @@ int cmd_merge(int argc, const char **argv, const char *prefix)o=peel_to_type(argv[i],0,NULL,OBJ_COMMIT);if(!o)-die("%s - not something we can merge",argv[i]);+die(_("%s - not something we can merge"),argv[i]);commit=lookup_commit(o->sha1);commit->util=(void*)argv[i];remotes=&commit_list_insert(commit,remotes)->next;
@@ -1125,11 +1125,11 @@ int cmd_merge(int argc, const char **argv, const char *prefix)if(allow_trivial&&!fast_forward_only){/* See if it is really trivial. */git_committer_info(IDENT_ERROR_ON_NO_NAME);-printf("Trying really trivial in-index merge...\n");+printf(_("Trying really trivial in-index merge...\n"));if(!read_tree_trivial(common->item->object.sha1,head,remoteheads->item->object.sha1))returnmerge_trivial();-printf("Nope.\n");+printf(_("Nope.\n"));}}else{/*
@@ -1162,7 +1162,7 @@ int cmd_merge(int argc, const char **argv, const char *prefix)}if(fast_forward_only)-die("Not possible to fast-forward, aborting.");+die(_("Not possible to fast-forward, aborting."));/* We are going to make a new commit. */git_committer_info(IDENT_ERROR_ON_NO_NAME);
@@ -1188,11 +1188,11 @@ int cmd_merge(int argc, const char **argv, const char *prefix)for(i=0;i<use_strategies_nr;i++){intret;if(i){-printf("Rewinding the tree to pristine...\n");+printf(_("Rewinding the tree to pristine...\n"));restore_state();}if(use_strategies_nr!=1)-printf("Trying merge strategy %s...\n",+printf(_("Trying merge strategy %s...\n"),use_strategies[i]->name);/**Rememberwhichstrategyleftthestateintheworking
@@ -1253,17 +1253,17 @@ int cmd_merge(int argc, const char **argv, const char *prefix)restore_state();if(use_strategies_nr>1)fprintf(stderr,-"No merge strategy handled the merge.\n");+_("No merge strategy handled the merge.\n"));else-fprintf(stderr,"Merge with strategy %s failed.\n",+fprintf(stderr,_("Merge with strategy %s failed.\n"),use_strategies[0]->name);return2;}elseif(best_strategy==wt_strategy);/* We already have its result in the working tree. */else{-printf("Rewinding the tree to pristine...\n");+printf(_("Rewinding the tree to pristine...\n"));restore_state();-printf("Using the %s to prepare resolving by hand.\n",+printf(_("Using the %s to prepare resolving by hand.\n"),best_strategy);try_merge_strategy(best_strategy,common,head_arg);}
@@ -1279,35 +1279,35 @@ int cmd_merge(int argc, const char **argv, const char *prefix)sha1_to_hex(j->item->object.sha1));fd=open(git_path("MERGE_HEAD"),O_WRONLY|O_CREAT,0666);if(fd<0)-die_errno("Could not open '%s' for writing",+die_errno(_("Could not open '%s' for writing"),git_path("MERGE_HEAD"));if(write_in_full(fd,buf.buf,buf.len)!=buf.len)-die_errno("Could not write to '%s'",git_path("MERGE_HEAD"));+die_errno(_("Could not write to '%s'"),git_path("MERGE_HEAD"));close(fd);strbuf_addch(&merge_msg,'\n');fd=open(git_path("MERGE_MSG"),O_WRONLY|O_CREAT,0666);if(fd<0)-die_errno("Could not open '%s' for writing",+die_errno(_("Could not open '%s' for writing"),git_path("MERGE_MSG"));if(write_in_full(fd,merge_msg.buf,merge_msg.len)!=merge_msg.len)-die_errno("Could not write to '%s'",git_path("MERGE_MSG"));+die_errno(_("Could not write to '%s'"),git_path("MERGE_MSG"));close(fd);fd=open(git_path("MERGE_MODE"),O_WRONLY|O_CREAT|O_TRUNC,0666);if(fd<0)-die_errno("Could not open '%s' for writing",+die_errno(_("Could not open '%s' for writing"),git_path("MERGE_MODE"));strbuf_reset(&buf);if(!allow_fast_forward)strbuf_addf(&buf,"no-ff");if(write_in_full(fd,buf.buf,buf.len)!=buf.len)-die_errno("Could not write to '%s'",git_path("MERGE_MODE"));+die_errno(_("Could not write to '%s'"),git_path("MERGE_MODE"));close(fd);}if(merge_was_ok){-fprintf(stderr,"Automatic merge went well; "-"stopped before committing as requested\n");+fprintf(stderr,_("Automatic merge went well; "+"stopped before committing as requested\n"));return0;}elsereturnsuggest_conflicts(option_renormalize);
Another basic question (sorry for my ignorance): do translators prefer
whole paragraphs or line-by-line messages like this? (Of course that
is not a topic for this patch; I am just curious.)
Another basic question (sorry for my ignorance): do translators prefer
whole paragraphs or line-by-line messages like this? (Of course that
is not a topic for this patch; I am just curious.)
_("We want whole paragraphs"
" for stuff like this where"
" the message actually is a"
" single paragraph of text")
However, in this case the message is a stand-alone error message
followed by what's effectively new sentence (a header above
strategies) followed by a listing of strategies.
That sort of thing isn't a problem, because fortunately we only have
left-to-right languages, not bottom-to-top. At least it hasn't been an
issue in MediaWiki (whose i18n I've worked on) which is translated to
over 200 languages now.
What branch are you translating? I am hoping the omgwtfbbq??! message
gets a chance to be tweaked before release.
It's on top of pu, I've actually lost an up-to-date tip where gettext
was applied to a branch below that, and haven't worked my way back.
Maybe this'll be a problem for this series. Here's the builtin/*.c
changes between next and pu:
builtin/checkout.c | 14 ++-
builtin/fetch.c | 21 ++++-
builtin/fmt-merge-msg.c | 60 ++++++-----
builtin/init-db.c | 56 +++++-----
builtin/log.c | 7 +-
builtin/mailinfo.c | 10 ++-
builtin/merge-recursive.c | 15 +---
builtin/merge.c | 62 +++++------
builtin/notes.c | 14 ++-
builtin/remote-ext.c | 257
+++++++++++++++++++++++++++++++++++++++++++++
builtin/remote-fd.c | 83 +++++++++++++++
builtin/skew.c | 50 +++++++++
builtin/tag.c | 2 +-
builtin/version.c | 7 ++
14 files changed, 537 insertions(+), 121 deletions(-)
Some of these affect this series. But I was hoping that this would
make it into pu and after next gets released Any Day Now most of those
other tips in pu would be folded into next along with gettext, or at
least the merge conflicts wouldn't be too painful.
From: Jonathan Nieder <hidden> Date: 2016-06-15 22:49:28
Ævar Arnfjörð Bjarmason wrote:
It's on top of pu,
[...]
But I was hoping that this would
make it into pu and after next gets released Any Day Now most of those
other tips in pu would be folded into next along with gettext, or at
least the merge conflicts wouldn't be too painful.
Hmm. That really constrains people trying to merge this series.
As SubmittingPatches explains:
- In the exceptional case that a new feature depends on several topics
not in 'master', start working on 'next' or 'pu' privately and send
out patches for discussion. Before the final merge, you may have to
wait until some of the dependent topics graduate to 'master', and
rebase your work.
so this is fine for discussion, but for merging, having to pull in
_all_ topics from pu (or all topics from next for that matter) for
the patches to apply really is a problem.
Both next and pu get rewound from time to time. They are not meant
to be a stable basis for patches.
Also worth mentioning is that topics in "next" are not guaranteed to
be included in the next release. The "next" branch has content
matching the "jch" branch which I think has a better name: it is
just the version of git that Junio uses for ordinary tasks (and
hence topics in it cannot be completely broken for long).
On Thu, Sep 2, 2010 at 20:37, Jonathan Nieder [off-list ref] wrote:
Ævar Arnfjörð Bjarmason wrote:
quoted
It's on top of pu,
[...]
quoted
But I was hoping that this would
make it into pu and after next gets released Any Day Now most of those
other tips in pu would be folded into next along with gettext, or at
least the merge conflicts wouldn't be too painful.
Hmm. That really constrains people trying to merge this series.
As SubmittingPatches explains:
- In the exceptional case that a new feature depends on several topics
not in 'master', start working on 'next' or 'pu' privately and send
out patches for discussion. Before the final merge, you may have to
wait until some of the dependent topics graduate to 'master', and
rebase your work.
so this is fine for discussion, but for merging, having to pull in
_all_ topics from pu (or all topics from next for that matter) for
the patches to apply really is a problem.
Both next and pu get rewound from time to time. They are not meant
to be a stable basis for patches.
Also worth mentioning is that topics in "next" are not guaranteed to
be included in the next release. The "next" branch has content
matching the "jch" branch which I think has a better name: it is
just the version of git that Junio uses for ordinary tasks (and
hence topics in it cannot be completely broken for long).
Yeah, I was just hoping I could get away with it :)
Having whatever Junio is using these days as ab/i18n would be
convenient (since I've lost it), although I suppose I could start at
master and cherry-pick my way forward.
I'll also wait for comment from Junio about what he wants done with it
and what his plans are for it. But I can rebase it if need be.
From: Jonathan Nieder <hidden> Date: 2016-06-15 22:49:28
Ævar Arnfjörð Bjarmason wrote:
Yeah, I was just hoping I could get away with it :)
To be clear, I think you made a reasonable choice at this stage of
development.
Aside: maybe for translation (though not for gettextizing) the idea of
patches that get applied to the development tree is more trouble than
it's worth. GNU sed and some similar projects do not include
translations in the development tree but fetch them from
translationproject.org as part of the "bootstrap" procedure when
building a source tarball or binaries.
See autoboot in git://git.sv.gnu.org/sed.git for example.
On Thu, Sep 2, 2010 at 21:13, Jonathan Nieder [off-list ref] wrote:
Aside: maybe for translation (though not for gettextizing) the idea of
patches that get applied to the development tree is more trouble than
it's worth. GNU sed and some similar projects do not include
translations in the development tree but fetch them from
translationproject.org as part of the "bootstrap" procedure when
building a source tarball or binaries.
See autoboot in git://git.sv.gnu.org/sed.git for example.
I'd prefer to be able to submit translations directly to git.git, and
build a localized git with "make" and no network access. Most programs
that use gettext do this, sed seems to be an exception, and actually
I've never seen anyone do it like that. Some maintain their
translations in some web interface, but I haven't seen a project that
doesn't commit them *at all*.
I can't see why translations in the tree (in po/) should be any
trouble at all for us. What sort of issues do you see that the sed.git
model might solve?
From: Jonathan Nieder <hidden> Date: 2016-06-15 22:49:28
Ævar Arnfjörð Bjarmason wrote:
I can't see why translations in the tree (in po/) should be any
trouble at all for us. What sort of issues do you see that the sed.git
model might solve?
Only two: log noise and the problem of what to base patches on.
As you noticed while gettextizing (which is pretty much a one-time
thing), it is not much fun to do work on strings that aren't even
going to be used. So translators might want to work against "next",
or at least "master". How do the translations get back to "maint"?
Someone has to backport them. What happens when we merge back to
"master"?
Now multiply that by the number of translations. Making messages
merge up nicely with git tools as they drift from topic to topic if
translators want to keep both "maint" and "master" translated would
require at least a nice custom merge driver.
As we noticed before, the .po files are partially automatically
generated anyway. Merging them as text makes about as much sense
as merging Word-generated .rtf files as text. To avoid wasting time,
one wants to be able to work with their _content_.
What is that content?
It is a set of key/value pairs: for each string that appears in
the codebase (maybe together with disambiguating translators' notes),
what the translation is for it. Merging that between branches of the
code base is utterly trivial: take the union. Actually "merging" as
an operation here does not make sense. It is not tied to the
development history at all!
Imagine v6.0.0 of git has message "foo". v6.0.1 changes it to "bar"
because "foo" is not actually true yet, v6.1.0 changes it back to
"foo". Imagine a linear development history. Do we want translation
diffs like this:
commit v6.0.0
+"foo" is "hello" in language X
commit v6.0.1
-"foo" is "hello" in language X
+"bar" is "goodbye" in language X
commit v6.1
-"bar" is "goodbye" in language X
+"foo" is "hello" in language X
? But what really happened is this:
- add foo:hello to translation database
- add bar:goodbye to translation database
I have been thinking about how to write a merge driver for .po files
(and avoid the tedious merge problems that e.g. the dpkg project runs
into periodically) but the idea of avoiding that altogether is very
appealing to me.
On Thu, Sep 2, 2010 at 23:04, Jonathan Nieder [off-list ref] wrote:
quoted
I can't see why translations in the tree (in po/) should be any
trouble at all for us. What sort of issues do you see that the sed.git
model might solve?
Only two: log noise and the problem of what to base patches on.
As you noticed while gettextizing (which is pretty much a one-time
thing), it is not much fun to do work on strings that aren't even
going to be used. So translators might want to work against "next",
or at least "master". How do the translations get back to "maint"?
Someone has to backport them. What happens when we merge back to
"master"?
Now multiply that by the number of translations. Making messages
merge up nicely with git tools as they drift from topic to topic if
translators want to keep both "maint" and "master" translated would
require at least a nice custom merge driver.
As we noticed before, the .po files are partially automatically
generated anyway. Merging them as text makes about as much sense
as merging Word-generated .rtf files as text. To avoid wasting time,
one wants to be able to work with their _content_.
What is that content?
It is a set of key/value pairs: for each string that appears in
the codebase (maybe together with disambiguating translators' notes),
what the translation is for it. Merging that between branches of the
code base is utterly trivial: take the union. Actually "merging" as
an operation here does not make sense. It is not tied to the
development history at all!
Imagine v6.0.0 of git has message "foo". v6.0.1 changes it to "bar"
because "foo" is not actually true yet, v6.1.0 changes it back to
"foo". Imagine a linear development history. Do we want translation
diffs like this:
commit v6.0.0
+"foo" is "hello" in language X
commit v6.0.1
-"foo" is "hello" in language X
+"bar" is "goodbye" in language X
commit v6.1
-"bar" is "goodbye" in language X
+"foo" is "hello" in language X
? But what really happened is this:
- add foo:hello to translation database
- add bar:goodbye to translation database
I have been thinking about how to write a merge driver for .po files
(and avoid the tedious merge problems that e.g. the dpkg project runs
into periodically) but the idea of avoiding that altogether is very
appealing to me.
Those issues might be a bit hard, but I still can't really see how
managing these files outside of git.git would make things easier.
You'd still need to do the merging of e.g. master -> maint
translations, you'd just have to do them outside of git.git, so you
wouldn't be able to do that using the normal merge facilities.
Maybe we can have a custom msgmerge merge driver (someone posted one
in #git-devel, but I've misplaced it), or maybe we should just use
msgmerge with --no-location.
But I'd like to coordinate things on this mailing list, and in
git.git, without some external service being mandatory.
From: Jonathan Nieder <hidden> Date: 2016-06-15 22:49:28
Ævar Arnfjörð Bjarmason wrote:
Those issues might be a bit hard, but I still can't really see how
managing these files outside of git.git would make things easier.
The translationproject.org thing was a red herring. As you noticed,
the relevant thing is "outside of git.git".
So imagine there is a git-translations.git project, perhaps. My
only point was that versioning of translations and versioning of
code can beneficially (in my opinion) be decoupled: with time,
the translations for even _old_ versions of git improve, too.
maybe we should just use
msgmerge with --no-location.
That would partially alleviate my concerns, and I think we might be
able to get the --add-location output back in actual checkouts with
a "smudge" filter.
But still there is noise from reordering messages, adding them and
removing them, and so on. It just never seemed like a great fit for
the usual version control model to me.
But I'd like to coordinate things on this mailing list
[...]
without some external service being mandatory.
No objection here. :)
Of course, what is convenient for translators and maintainers (i.e.,
not me) takes precedence anyway; I am just throwing out ideas.
Thanks for your thoughtfulness.
On Fri, Sep 3, 2010 at 17:51, Jonathan Nieder [off-list ref] wrote:
Ævar Arnfjörð Bjarmason wrote:
quoted
Those issues might be a bit hard, but I still can't really see how
managing these files outside of git.git would make things easier.
The translationproject.org thing was a red herring. As you noticed,
the relevant thing is "outside of git.git".
So imagine there is a git-translations.git project, perhaps. My
only point was that versioning of translations and versioning of
code can beneficially (in my opinion) be decoupled: with time,
the translations for even _old_ versions of git improve, too.
quoted
maybe we should just use
msgmerge with --no-location.
That would partially alleviate my concerns, and I think we might be
able to get the --add-location output back in actual checkouts with
a "smudge" filter.
After looking at this all closer I found that these line messages
really aren't that important to gettext's operation. So I'm in the
process of removing them from the ab/i18n series.
I documented the new process:
http://github.com/avar/git/raw/ab/i18n/po/README
quoted
But I'd like to coordinate things on this mailing list
[...]
quoted
without some external service being mandatory.
No objection here. :)
Of course, what is convenient for translators and maintainers (i.e.,
not me) takes precedence anyway; I am just throwing out ideas.
Thanks for your thoughtfulness.
Sure, thanks for consistently commenting on all of this. It's great to
get feedback like this.
On Thu, Sep 2, 2010 at 20:37, Jonathan Nieder [off-list ref] wrote:
Ævar Arnfjörð Bjarmason wrote:
quoted
It's on top of pu,
[...]
quoted
But I was hoping that this would
make it into pu and after next gets released Any Day Now most of those
other tips in pu would be folded into next along with gettext, or at
least the merge conflicts wouldn't be too painful.
Hmm. That really constrains people trying to merge this series.
As SubmittingPatches explains:
- In the exceptional case that a new feature depends on several topics
not in 'master', start working on 'next' or 'pu' privately and send
out patches for discussion. Before the final merge, you may have to
wait until some of the dependent topics graduate to 'master', and
rebase your work.
so this is fine for discussion, but for merging, having to pull in
_all_ topics from pu (or all topics from next for that matter) for
the patches to apply really is a problem.
Both next and pu get rewound from time to time. They are not meant
to be a stable basis for patches.
Junio: I've started work to rebase this whole thing on master, when
I'm done the result should be able to replace the existing ab/i18n
series you have, i.e. it won't have the Conflicts your "Merge branch
'ab/i18n'" commits have.
Also, I'm going to add a special POISON mode to Git so that we can
check if changing these messages breaks anything in the test suite,
basically:
make GETTEXT_POISON=YesPlease
Which enables this in gettext.h:
#ifdef GETTEXT_POISON
#define _(s) "GETTEXT POISON"
#else
#define _(s) gettext(s)
#endif
Which in my preliminary tests makes a bunch of tests fail, most of it
is stuff like this in t0001-init.sh:
# grep "Initialized empty" again/out1 &&
# grep "Reinitialized existing" again/out2 &&
# >again/empty &&
# test_cmp again/empty again/err1 &&
# test_cmp again/empty again/err2
I.e. just something using the porcelain messages that are OK to
translate. I'm going to add a new NO_GETTEXT_POISON test prereq to all
of these, anything that remains would then indicate plumbing messages
that shouldn't be translated.
Unfortunately we *don't* have complete test coverage so these sort of
tests may miss something. But it should make this series a lot more
robust.
@@ -100,7 +100,7 @@ int cmd_mv(int argc, const char **argv, const char *prefix)constchar*bad=NULL;if(show_only)-printf("Checking rename of '%s' to '%s'\n",src,dst);+printf(_("Checking rename of '%s' to '%s'\n"),src,dst);length=strlen(src);if(lstat(src,&st)<0)
@@ -120,7 +120,7 @@ int cmd_mv(int argc, const char **argv, const char *prefix)first=cache_name_pos(src_w_slash,len_w_slash);if(first>=0)-die("Huh? %.*s is in index?",+die(_("Huh? %.*s is in index?"),len_w_slash,src_w_slash);first=-1-first;
@@ -172,7 +172,7 @@ int cmd_mv(int argc, const char **argv, const char *prefix)*checkbothsourceanddestination*/if(S_ISREG(st.st_mode)||S_ISLNK(st.st_mode)){-warning("%s; will overwrite!",bad);+warning(_("%s; will overwrite!"),bad);bad=NULL;}elsebad="Cannot overwrite";
@@ -203,10 +203,10 @@ int cmd_mv(int argc, const char **argv, const char *prefix)enumupdate_modemode=modes[i];intpos;if(show_only||verbose)-printf("Renaming %s to %s\n",src,dst);+printf(_("Renaming %s to %s\n"),src,dst);if(!show_only&&mode!=INDEX&&rename(src,dst)<0&&!ignore_errors)-die_errno("renaming '%s' failed",src);+die_errno(_("renaming '%s' failed"),src);if(mode==WORKING_DIRECTORY)continue;
@@ -220,7 +220,7 @@ int cmd_mv(int argc, const char **argv, const char *prefix)if(active_cache_changed){if(write_cache(newfd,active_cache,active_nr)||commit_locked_index(&lock_file))-die("Unable to write new index file");+die(_("Unable to write new index file"));}return0;
Like the "In-index merge" message "Merge made by %s." emits to stdout
via finish(), so translating it should be fine.
Signed-off-by: Ævar Arnfjörð Bjarmason <redacted>
---
builtin/merge.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
@@ -820,7 +820,7 @@ static int finish_automerge(struct commit_list *common,free_commit_list(remoteheads);strbuf_addch(&merge_msg,'\n');commit_tree(merge_msg.buf,result_tree,parents,result_commit,NULL);-strbuf_addf(&buf,"Merge made by %s.",wt_strategy);+strbuf_addf(&buf,_("Merge made by %s."),wt_strategy);finish(result_commit,buf.buf);strbuf_release(&buf);drop_save();
@@ -92,20 +92,20 @@ static int reset_index_file(const unsigned char *sha1, int reset_type, int quietif(reset_type==KEEP){unsignedcharhead_sha1[20];if(get_sha1("HEAD",head_sha1))-returnerror("You do not have a valid HEAD.");+returnerror(_("You do not have a valid HEAD."));if(!fill_tree_descriptor(desc,head_sha1))-returnerror("Failed to find tree of HEAD.");+returnerror(_("Failed to find tree of HEAD."));nr++;opts.fn=twoway_merge;}if(!fill_tree_descriptor(desc+nr-1,sha1))-returnerror("Failed to find tree of %s.",sha1_to_hex(sha1));+returnerror(_("Failed to find tree of %s."),sha1_to_hex(sha1));if(unpack_trees(nr,desc,&opts))return-1;if(write_cache(newfd,active_cache,active_nr)||commit_locked_index(lock))-returnerror("Could not write new index file.");+returnerror(_("Could not write new index file."));return0;}
@@ -115,7 +115,7 @@ static void print_new_head_line(struct commit *commit)constchar*hex,*body;hex=find_unique_abbrev(commit->object.sha1,DEFAULT_ABBREV);-printf("HEAD is now at %s",hex);+printf(_("HEAD is now at %s"),hex);body=strstr(commit->buffer,"\n\n");if(body){constchar*eol;
@@ -139,10 +139,10 @@ static int update_index_refresh(int fd, struct lock_file *index_lock, int flags)}if(read_cache()<0)-returnerror("Could not read index");+returnerror(_("Could not read index"));result=refresh_index(&the_index,(flags),NULL,NULL,-"Unstaged changes after reset:")?1:0;+_("Unstaged changes after reset:"))?1:0;if(write_cache(fd,active_cache,active_nr)||commit_locked_index(index_lock))returnerror("Could not refresh index");
@@ -167,7 +167,7 @@ static void update_index_from_diff(struct diff_queue_struct *q,ce=make_cache_entry(one->mode,one->sha1,one->path,0,0);if(!ce)-die("make_cache_entry failed for path '%s'",+die(_("make_cache_entry failed for path '%s'"),one->path);add_cache_entry(ce,ADD_CACHE_OK_TO_ADD|ADD_CACHE_OK_TO_REPLACE);
@@ -300,16 +300,16 @@ int cmd_reset(int argc, const char **argv, const char *prefix)}if(get_sha1(rev,sha1))-die("Failed to resolve '%s' as a valid ref.",rev);+die(_("Failed to resolve '%s' as a valid ref."),rev);commit=lookup_commit_reference(sha1);if(!commit)-die("Could not parse object '%s'.",rev);+die(_("Could not parse object '%s'."),rev);hashcpy(sha1,commit->object.sha1);if(patch_mode){if(reset_type!=NONE)-die("--patch is incompatible with --{hard,mixed,soft}");+die(_("--patch is incompatible with --{hard,mixed,soft}"));returninteractive_reset(rev,argv+i,prefix);}
@@ -318,9 +318,9 @@ int cmd_reset(int argc, const char **argv, const char *prefix)*affectingtheworkingtreenorHEAD.*/if(i<argc){if(reset_type==MIXED)-warning("--mixed with paths is deprecated; use 'git reset -- <paths>' instead.");+warning(_("--mixed with paths is deprecated; use 'git reset -- <paths>' instead."));elseif(reset_type!=NONE)-die("Cannot do %s reset with paths.",+die("Cannot do %s reset with paths."reset_type_names[reset_type]);returnread_from_tree(prefix,argv+i,sha1,quiet?REFRESH_QUIET:REFRESH_IN_PORCELAIN);
@@ -348,7 +348,7 @@ int cmd_reset(int argc, const char **argv, const char *prefix)if(reset_type==KEEP)err=err||reset_index_file(sha1,MIXED,quiet);if(err)-die("Could not reset index file to revision '%s'.",rev);+die(_("Could not reset index file to revision '%s'."),rev);}/* Any resets update HEAD to the head being switched to,
@@ -104,13 +104,13 @@ int cmd_mv(int argc, const char **argv, const char *prefix)length=strlen(src);if(lstat(src,&st)<0)-bad="bad source";+bad=_("bad source");elseif(!strncmp(src,dst,length)&&(dst[length]==0||dst[length]=='/')){-bad="can not move directory into itself";+bad=_("can not move directory into itself");}elseif((src_is_dir=S_ISDIR(st.st_mode))&&lstat(dst,&st)==0)-bad="cannot move directory over file";+bad=_("cannot move directory over file");elseif(src_is_dir){constchar*src_w_slash=add_slash(src);intlen_w_slash=length+1;
@@ -132,7 +132,7 @@ int cmd_mv(int argc, const char **argv, const char *prefix)free((char*)src_w_slash);if(last-first<1)-bad="source directory is empty";+bad=_("source directory is empty");else{intj,dst_len;
@@ -163,9 +163,9 @@ int cmd_mv(int argc, const char **argv, const char *prefix)argc+=last-first;}}elseif(cache_name_pos(src,length)<0)-bad="not under version control";+bad=_("not under version control");elseif(lstat(dst,&st)==0){-bad="destination exists";+bad=_("destination exists");if(force){/**onlyfilescanoverwriteeachother:
@@ -175,10 +175,10 @@ int cmd_mv(int argc, const char **argv, const char *prefix)warning(_("%s; will overwrite!"),bad);bad=NULL;}else-bad="Cannot overwrite";+bad=_("Cannot overwrite");}}elseif(string_list_has_string(&src_for_dst,dst))-bad="multiple sources for the same target";+bad=_("multiple sources for the same target");elsestring_list_insert(&src_for_dst,dst);
Make the basic git-mv messages translatable, but skip things like "rm
'%s'\n" and "git rm '%s'\n" for now.
Signed-off-by: Ævar Arnfjörð Bjarmason <redacted>
---
builtin/rm.c | 22 +++++++++++-----------
1 files changed, 11 insertions(+), 11 deletions(-)
@@ -115,19 +115,19 @@ static int check_local_mod(unsigned char *head, int index_only)*/if(local_changes&&staged_changes){if(!index_only||!(ce->ce_flags&CE_INTENT_TO_ADD))-errs=error("'%s' has staged content different "+errs=error(_("'%s' has staged content different ""from both the file and the HEAD\n"-"(use -f to force removal)",name);+"(use -f to force removal)"),name);}elseif(!index_only){if(staged_changes)-errs=error("'%s' has changes staged in the index\n"+errs=error(_("'%s' has changes staged in the index\n""(use --cached to keep the file, "-"or -f to force removal)",name);+"or -f to force removal)"),name);if(local_changes)-errs=error("'%s' has local modifications\n"+errs=error(_("'%s' has local modifications\n""(use --cached to keep the file, "-"or -f to force removal)",name);+"or -f to force removal)"),name);}}returnerrs;
@@ -191,7 +191,7 @@ int cmd_rm(int argc, const char **argv, const char *prefix)for(i=0;(match=pathspec[i])!=NULL;i++){if(!seen[i]){if(!ignore_unmatch){-die("pathspec '%s' did not match any files",+die(_("pathspec '%s' did not match any files"),match);}}
@@ -199,7 +199,7 @@ int cmd_rm(int argc, const char **argv, const char *prefix)seen_any=1;}if(!recursive&&seen[i]==MATCHED_RECURSIVELY)-die("not removing '%s' recursively without -r",+die(_("not removing '%s' recursively without -r"),*match?match:".");}
@@ -235,7 +235,7 @@ int cmd_rm(int argc, const char **argv, const char *prefix)printf("rm '%s'\n",path);if(remove_file_from_cache(path))-die("git rm: unable to remove %s",path);+die(_("git rm: unable to remove %s"),path);}if(show_only)
@@ -265,7 +265,7 @@ int cmd_rm(int argc, const char **argv, const char *prefix)if(active_cache_changed){if(write_cache(newfd,active_cache,active_nr)||commit_locked_index(&lock_file))-die("Unable to write new index file");+die(_("Unable to write new index file"));}return0;
Make the messages in git-reset that use the reset_type_names static
array to be translatable by marking the array items with N_() and
using _() later.
Signed-off-by: Ævar Arnfjörð Bjarmason <redacted>
---
builtin/reset.c | 14 +++++++-------
1 files changed, 7 insertions(+), 7 deletions(-)
@@ -228,8 +228,8 @@ static void prepend_reflog_action(const char *action, char *buf, size_t size)staticvoiddie_if_unmerged_cache(intreset_type){if(is_merge()||read_cache()<0||unmerged_cache())-die("Cannot do a %s reset in the middle of a merge.",-reset_type_names[reset_type]);+die(_("Cannot do a %s reset in the middle of a merge."),+_(reset_type_names[reset_type]));}
@@ -320,8 +320,8 @@ int cmd_reset(int argc, const char **argv, const char *prefix)if(reset_type==MIXED)warning(_("--mixed with paths is deprecated; use 'git reset -- <paths>' instead."));elseif(reset_type!=NONE)-die("Cannot do %s reset with paths."-reset_type_names[reset_type]);+die(_("Cannot do %s reset with paths."),+_(reset_type_names[reset_type]));returnread_from_tree(prefix,argv+i,sha1,quiet?REFRESH_QUIET:REFRESH_IN_PORCELAIN);}
@@ -332,8 +332,8 @@ int cmd_reset(int argc, const char **argv, const char *prefix)setup_work_tree();if(reset_type==MIXED&&is_bare_repository())-die("%s reset is not allowed in a bare repository",-reset_type_names[reset_type]);+die(_("%s reset is not allowed in a bare repository"),+_(reset_type_names[reset_type]));/* Soft reset does not touch the index file nor the working tree*atall,butrequirestheminagoodorder.Otherresetsreset
changing it to
N_("mixed reset"), N_("soft reset"), ...
and changing this
- die("Cannot do a %s reset in the middle of a merge.",
- reset_type_names[reset_type]);
+ die(_("Cannot do a %s reset in the middle of a merge."),
+ _(reset_type_names[reset_type]));