git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: "Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>
To: Jonathan Niedier <jrnieder@gmail.com>
Cc: git@vger.kernel.org, "Junio C Hamano" <gitster@pobox.com>,
	"Ævar Arnfjörð" <avarab@gmail.com>,
	"Jiang Xin" <worldhello.net@gmail.com>,
	"Zbigniew Jędrzejewski-Szmek" <zbyszek@in.waw.pl>,
	"Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>
Subject: [PATCH] help: replace underlining "help -a" headers using hyphens with a blank line
Date: Wed, 25 Apr 2012 18:21:53 +0700	[thread overview]
Message-ID: <1335352913-32684-1-git-send-email-pclouds@gmail.com> (raw)
In-Reply-To: <20120423183439.GA12916@burratino>

We want the underline to align with the text above, for example:

This is a header
----------------
content...

Unfortunately calculating text length could get complicated because
the text could be in any charset in translated Git. Avoid it and print
a blank line (i.e. charset neutral) instead. Readability is not
affected much. After the change we get:

This is a header:

content...

While at it, give translators more context to translate, e.g.
e.g.  "git commands available..." instead of "%s available..."

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
 2012/4/24 Jonathan Nieder <jrnieder@gmail.com>:
 > Junio C Hamano wrote:
 >
 >>                                                        Wouldn't a simple
 >> and clean "blank line" look better?
 >
 > Yes, based on a quick test with "vi" it looks reasonable.  Thanks for
 > a sanity check.

 And it does _not_ assume the translated text is in utf-8.

 And thanks Junio for fixing the other nit before merging the seriess
 to next. I should have read and reacted on these posts yesterday.

 builtin/help.c |    2 +-
 help.c         |   16 +++-------------
 help.h         |    3 +--
 3 files changed, 5 insertions(+), 16 deletions(-)

diff --git a/builtin/help.c b/builtin/help.c
index 96a462c..e63668a 100644
--- a/builtin/help.c
+++ b/builtin/help.c
@@ -425,7 +425,7 @@ int cmd_help(int argc, const char **argv, const char *prefix)
 
 	if (show_all) {
 		printf(_("usage: %s%s"), _(git_usage_string), "\n\n");
-		list_commands(_("git commands"), &main_cmds, &other_cmds);
+		list_commands(&main_cmds, &other_cmds);
 		printf("%s\n", _(git_more_info_string));
 		return 0;
 	}
diff --git a/help.c b/help.c
index 9e6e0f2..baaf379 100644
--- a/help.c
+++ b/help.c
@@ -203,8 +203,7 @@ void load_command_list(const char *prefix,
 	exclude_cmds(other_cmds, main_cmds);
 }
 
