From: Nguyen Thai Ngoc Duy <pclouds@gmail.com>
To: Jonathan Nieder <jrnieder@gmail.com>
Cc: git@vger.kernel.org, "Ævar Arnfjörð" <avarab@gmail.com>,
"Jiang Xin" <worldhello.net@gmail.com>,
"Peter Krefting" <peter@softwolves.pp.se>
Subject: Re: [PATCH 2/5] i18n: mark relative dates for translation
Date: Fri, 16 Mar 2012 18:47:06 +0700 [thread overview]
Message-ID: <CACsJy8D0KN_M3txmq3J==3Q5=u2XAa0hR=Wm+=T3qYN+LAuWkQ@mail.gmail.com> (raw)
In-Reply-To: <20120315185102.GA4636@burratino>
On Fri, Mar 16, 2012 at 1:51 AM, Jonathan Nieder <jrnieder@gmail.com> wrote:
> Hi,
>
> Nguyễn Thái Ngọc Duy wrote:
>
>> English dates get correct plural/singular form as a side effect.
> [...]
>> +++ b/date.c
>> @@ -93,38 +93,46 @@ const char *show_date_relative(unsigned long time, int tz,
> [...]
>> if (diff < 90) {
>> - snprintf(timebuf, timebuf_size, "%lu seconds ago", diff);
>> + snprintf(timebuf, timebuf_size,
>> + Q_("%lu second ago", "%lu seconds ago", diff), diff);
>> return timebuf;
>
> This leaves me vaguely nervous --- sure, no language is going to use
> an expression for "<n> years" that is more than 200 bytes long, but if
> one does, it would get truncated.
>
> Would something like the following (untested) on top make sense?
It does. I will reuse your patch next time.
> My other worry is that
>
>> + struct strbuf sb = STRBUF_INIT;
>> + strbuf_addf(&sb, Q_("%lu year", "%lu years", years), years);
>> + /* TRANSLATORS: "%s" is "<n> years" */
>> + snprintf(timebuf, timebuf_size,
>> + Q_("%s, %lu month ago", "%s, %lu months ago", months),
>> + sb.buf, months);
>> + strbuf_release(&sb);
>
> seems excessively complicated. How do translations normally deal with
> cases like this of strings with multiple numbers in them?
I don't recall any similar cases. A search for 'ago"' in all gnome
translations I have only shows "<one number> ago", or "%d blah ago,
<absolute time>". The closet is probably strftime, where translators
are free to reorder date and time items, something like this
/* Translators: the first %s is the number of months, the second the
number of years */
sprintf(.., "%s, %s ago", month_string, year_string);
Or we can just round it up and show only one number.
--
Duy
next prev parent reply other threads:[~2012-03-16 11:47 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-03-08 9:16 [PATCH 0/5] i18n-ize relative dates, git-help and parseopt Nguyễn Thái Ngọc Duy
2012-03-08 9:16 ` [PATCH 1/5] i18n: keep the last \n even when text is poisoned Nguyễn Thái Ngọc Duy
2012-03-08 22:01 ` Jonathan Nieder
2012-03-09 1:11 ` Nguyen Thai Ngoc Duy
2012-03-09 2:33 ` Nguyen Thai Ngoc Duy
2012-03-09 11:24 ` Ævar Arnfjörð Bjarmason
2012-03-08 9:16 ` [PATCH 2/5] i18n: mark relative dates for translation Nguyễn Thái Ngọc Duy
2012-03-15 18:51 ` Jonathan Nieder
2012-03-15 19:16 ` Johannes Sixt
2012-03-15 19:18 ` Jonathan Nieder
2012-03-16 11:47 ` Nguyen Thai Ngoc Duy [this message]
2012-03-08 9:16 ` [PATCH 3/5] i18n: parseopt: lookup help and argument translations when showing usage Nguyễn Thái Ngọc Duy
2012-03-08 22:07 ` Jonathan Nieder
2012-03-08 9:16 ` [PATCH 4/5] i18n: help: mark parseopt strings for translation Nguyễn Thái Ngọc Duy
2012-03-08 9:16 ` [PATCH 5/5] i18n: help: mark " Nguyễn Thái Ngọc Duy
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='CACsJy8D0KN_M3txmq3J==3Q5=u2XAa0hR=Wm+=T3qYN+LAuWkQ@mail.gmail.com' \
--to=pclouds@gmail.com \
--cc=avarab@gmail.com \
--cc=git@vger.kernel.org \
--cc=jrnieder@gmail.com \
--cc=peter@softwolves.pp.se \
--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
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).