envsubst, gettext.sh

L18L has very kindly internationalized a script in my shutdownconfig GUI shutdown system, /usr/sbin/shutdownconfig. L18L posted to this Forum thread:
http://murga-linux.com/puppy/viewtopic.php?t=71911

The method that L18L has used requires two other executables from the 'gettext' package, 'envsubst' and 'gettext.sh'. Up until now, Woof-built puppies have those in the 'devx' only.

I have modified the 'gettext' template in Woof so that now those two (as well as the 'gettext' executable) are in the main SFS. This will apply to all puppies built from the next upload of Woof.

Here is a nice tutorial that explains how a Bash/Ash script can be internationalized:
http://www.gnu.org/s/hello/manual/gettext/Preparing-Shell-Scripts.html


Posted on 26 Sep 2011, 15:33


Comments:

Posted on 26 Sep 2011, 15:47 by mistfire
More GUI Frontends
Hi Barry, it is nice to see that the shutdown dialog was now in GUI. I hope that the start-up has a GUI also for more user-friendly. By the way, since you have a script in automating the kernel compilation, I suggest that its now time to add a GUI front-end on it to make the kernel compiling more easily just like what you did on bones and woof. Good luck and more power.


Posted on 27 Sep 2011, 4:33 by L18L
preparing shell scripts
I have been using gettext for a while now without knowledge of above link.
This is explaining things very well, also the triple backslash sequence.

Thanks for the very useful link above.


Posted on 28 Sep 2011, 6:32 by technosaurus
reinventing the wheel ... again
I found this method to be much faster
{	#localization block

[ $myLANG ] || myLANG=${LANGUAGE%% *}
[ $myLANG ] || myLANG=${LANG%_*}
case $myLANG in
de*). /usr/share/locale/de/LC_MESSAGES/jwm;;
es*). /usr/share/locale/es/LC_MESSAGES/jwm;;
fr*). /usr/share/locale/fr/LC_MESSAGES/jwm;;
ru*). /usr/share/locale/ru/LC_MESSAGES/jwm;;
esac
}

each locale just contains a translated list of variables VAR="translated string" ...
we don't need one for english, just this
${VAR:-English translation}

it is all plain text and easy for people to contribute translations


Posted on 28 Sep 2011, 8:28 by BarryK
Re reinventing wheel
I am going to come back later and take another look at what you suggest. Can't right now, but I like the look of what you have done. I don't like the gettext mechanism, locale handling in general in Linux is very slow.

Actually, I probably shouldn't get started on what I think is fundamentally wrong/bad/inefficient with Unix/Linux. The entire file ownership/permissions mechanism for example...