Subject: Re: [PATCH] apply: remove lego in i18n string in gitdiff_verify_name

From: Junio C Hamano <[email-masked]>
Date: Tue, 08 May 2012 10:07:33 -0700

Nguyễn Thái Ngọc Duy  <[email-masked]> writes:

> Currently it marks the string "...inconsistent %s filename..." where
> %s is either "old" or "new" from caller. From a translator point of
> view, nothing hints what "%s" may be. Make it two strings
> "...inconsistent new filename..." and "...inconsistent old
> filename..."

True.  Also depending on 'old' vs 'new', the translation of "filename" or
other parts of the message may have to inflect/conjugate, so the original
message structure was very unfriendly to i18n.

> +		if (!another || memcmp(another, name, len + 1)) {
> +			if (!strcmp(oldnew, "old"))
> +				die(_("git apply: bad git-diff - inconsistent old filename on line %d"), linenr);
> +			else if (!strcmp(oldnew, "new"))
> +				die(_("git apply: bad git-diff - inconsistent new filename on line %d"), linenr);
> +			else
> +				die("BUG: please add a new full string for '%s' similar to above code.\n"
> +				    "It makes translators' life much simpler. Thanks!", oldnew);
> +		}

I think this is way over-engineered.  enum { DIFF_OLD = 0, DIFF_NEW = 1 }
or even passing 'n' vs 'o' was what I was expecting to see.