git@vger.kernel.org mailing list mirror (one of many)
 help / Atom feed
From: Johannes Sixt <j6t@kdbg.org>
To: Alexander Shopov <ash@kambanaria.org>
Cc: git@vger.kernel.org, gitster@pobox.com, martin.agren@gmail.com,
	bmwill@google.com, peff@peff.net, sandals@crustytoothpaste.net,
	worldhello.net@gmail.com
Subject: Re: [PATCH 1/1] Mark messages for translations
Date: Mon, 15 Jan 2018 08:33:56 +0100
Message-ID: <b9e734a2-52bb-08b1-6bab-3d47b0f7ebeb@kdbg.org> (raw)
In-Reply-To: <20180115054419.4112-2-ash@kambanaria.org>

Am 15.01.2018 um 06:44 schrieb Alexander Shopov:
> @@ -5,11 +5,11 @@
>   #include "run-command.h"
>   
>   const char git_usage_string[] =
> -	"git [--version] [--help] [-C <path>] [-c name=value]\n"
> -	"           [--exec-path[=<path>]] [--html-path] [--man-path] [--info-path]\n"
> -	"           [-p | --paginate | --no-pager] [--no-replace-objects] [--bare]\n"
> -	"           [--git-dir=<path>] [--work-tree=<path>] [--namespace=<name>]\n"
> -	"           <command> [<args>]";
> +	N_("git [--version] [--help] [-C <path>] [-c name=value]\n"
> +	   "           [--exec-path[=<path>]] [--html-path] [--man-path] [--info-path]\n"
> +	   "           [-p | --paginate | --no-pager] [--no-replace-objects] [--bare]\n"
> +	   "           [--git-dir=<path>] [--work-tree=<path>] [--namespace=<name>]\n"
> +	   "           <command> [<args>]");
>   
>   const char git_more_info_string[] =
>   	N_("'git help -a' and 'git help -g' list available subcommands and some\n"
> @@ -92,7 +92,7 @@ static int handle_options(const char ***argv, int *argc, int *envchanged)
>   				*envchanged = 1;
>   		} else if (!strcmp(cmd, "--git-dir")) {
>   			if (*argc < 2) {
> -				fprintf(stderr, "No directory given for --git-dir.\n" );
> +  				fprintf(stderr, _("No directory given for --git-dir.\n" ));
>   				usage(git_usage_string);

It is not obvious to me where git_usage_string is looked up in the 
message catalog. Should this not be

				usage(_(git_usage_string));

(here and in later instances)? It is used that way in builtin/help.c, 
for example.

> @@ -385,14 +385,14 @@ void setup_work_tree(void)
>   		return;
>   
>   	if (work_tree_config_is_bogus)
> -		die("unable to set up work tree using invalid config");
> +		die(_("unable to set up work tree using invalid config"));
>   
>   	work_tree = get_git_work_tree();
>   	git_dir = get_git_dir();
>   	if (!is_absolute_path(git_dir))
>   		git_dir = real_path(get_git_dir());
>   	if (!work_tree || chdir(work_tree))
> -		die("This operation must be run in a work tree");
> +		die(_("This operation must be run in a work tree"));

We have settled with lower-case letters at the beginning of error 
messages. (See Documentation/CodingGuidelines, "Error Messages".) You 
could fix that while you are touching die, die_errno, etc, messages.

> @@ -677,12 +677,12 @@ static const char *setup_explicit_git_dir(const char *gitdirenv,
>   		else {
>   			char *core_worktree;
>   			if (chdir(gitdirenv))
> -				die_errno("Could not chdir to '%s'", gitdirenv);
> +				die_errno(_("Cannot chdir to '%s'"), gitdirenv);

I notice you change past tense to present tense in some cases. IMO, this 
makes the messages more consistent. Good.

I'm not a friend of geeky abbreviations like "chdir" or "cwd" in 
user-visible messages, and I would have taken the opportunity to change 
the messages accordingly. This is really only my personal taste, though, 
and it's possible that I'm alone in this camp.

>   			if (chdir(git_work_tree_cfg))
> -				die_errno("Could not chdir to '%s'", git_work_tree_cfg);
> +				die_errno(_("Cannot chdir to '%s'"), git_work_tree_cfg);
>   			core_worktree = xgetcwd();
>   			if (chdir(cwd->buf))
> -				die_errno("Could not come back to cwd");
> +				die_errno(_("Cannot come back to cwd");
...
> @@ -1207,7 +1207,7 @@ void sanitize_stdfds(void)
>   	while (fd != -1 && fd < 2)
>   		fd = dup(fd);
>   	if (fd == -1)
> -		die_errno("open /dev/null or dup failed");
> +		die_errno(_("open /dev/null or dup failed"));
>   	if (fd > 2)
>   		close(fd);
>   }
> @@ -1222,12 +1222,12 @@ int daemonize(void)
>   		case 0:
>   			break;
>   		case -1:
> -			die_errno("fork failed");
> +			die_errno(_("fork failed"));
>   		default:
>   			exit(0);
>   	}
>   	if (setsid() == -1)
> -		die_errno("setsid failed");
> +		die_errno(_("setsid failed"));

Here is a certain class of errors: They should occur only rarely 
(actually, is that true?) Then it is useful to have the function name in 
the message. Which rises the question: why translate them at all? It's 
possible that translators turn the message into unusable gibberish just 
to please their language. All of this is only IMHO; I don't use 
translated Git.

-- Hannes

  reply index

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-15  5:44 [PATCH 0/1] Marked end user messages for translation Alexander Shopov
2018-01-15  5:44 ` [PATCH 1/1] Mark messages for translations Alexander Shopov
2018-01-15  7:33   ` Johannes Sixt [this message]
     [not found]     ` <CAP6f5Mnn+pRdL6ihgwcqsTwyGy+EQfBbgPxkFmGLcWL-hJx-8g@mail.gmail.com>
     [not found]       ` <CAP6f5MnaMiqEMbGW_xj6X495jF=txpzeq+DEHOkz7VCg2D6D9w@mail.gmail.com>
2018-01-15  9:16         ` Alexander Shopov
2018-01-15  9:58   ` Eric Sunshine
2018-01-15 10:21   ` Duy Nguyen
2018-02-06  6:15 ` [PATCH 0/1] " Alexander Shopov
2018-02-06  6:15 ` [PATCH 1/1] " Alexander Shopov
2018-02-06  7:32   ` Eric Sunshine
2018-02-06  7:38     ` Jeff King
2018-02-09  7:44       ` [PATCH 0/1] " Alexander Shopov
2018-02-09  7:44       ` [PATCH 1/1] " Alexander Shopov
2018-02-09 18:20         ` Junio C Hamano
2018-02-09 19:15           ` Junio C Hamano
2018-02-09 19:30             ` Jeff King
2018-02-10 11:31               ` [PATCH] t0002: simplify error checking Jeff King
2018-02-12 15:03               ` [PATCH 1/1] Mark messages for translations Alexander Shopov
2018-02-12 15:15                 ` Jeff King
2018-02-13 13:19                   ` [PATCH 0/1] Mark messages for translation Alexander Shopov
2018-02-13 13:19                   ` [PATCH 1/1] Mark messages for translations Alexander Shopov

Reply instructions:

You may reply publically to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b9e734a2-52bb-08b1-6bab-3d47b0f7ebeb@kdbg.org \
    --to=j6t@kdbg.org \
    --cc=ash@kambanaria.org \
    --cc=bmwill@google.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=martin.agren@gmail.com \
    --cc=peff@peff.net \
    --cc=sandals@crustytoothpaste.net \
    --cc=worldhello.net@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

git@vger.kernel.org mailing list mirror (one of many)

Archives are clonable:
	git clone --mirror https://public-inbox.org/git
	git clone --mirror http://ou63pmih66umazou.onion/git
	git clone --mirror http://czquwvybam4bgbro.onion/git
	git clone --mirror http://hjrcffqmbrq6wope.onion/git

Newsgroups are available over NNTP:
	nntp://news.public-inbox.org/inbox.comp.version-control.git
	nntp://ou63pmih66umazou.onion/inbox.comp.version-control.git
	nntp://czquwvybam4bgbro.onion/inbox.comp.version-control.git
	nntp://hjrcffqmbrq6wope.onion/inbox.comp.version-control.git
	nntp://news.gmane.org/gmane.comp.version-control.git

 note: .onion URLs require Tor: https://www.torproject.org/
       or Tor2web: https://www.tor2web.org/

AGPL code for this site: git clone https://public-inbox.org/ public-inbox