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

2006-07-27 Thread Behdad Esfahbod
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=26741912forum_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

___
gnome-i18n mailing list
gnome-i18n@gnome.org
http://mail.gnome.org/mailman/listinfo/gnome-i18n


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

2006-07-26 Thread Nguyễn Thái Ngọc Duy
On 7/26/06, Shaun McCance [EMAIL PROTECTED] wrote:
 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.

 So what if we had a way for developers to write tests for each
 string?  We could put those tests in a file in the po directory,
 and intltool could have a tool that would run them.  Translators
 would then be expected to check their translations before they
 commit.  We should also have 'make check' perform the tests on
 all languages.

 The tests could just be shell scripts, and we could keep them
 inside a special po file, like CHECKS.po.  Each string could
 be translated to a shell script.  That shell script would
 be run with the translated string on stdin or in an envar.

 One thing that would be useful is a global string that is
 always run first for each check.  This could be used to set
 some aliases that could be used throughout the checks.  Many
 modules will probably do the same check on a lot of strings.

 I love test frameworks.  Anybody up for it?
Extend http://gettext-lint.sourceforge.net/ ?
___
gnome-i18n mailing list
gnome-i18n@gnome.org
http://mail.gnome.org/mailman/listinfo/gnome-i18n