Re: [PATCH 0/13] xfs_repair: recombine cut&waste code in dir2.c/attr_repair.c

Carlos Maiolino
2015-09-11T08:20:29Z

On Thu, Sep 10, 2015 at 11:51:08AM -0500, Eric Sandeen wrote:
> On 9/10/15 4:22 AM, Carlos Maiolino wrote:
> > On Wed, Sep 09, 2015 at 02:33:58PM -0500, Eric Sandeen wrote:
>
> ...
>
> >> The last patch fixes up the dir vs. attr text in error messages
> >> and comments. I do have a question about whether this is ok
> >> for i8n:
> >>
> >> printf(_("This string is %s"), _("awesome"));
> >
> > This should be fine for i18n, I had used it a lot when I added i18n support in
> > gfs2-utils, and _() is the default macro that should embrace every string that
> > needs to be translated. It will be replaced by gettext("awesome"), and there is
> > no problem in using it as printf() argument for format specifiers.
> >
> > What you should be careful though, is that how these strings will 'look' to the
> > person translating it, which, in most of cases, they are not going to look at
> > the code to get a better meaning of the string. So, the sentences to be
> > translated, should make sense by itself.
> >
> >
> > I particularly, don't like much the idea of split strings as you did in the
> > example, exactly because how it might look to the translators, both strings
> > makes the same sentence, but they will show to the translators as completely
> > different strings, and the translator might not be able to find the proper
> > grammatical construction. So, I'd do something like:
> >
> > printf(funny ? _("This string is awesome") : _("This string is boring"))
> >
> >
> > I know that I might sound picky here, but, this is the best way to avoid weird
> > and non-sense string translations.
>
> No, that makes sense, but it kind of sucks, too - writing the same string

> twice everywhere, once for attr & once for dir, is a bit bleah.
>
> Maybe I can restructure it such that it's more easily translatable,
> something like using a prefix, i.e.
>
> %s: block %d is unreadable for inode %lld
>
> -> turns into ->
>
> dir: block %d is unreadable for inode %lld
> - or -
> attr: block %d is unreadable for inode %lld
>
> and then it's not cutting a sentence in half, to interfere with grammar
> from other languages ...
>

Yep, that makes sense. Or, you can play with variables, but, that would make the
code only a huge spaghetti of strings and probably nobody would want to see
things like that.

> -Eric
>
> _______________________________________________
> xfs mailing list
> xfs@oss.sgi.com
> http://oss.sgi.com/mailman/listinfo/xfs

--
Carlos