Re: Internationalizing Linux

Frank Sweetser (rasmusin@paramount.ind.wpi.edu)
Sat, 5 Dec 1998 02:21:00 -0500 (EST)


--LEpIuazMva
Content-Type: text/plain; charset=us-ascii
Content-Description: message body text
Content-Transfer-Encoding: 7bit

==> Regarding Re: Internationalizing Linux; alan@lxorguk.ukuu.org.uk (Alan Cox) adds:

alan> Im beginning to agree. Firstly someone says they have the tools to do
alan> this cleanly and automatically as well as intending to do
alan> it. Secondly providing they put numbering in you can look messages
alan> up. But they do need to provide a nice tool for this. If for non
alan> original messages you generate a constant numbering - and that bit is
alan> non trivial then there needs to be a way to do

alan> cat bugreport | toenglish | more

alan> that wil find all the numbered errors (eg format them $ID$ - text)
alan> and replace them with their "original" format.

alan> To my mind the constant numbering and also correct handling of
alan> positional data are the killer issues.

might it not be easier if, instead of keying strictly on numbers, the error
messages could be keyed on strings at least somewhat meaningful to the
author? for example, instead of using %%KRN-SCS-55438 to mean a SCSI
timeout, have %%KRN-SCSI-TIMEOUT? this should help with preventing
conflicting keys, and make things easier for the author by not requiring
him at least to look up all of the messages.

as for the program, how about something like this for a start?

--LEpIuazMva
Content-Type: text/plain
Content-Disposition: inline;
filename="tolang"
Content-Transfer-Encoding: 7bit

#!/usr/bin/perl

# message file format is simple -
# %%kernel-error-string Translated error string.

# allow the user to specify the language file in argv[1],
# default to english.
if (defined($ARGV[1])) {
$msgfile = $ARGV[1];
}else {
$msgfile = "messages.english";
}

open(MSGS, "<$msgfile");
while (<MSGS>) {
chop;
($key, $msg) = split('\s+', $_, 2);
$msgs{$key} = $msg;
}

while (<STDIN>) {
@line = split;
for (i ; $i < $#line ; $i++) {
if ($line[$i] =~ /^%%/) {
$line[$i] = $msgs{$line[$i]};
}
}
print STDOUT join (' ', @line), "\n";
}

--LEpIuazMva
Content-Type: text/plain; charset=us-ascii
Content-Description: .signature
Content-Transfer-Encoding: 7bit

-- 
Frank Sweetser rasmusin at wpi.edu fsweetser at blee.net  | PGP key available
paramount.ind.wpi.edu RedHat 5.2 kernel 2.1.129      i586 | at public servers
Be warned that typing killall name may not have the desired
effect on non-Linux systems, especially when done by a privileged user.
(From the killall manual page)

--LEpIuazMva--

- 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/