[MPlayer-dev-eng] New translation system

Michael Niedermayer michaelni at gmx.at
Thu Nov 30 19:01:21 CET 2006


Hi

On Thu, Nov 30, 2006 at 01:00:01PM -0500, Rich Felker wrote:
> On Thu, Nov 30, 2006 at 05:50:10PM +0100, Michael Niedermayer wrote:
> > Hi
> > 
> > On Thu, Nov 30, 2006 at 02:33:25PM +0200, Uoti Urpala wrote:
> > [...]
> > > 
> > > > > 5 Outdated, broken or intentionally harmful translation files should not
> > > > >   cause crashes or security holes.
> > > > 
> > > > Unreasonable requirement.
> > > 
> > > It is doable without too much trouble and a useful property to have, so
> > > in no way an unreasonable requirement.
> > 
> > checking all strings for validity is not terribly difficult, just search for
> > all % and check that number order and type match between all corresponding
> > pairs from 2 translation files
> > the only thing required is the ability to enumerate all strings ...
> 
> Apparently you haven't studied the subtleties of printf. 

no ive not


> There are the
> XSI extended format strings (%1$d etc.) as well as issues like
> specifying the width and/or precision as arguments (%*.*s). Anyway the
> greater problem is that this is a _runtime_ issue, not a compiletime
> issue.

and where is the problem with checking all strings during init at runtime?


> 
> > > > Using strings as keys for looking up strings is idiotic and plain
> > > > wrong, both semantically and in terms of implementation sanity.
> > > > Indices are numbers not strings. We code in C not PHP.
> > > 
> > > Completely baseless drivel.
> > 
> > i am too very strongly against string based "indices"
> > 
> > 
> > one simple implementation would be something like:
> [...]
> 
> What you described is just the obvious implementation of catgets,
> except that the translations are in a mmapped binary file containing
> those data structures instead of in the mplayer binary.

hmm i dunno catgets except 5min RTFM, but it apparently lacks a requirement
for using consecutive numbers so its more complex (=needs hashtab or binary
search) it also if non consecutive numbers are used doesnt seem to support 
enumerating strings and iam unsure how to actually use it, TFM seems to
suggest that every translation file either needs hardcoded numbers or needs
to have a entry for every translatable string, both obviously are problematic
...

also ive a few questions about catgets
can it support sane fallbacks? i mean if theres no de_at then de would be
used and if that isnt available too then en?
do all systems support catgets? cygwin? mingw?
and what for example about something like
printing the translated message with the untranslated in () when --debug or
--bugreport is used? with my suggestion it would be trivial to change
the strings from C, with catgets this doesnt seem possible, a macro and
a complete recompile would be needed ...

and most important, why use catgets if plain ansi C can do the job?
we also dont use a database or xml if we dont have to?


[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

In the past you could go to a library and read, borrow or copy any book
Today you'd get arrested for mere telling someone where the library is



More information about the MPlayer-dev-eng mailing list