On Fri, 17 Nov 2006 04:32:10 +0100 Roland Mainz wrote:
> Glenn Fowler wrote:
> >
> > getopts --man lists getopts details
> >
> > note that you can get the usage string for any ast command/script by (ksh
> > here)
> > ksh '--??usage' 2>&1 | fmt -o
> > where fmt is the ast fmt and -o formats usage strings
> > without fmt -o the usage string will most likely contain little or no
> > newlines
> >
> > use $'...' for the usage string
> > this will properly handle the \b...\b etc. modifiers
> How can I get the manual page then localised ? The idea behind using
> $"..." was to get the manual page put into the output of "ksh -D" and
> therefore get a translation of the localisation team for free... :-)
I posted an example using ast "nmake msgcat" to generate the message
catalog for C and script optget/getopts usage strings and diagnostic
and $"..." strings
the example produces a single gencat(1) compatible foo.msg file
for src/scripts managed by a makefile
nmake -n can be used to show the steps for other build systems
I used the nmake example because it "just works" on all architectures
what I am not familiar with is native system processing and installation
of the C and foo bar etc locale versions of the original gencat compatible
message file
> [snip]
> > [--catalog?foo] in the usage string provides an alternate catalog name
> > (besides the script base name provided by ksh at runtime)
> Will that only affect the manual page or the whole script ? What about
> the idea to implement something like ".sh.msgcat.name" to make this
> "dymamic" ?
in the bigger picture ast addresses a.out's as well as scripts
in this picture mechanisms available to a.out's should have similar
mechanisms in scripts and vice-versa
in ast a few names are used to locate the current process catalog
(1) the process (extendable to thread) global error_info.id
(2) the process (extendable to thread) global error_info.catalog
(usually NULL but initialized by the first optget(3), and thus
ksh93 getopts, from the usage [--catalog?id])
these affect all l10n strings because they are all processed
by one ast interface
mini faq
why are the optget/getopts usage strings split rather than
treated as one $"..." string?
to aid translation
many usage strings have substrings in common
by splitting these up into smaller string segments
(on the natural optget [...] boundaries) common substrings
can be shared between components within a (translation) locale
how is this done in ast?
the msgcc script scrapes l10n strings from C and ksh src
via a modified cpp for C and ksh -D for scripts
--man strings are generated by running the a.out/script
with the --keys option (formally '--??keys')
(this is the "cc -c" phase of l10n string scraping)
then the strings are combined and formatted for gencat(1)
(or whatever message catalog input format) using msgcc
again (this is the "ld" phase of l10n string combination)
hope this helps
it will definately need tweaking to match native l10n
processing/installation -- but its all driven by scripts
that easily filter data to match native requirements
-- Glenn Fowler -- AT&T Research, Florham Park NJ --