[pacman-dev] [PATCH] Mark string as translatable
Dan McGee
dpmcgee at gmail.com
Sat Apr 6 11:55:11 EDT 2013
On Sat, Apr 6, 2013 at 10:27 AM, Andrew Gregory
<andrew.gregory.8 at gmail.com>wrote:
> On 04/07/13 at 01:09am, Allan McRae wrote:
> > On 07/04/13 00:58, Dan McGee wrote:
> > > On Sat, Apr 6, 2013 at 12:03 AM, Allan McRae <allan at archlinux.org>
> wrote:
> > >
> > >> Signed-off-by: Allan McRae <allan at archlinux.org>
> > >> ---
> > >> src/pacman/callback.c | 2 +-
> > >> 1 file changed, 1 insertion(+), 1 deletion(-)
> > >>
> > >> diff --git a/src/pacman/callback.c b/src/pacman/callback.c
> > >> index 71d9d04..3fa2166 100644
> > >> --- a/src/pacman/callback.c
> > >> +++ b/src/pacman/callback.c
> > >> @@ -401,7 +401,7 @@ void cb_question(alpm_question_t event, void
> *data1,
> > >> void *data2,
> > >> strftime(created, 12, "%Y-%m-%d",
> > >> localtime(&time));
> > >>
> > >> if(key->revoked) {
> > >> - revoked = " (revoked)";
> > >> + revoked = _(" (revoked)");
> > >>
> > > It might be better to find a way to not have the leading space in the
> > > translatable part; these are the kind of things that often get messed
> up.
> > > I'm not sure I see a great way of doing that though without another
> '%s' in
> > > the format string and a ternary (key->revoked ? " " : "").
> > >
> >
> > I had considered that (I do not even like the brackets in the translated
> > string), but had not found a solution. I'll go for the ternary if
> > really, really needed...
> >
> > > }
> > >>
> > >> *response = yesno(_("Import PGP key
> > >> %d%c/%s, \"%s\", created: %s%s?"),
> > >> --
> > >> 1.8.2
>
> We could treat this almost like we do strings with plurals. Have the
> full "Import PGP key..." translated both with and without the
> "(revoked)"
+1 to this, it isn't without precedent elsewhere. Like this in
libalpm/deps.c:
_alpm_log(handle, ALPM_LOG_WARNING, _("dependency cycle
detected:\n"));
if(reverse) {
_alpm_log(handle, ALPM_LOG_WARNING,
_("%s will be removed after its %s
dependency\n"),
vertexpkg->name, childpkg->name);
} else {
_alpm_log(handle, ALPM_LOG_WARNING,
_("%s will be installed before its %s
dependency\n"),
vertexpkg->name, childpkg->name);
}
}
-Dan
More information about the pacman-dev
mailing list