-void list_commands(const char *title, struct cmdnames *main_cmds,
-		   struct cmdnames *other_cmds)
+void list_commands(struct cmdnames *main_cmds, struct cmdnames *other_cmds)
 {
 	int i, longest = 0;
 
@@ -217,23 +216,14 @@ void list_commands(const char *title, struct cmdnames *main_cmds,
 
 	if (main_cmds->cnt) {
 		const char *exec_path = git_exec_path();
-		printf_ln(_("available %s in '%s'"), title, exec_path);
-		/* TRANSLATORS: this must align with "available %s in '%s'" */
-		printf(_("----------------"));
-		mput_char('-', strlen(title) + strlen(exec_path));
+		printf_ln(_("available git commands in '%s':"), exec_path);
 		putchar('\n');
 		pretty_print_string_list(main_cmds, longest);
 		putchar('\n');
 	}
 
 	if (other_cmds->cnt) {
-		printf_ln(_("%s available from elsewhere on your $PATH"), title);
-		/* TRANSLATORS:
-		 * this must align with
-		 * "%s available from elsewhere on your $PATH"
-		 */
-		printf(_("---------------------------------------"));
-		mput_char('-', strlen(title));
+		printf_ln(_("git commands available from elsewhere on your $PATH:"));
 		putchar('\n');
 		pretty_print_string_list(other_cmds, longest);
 		putchar('\n');
diff --git a/help.h b/help.h
index b6b12d5..dc406c8 100644
--- a/help.h
+++ b/help.h
@@ -25,8 +25,7 @@ extern void add_cmdname(struct cmdnames *cmds, const char *name, int len);
 /* Here we require that excludes is a sorted list. */
 extern void exclude_cmds(struct cmdnames *cmds, struct cmdnames *excludes);
 extern int is_in_cmdlist(struct cmdnames *cmds, const char *name);
-extern void list_commands(const char *title,
-			  struct cmdnames *main_cmds,
+extern void list_commands(struct cmdnames *main_cmds,
 			  struct cmdnames *other_cmds);
 
 #endif /* HELP_H */
-- 
1.7.8.36.g69ee2

  reply	other threads:[~2012-04-25 11:25 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-23 12:30 [PATCH 00/10] i18n relative dates, help, remote, apply, index-pack and bundle Nguyễn Thái Ngọc Duy
2012-04-23 12:30 ` [PATCH 01/10] Makefile: feed all header files to xgettext Nguyễn Thái Ngọc Duy
2012-04-23 12:30 ` [PATCH 02/10] Add three convenient format printing functions with \n automatically appended Nguyễn Thái Ngọc Duy
2012-04-23 16:15   ` Jonathan Nieder
2012-04-23 12:30 ` [PATCH 03/10] i18n: mark relative dates for translation Nguyễn Thái Ngọc Duy
2012-04-24 20:04   ` Junio C Hamano
2012-04-25 10:46     ` Nguyen Thai Ngoc Duy
2012-04-25 11:07       ` Johannes Sixt
2012-04-25 11:25         ` Zbigniew Jędrzejewski-Szmek
2012-04-25 11:29         ` Nguyen Thai Ngoc Duy
2012-04-25 15:25       ` Jonathan Nieder
2012-04-25 16:27         ` Junio C Hamano
2012-04-25 17:26           ` Jonathan Nieder
2012-04-23 12:30 ` [PATCH 04/10] i18n: help: mark strings " Nguyễn Thái Ngọc Duy
2012-04-23 16:30   ` Jonathan Nieder
2012-04-23 18:18     ` Junio C Hamano
2012-04-23 18:34       ` Jonathan Nieder
2012-04-25 11:21         ` Nguyễn Thái Ngọc Duy [this message]
2012-04-25 17:30           ` [PATCH] help: replace underlining "help -a" headers using hyphens with a blank line Junio C Hamano
2012-04-23 12:30 ` [PATCH 05/10] i18n: make warn_dangling_symref() automatically append \n Nguyễn Thái Ngọc Duy
2012-04-23 12:30 ` [PATCH 06/10] i18n: remote: mark strings for translation Nguyễn Thái Ngọc Duy
2012-04-25 22:54   ` Junio C Hamano
2012-04-26  1:12     ` Nguyen Thai Ngoc Duy
2012-04-23 12:30 ` [PATCH 07/10] i18n: apply: " Nguyễn Thái Ngọc Duy
2012-04-25 22:50   ` Junio C Hamano
2012-05-06 13:13     ` [PATCH] apply: remove lego in i18n string in gitdiff_verify_name Nguyễn Thái Ngọc Duy
2012-05-07 18:00       ` Junio C Hamano
2012-05-08 13:38         ` Nguyễn Thái Ngọc Duy
2012-05-08 17:07           ` Junio C Hamano
2012-05-09 12:29             ` Nguyễn Thái Ngọc Duy
2012-04-23 12:30 ` [PATCH 08/10] i18n: apply: update say_patch_name to give translators complete sentence Nguyễn Thái Ngọc Duy
2012-04-23 12:30 ` [PATCH 09/10] i18n: index-pack: mark strings for translation Nguyễn Thái Ngọc Duy
2012-04-23 12:30 ` [PATCH 10/10] i18n: bundle: " Nguyễn Thái Ngọc Duy
2012-04-25 22:43   ` Junio C Hamano
2012-04-26  1:24     ` Nguyen Thai Ngoc Duy
2012-04-26  5:53       ` [PATCH] bundle: remove stray single-quote from error message Jonathan Nieder
2012-04-23 16:41 ` [PATCH 00/10] i18n relative dates, help, remote, apply, index-pack and bundle Jonathan Nieder
2012-04-23 18:56 ` Junio C Hamano
2012-04-23 20:06   ` Ævar Arnfjörð Bjarmason
2012-04-24 12:19 ` Nguyen Thai Ngoc Duy
2012-04-24 19:50   ` Junio C Hamano
2012-04-25 11:42     ` Nguyen Thai Ngoc Duy
2012-04-25 16:11       ` Jonathan Nieder

Reply instructions:

You may reply publicly 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=1335352913-32684-1-git-send-email-pclouds@gmail.com \
    --to=pclouds@gmail.com \
    --cc=avarab@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=jrnieder@gmail.com \
    --cc=worldhello.net@gmail.com \
    --cc=zbyszek@in.waw.pl \
    /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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).