On Thu, 2006-12-21 at 16:19 +0000, Ghee Teo wrote:
> Laszlo (Laca) Peter wrote:
> > Shouldn't this be localised?
> >
> Yes. Except that I don't know how what is the G11N framework is for
> script like this.
> Damien has kindly pointed me to your install scripts
> http://reserv.ireland/viewvc/viewvc.cgi/install/
>
> install-jds and install-jds.po
>
> But I still not sure what is the tool and framework there is to do
> G11N for script,
> anyone from the G11N has recommentation or defined tools as such?
As Alan said, you can use /usr/bin/gettext. It's pretty simple,
here's the "magic" part of the install-jds script:
TEXTDOMAIN=install-jds
l10n_print () {
l10n_msg=`TEXTDOMAINDIR="$MYDIR"/.install gettext -d "$TEXTDOMAIN" "$1"`
shift
printf "$l10n_msg\n" "$...@}"
}
Your TEXTDOMAINDIR will be different, that's the directory you insatll
the .mo file to. You will probably need set it to "$DATADIR/locale".
Then you simply localize any messages by calling l10n_print, e.g.:
title=`l10n_print "Print Manager"`
message=`l10n_print "Enter root password"`
gksu -g -t "$title" -m "$message" /usr/sbin/printmgr
The .po file is a template that lists all messages and empty
translations. You will then need to contact the l10n team
and ask them to provide translations.
The .po file looks something like this:
# Message catalog for Ghee's printmgr wrapper script
#: wrapper-script:15
msgid "Print Manager"
msgstr ""
#: wrapper-script:16
msgid "Enter root password"
msgstr ""
> Alternatively, the lazy man approach to do, change the line to
> gksu -g /usr/sbin/printmgr
Well, it's up to you. But if you do the custom message thing, then
you need to make sure it's i18n'd otherwise you'll have to do it when
they start filing bugs.
> or create a C program that simply encapsulate the I18N works into it
> which is
> really overkill.
It most certainly is (:
Laca
> -Ghee
> > Laca
> >
> > On Tue, 2006-12-19 at 14:09 +0000, Ghee Teo wrote:
> >
> >> +
> >> +gksu -g -t "Print Manager" -m "Enter root password:" /usr/sbin/printmgr
> >>
> >
> >
> >
>