Re: Kernel messages...

Riley Williams (rhw@bigfoot.com)
Fri, 11 Dec 1998 13:53:22 +0000 (GMT)


Hi Bruce.

On Thu, 10 Dec 1998, Bruce Korb wrote:

>> identification. A script could be provided to convert messages
>> back into English for this list, the maintainer, etc.

> Translations of a formatted string is a very hard problem. You
> really cannot tell which parts came from the format string and
> which were formatted values. One of the reasons I advocate a binary
> log *in addition to* the traditional text one.

That's one reason why I see the adoptation of a series of text files
of messages, one per language, as important - the conversion routine
then becomes trivial enough to do in a bash script...

Q> #!/bin/bash
Q> if [ $# -lt 4 ]; then
Q> echo "Usage: `basename $0` oldlang newlang key message" >&2
Q> exit 255
Q> fi
Q> function ml() { tr -s ' ' '\n' }
Q> function sl() { tr '\n' ' ' }
Q> export OLDLANG=$1
Q> export NEWLANG=$2
Q> export KEY=$3
Q> shift
Q> shift
Q> shift
Q> export OLDMSG="$*"
Q> export OLDFMT="`grep ^$KEY < $OLDLANG | head -1`"
Q> export OLDSIZE=`echo -n $OLDFMT | wc -w`
Q> declare -i N=1
Q> export FIELDS=''
Q> while [ $N -le $OLDSIZE ]; do
Q> FMT=`echo "$OLDFMT" | cut -d ' ' -f $N`
Q> WORD=`echo "$OLDMSG" | cut -d ' ' -f $N`
Q> if [ "`echo \"$FMT\" | cut -b 1`" = "%" ]; then
Q> ID=`echo "$FMT" | cut -b 2-`
Q> export FIELDS="$FIELDS $ID:$WORD"
Q> fi
Q> done
Q> export FIELDS="`echo $FIELDS | tr -s ' ' '\n' | sort | tr '\n' ' '`"

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/