lkml.org 
[lkml]   [1998]   [Dec]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: Internationalizing Linux
 # as for the program, how about something like this for a start?

Here's version 1.1 :) It allows changing the language file via
-l <language file>

and allows the user to

cat file | thisprog

or

thisprog file

It recognizes the language file as being as before
'kernelsz<white space>language-based-message'

and presumes that the input file will have
%%kernelsz

tags that we will shove our string inplace of.

(sorry, this wasn't necessary to do, but I was bored and its been a good
two weeks since I've done Perl programming[1]: I'm going through
withdrawl :)

#!/bin/perl

use strict;
use Getopt::Std;

my $msgfile='messages.english';
my %msgs;
my %opts;

getopts('l:',\%opts);

$msgfile=$opts{l} if defined $opts{l};

open(MSGS,"<$msgfile") || die $!;

while (<MSGS>) {
$msgs{$1}=$2 if /^([^\s]+)\s+(.+)/;
}
close MSGS;

while (<>) {
s/%%([^\s]+)/$msgs{$1}/g;
print;
}



[1] Do you know how hard it is to go from Unix programming to Windows 95
programming?? Even though I started my career as a win2.0 programmer.


G'day!

-- n i c h o l a s j l e o n
/ elegance through simplicity /
/ good fortune through truth / http://mrnick.binary9.net
/ not all questions have answers / mailto:nicholas@binary9.net



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

\
 
 \ /
  Last update: 2005-03-22 13:45    [W:0.188 / U:0.268 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site