From 9665627d8cc6f0263f0019e92c67a38223804b57 Mon Sep 17 00:00:00 2001 From: Nguyễn Thái Ngọc Duy Date: Mon, 23 Apr 2012 19:30:24 +0700 Subject: i18n: help: mark strings for translation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This patch also marks most common commands' synopsis for translation so that "git help" gives a friendly listing. Signed-off-by: Nguyễn Thái Ngọc Duy Signed-off-by: Junio C Hamano --- help.c | 32 ++++++++++++++++++++------------ 1 file changed, 20 insertions(+), 12 deletions(-) (limited to 'help.c') diff --git a/help.c b/help.c index 14eefc91ce..9e6e0f2ab7 100644 --- a/help.c +++ b/help.c @@ -217,8 +217,9 @@ void list_commands(const char *title, struct cmdnames *main_cmds, if (main_cmds->cnt) { const char *exec_path = git_exec_path(); - printf("available %s in '%s'\n", title, exec_path); - printf("----------------"); + 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)); putchar('\n'); pretty_print_string_list(main_cmds, longest); @@ -226,8 +227,12 @@ void list_commands(const char *title, struct cmdnames *main_cmds, } if (other_cmds->cnt) { - printf("%s available from elsewhere on your $PATH\n", title); - printf("---------------------------------------"); + 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)); putchar('\n'); pretty_print_string_list(other_cmds, longest); @@ -341,7 +346,7 @@ const char *help_unknown_cmd(const char *cmd) sizeof(*main_cmds.names), levenshtein_compare); if (!main_cmds.cnt) - die ("Uh oh. Your system reports no Git commands at all."); + die(_("Uh oh. Your system reports no Git commands at all.")); /* skip and count prefix matches */ for (n = 0; n < main_cmds.cnt && !main_cmds.names[n]->len; n++) @@ -362,23 +367,26 @@ const char *help_unknown_cmd(const char *cmd) const char *assumed = main_cmds.names[0]->name; main_cmds.names[0] = NULL; clean_cmdnames(&main_cmds); - fprintf(stderr, "WARNING: You called a Git command named '%s', " - "which does not exist.\n" - "Continuing under the assumption that you meant '%s'\n", + fprintf_ln(stderr, + _("WARNING: You called a Git command named '%s', " + "which does not exist.\n" + "Continuing under the assumption that you meant '%s'"), cmd, assumed); if (autocorrect > 0) { - fprintf(stderr, "in %0.1f seconds automatically...\n", + fprintf_ln(stderr, _("in %0.1f seconds automatically..."), (float)autocorrect/10.0); poll(NULL, 0, autocorrect * 100); } return assumed; } - fprintf(stderr, "git: '%s' is not a git command. See 'git --help'.\n", cmd); + fprintf_ln(stderr, _("git: '%s' is not a git command. See 'git --help'."), cmd); if (SIMILAR_ENOUGH(best_similarity)) { - fprintf(stderr, "\nDid you mean %s?\n", - n < 2 ? "this": "one of these"); + fprintf_ln(stderr, + Q_("\nDid you mean this?", + "\nDid you mean one of these?", + n)); for (i = 0; i < n; i++) fprintf(stderr, "\t%s\n", main_cmds.names[i]->name); -- cgit v1.3 From 4470ef94973cf40bb83864d480cee1e064053879 Mon Sep 17 00:00:00 2001 From: Nguyễn Thái Ngọc Duy Date: Wed, 25 Apr 2012 18:21:53 +0700 Subject: help: replace underlining "help -a" headers using hyphens with a blank line MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We used to underline a header text, like this: This is a header ---------------- content... But calculating text length so that the dashes align with the text could get complicated because the text could be in any charset in translated Git. There is no point to use this pseudo underline; simply a blank line would do and it even makes it easier to read: 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 Signed-off-by: Junio C Hamano --- builtin/help.c | 2 +- help.c | 16 +++------------- help.h | 3 +-- 3 files changed, 5 insertions(+), 16 deletions(-) (limited to 'help.c') diff --git a/builtin/help.c b/builtin/help.c index 96a462cf1b..e63668ade4 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 9e6e0f2ab7..a39b7bf897 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 b6b12d5754..dc406c8c50 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 */ -- cgit v1.3