git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 1/1] Mark messages for translations

From
Johannes Sixt <j6t@kdbg.org>
Date
Jan 15, 2018, 07:33 UTC
Message-ID
<b9e734a2-52bb-08b1-6bab-3d47b0f7ebeb@kdbg.org>
In-Reply-To
<20180115054419.4112-2-ash@kambanaria.org>
Am 15.01.2018 um 06:44 schrieb Alexander Shopov:
Show 24 quoted lines
> @@ -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.

Show 14 quoted lines
> @@ -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.

Show 6 quoted lines
> @@ -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.

Show 7 quoted lines
>   			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");
...
Show 21 quoted lines
> @@ -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
Previous: Alexander ShopovNext: Eric Sunshine
Message 3 of 20 in “Marked end user messages for translation”
  1. 0/1 Marked end user messages for translationAlexander Shopov, Jan 15, 2018
  2. 1/1 Mark messages for translationsAlexander Shopov, Jan 15, 2018
  3. Johannes SixtJan 15, 2018
  4. Eric SunshineJan 15, 2018
  5. Duy NguyenJan 15, 2018
  6. 0/1 Mark messages for translationsAlexander Shopov, Feb 6, 2018
  7. 1/1 Mark messages for translationsAlexander Shopov, Feb 6, 2018
  8. Eric SunshineFeb 6, 2018
  9. Jeff KingFeb 6, 2018
  10. 0/1 Mark messages for translationsAlexander Shopov, Feb 9, 2018
  11. 1/1 Mark messages for translationsAlexander Shopov, Feb 9, 2018
  12. Junio C HamanoFeb 9, 2018
  13. Junio C HamanoFeb 9, 2018
  14. Jeff KingFeb 9, 2018
  15. t0002: simplify error checkingJeff King, Feb 10, 2018
  16. Alexander ShopovFeb 12, 2018
  17. Jeff KingFeb 12, 2018
  18. 0/1 Mark messages for translationAlexander Shopov, Feb 13, 2018
  19. 1/1 Mark messages for translationsAlexander Shopov, Feb 13, 2018
  20. Alexander ShopovJan 15, 2018

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.