diff options
author | Jiang Xin <worldhello.net@gmail.com> | 2014-04-22 22:39:10 +0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2014-04-23 00:02:15 -0700 |
commit | dd75553b357d4483d2b58a9e1ac86352f3d2e103 (patch) | |
tree | dd9195aa76294981342188c8e4e6a5e04642b12b /builtin/blame.c | |
parent | bccce0f8099fac6bcc80914726ddf43ca544b3c1 (diff) | |
download | git-dd75553b357d4483d2b58a9e1ac86352f3d2e103.tar.gz |
blame: dynamic blame_date_width for different localesjx/blame-align-relative-time
When show date in relative date format for git-blame, the max display
width of datetime is set as the length of the string "Thu Oct 19
16:00:04 2006 -0700" (30 characters long). But actually the max width
for C locale is only 22 (the length of string "x years, xx months ago").
And for other locale, it maybe smaller. E.g. For Chinese locale, only
needs a half (16-character width).
Set blame_date_width as the display width of _("4 years, 11 months
ago"), so that translators can make the choice.
Helped-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Jiang Xin <worldhello.net@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/blame.c')
-rw-r--r-- | builtin/blame.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/builtin/blame.c b/builtin/blame.c index 35e95db15d..128fc64d64 100644 --- a/builtin/blame.c +++ b/builtin/blame.c @@ -2338,7 +2338,14 @@ parse_done: blame_date_width = sizeof("2006-10-19"); break; case DATE_RELATIVE: - /* "normal" is used as the fallback for "relative" */ + /* TRANSLATORS: This string is used to tell us the maximum + display width for a relative timestamp in "git blame" + output. For C locale, "4 years, 11 months ago", which + takes 22 places, is the longest among various forms of + relative timestamps, but your language may need more or + fewer display columns. */ + blame_date_width = utf8_strwidth(_("4 years, 11 months ago")) + 1; /* add the null */ + break; case DATE_LOCAL: case DATE_NORMAL: blame_date_width = sizeof("Thu Oct 19 16:00:04 2006 -0700"); |