Re: Checking Translations (was: default text direction; mistranslations)



On Wed, 2006-07-26 at 12:07 -0400, Shaun McCance wrote:
> On Wed, 2006-07-26 at 10:34 -0400, Matthias Clasen wrote:
> > gtk20.pot contains this comment, which explains how
> > to translate default:LTR.
> > 
> > #. Translate to default:RTL if you want your widgets
> > #. * to be RTL, otherwise translate to default:LTR.
> > #. * Do *not* translate it to "predefinito:LTR", if it
> > #. * it isn't default:LTR or default:RTL it will not work
> > #.
> > #: gtk/gtkmain.c:500
> > msgid "default:LTR"
> > 
> > but, running this little command
> > 
> > grep -A 1 "msgid \"default:LTR\"" *.po | grep msgstr | grep -v
> > "default:LTR" | grep -v "default:RTL"
> > 
> > yields a number of languages which have mistranslated that string:
> 
> Something I've been thinking about for a while is a system for
> checking translated strings.  Strings often have to conform to
> some syntax, whether it's selecting values from an enumeration,
> making a format string, writing well-formed XML, or whatever
> else.  In many of these cases, having incorrect translations
> can cause the program not to function correctly, or can break
> the build.

I raised this issue a few months ago.  I still suggest adding such tests
to the commit hook such that no broken PO file can be committed.  We
already msgfmt on commits; just need to add more elaborate checks.  With
the CVS migration, each project has its own commit hook file and can add
project-specific (like gtk+'s default:LTR) checks.

The original check I wrote was to detect broken glib context format
translation:

  http://mail.gnome.org/archives/gnome-i18n/2006-March/msg00246.html

In that, I go a bit out of my way to identify incorrect translations.
But now gettext 0.15 was released a few days ago

http://sourceforge.net/mailarchive/forum.php?thread_id=26741912&forum_id=7939

This includes various new features that Danilo and I suggested (and
builds better on win32 platforms thanks to our own Hans and Tor!).  If
we require gettext 0.15 after the SVN conversion and install 0.15 on our
servers, we can install a set of default checks and let projects extend
that to their desire.

New features of particular interest in GNOME in gettext 0.15 are:


 * xgettext's --keyword option now allows to specify an extracted
comment on the command line, rather than in program's source code. Now
we can automatically add a comment to all Q() strings (those with
context.)

 * msggrep has a new option -X/--extracted-comment that allows to search
for a pattern in the extracted comments. With this, you can match the
abovementioned comment with msggrep and double-check that the msgstr
doesn't have the '|' in it.

 * msggrep has a new option -v/--invert-match that acts like grep's -v
option.  With this you can write:

  msggrep -K -F -e 'default:LTR' |
  msggrep -T -E -v -e '^default:(LTR|RTL)$'

to essentially do what Matthias did, but with more accuracy.


Suggestions?

-- 
behdad
http://behdad.org/

"Commandment Three says Do Not Kill, Amendment Two says Blood Will Spill"
        -- Dan Bern, "New American Language"



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]