For purpose of localisation with gettext, we need a way
to mark strings that may be replaceable.

The C convention is:

        _("morning")

The xgettext program can be used to create a catalogue of
such strings, which can then be copied and customised for
a particular language.

There are two way to use the message cattledogs:

(a) translate at run time
(b) translate at compile time

Ok, now the C convention isn't suited to Felix:

print "Hello"; endl; // original
print _("Hello"); endl; // type error!

I'm thinking of this:

print __"Hello"; endl;

or perhaps:

print _i18n"Hello"; endl;

or something similar. To make this work I had to use

xgettext --language=Perl --keyword=__ filename

So it will NOT work for triple quoted strings.
The Perl hackery in xgettext may defeat some cases.

There's also a problem with format codes, as I understand it
in C you can do:

        printf(_("%s likes %s"),subject, object);

and xgettext will ACTUALLY catalog

        "%1$s likes %2$s"

so that a translation is order independent, eg you could use

        "%2$s is liked by %1$s"

as a translation, and GNU libc printf will respect this.

Felix uses vsnprintf to handle C format codes -- however
it also statically type checks the arguments and requires
a literal format string:

        print$ f"%d likes %d"$ 1,2;

so any replacement would be compile time only.

The idea at the moment is that if you have xgettext installed,
then 'flx' will produce a filename.pot file automatically.

Similarly at run time, message catalog will be looked up
automatically, in a manner similar to C .. and in fact by
literally generated gettext compliant C++.

However an option would be to localise at compile time.

An alternative to using xgettext would be to generate the *.pot
file inside the flxg compiler .. or even use a completely
different system.

Any comments appreciated. Hopefully RF can test this when it
works by making some Italian versions of some programs :)

Localising the compiler itself is another issue
(I shudder to think how we'd cope with the rate of
change of diagnostic messages).



-- 
John Skaller <skaller at users dot sf dot net>
Felix, successor to C++: http://felix.sf.net

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Felix-language mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/felix-language

Reply via email to