Chapter 13. Examples of I18N
106
display Japanese characters.
At first,
user ja conf
detects the environment. If it can display Japanese characters, go ahead.
If not, try to establish a new environment and invoke itself in it. If detection is failed, display
Japanese characters and ask the user whether he/she can read it.
13.3.3 Implementation
user ja conf
is a perl script. Here shows a function which check whether Japanese native
characters can be displayed or not and try to establish an environment where native characters
can be displayed, if not.
sub isNC($$)
{
my ($KANJI, $TTY, $TERM, $DISPLAY, $WHICH);
$TTY = `/usr/bin/tty`;
$TERM = $ENV{TERM};
$DISPLAY = $ENV{DISPLAY};
$WHICH = '/usr/bin/which';
$THIS = $_[0];
$OPT = $_[1];
if ($TERM eq 'kon' || $TERM eq 'kterm') {
$KANJI=1;
} elsif ($DISPLAY ne '' && system("$WHICH kterm >/dev/null")==0) {
exec("kterm  km euc  e $THIS $OPT");
} elsif ($DISPLAY ne '' && system("$WHICH krxvt >/dev/null")==0) {
exec("krxvt  km euc  e $THIS $OPT");
} else {
print STDERR &sourceset2displayset(
"Japanese sentence in Japanese characters 'Can you read this sentence?'\n");
print STDERR
"Japanese sentence in ASCII characters 'Can you read the above sentence written in Kanji? [y/N] ";
$a = <>;
if ($a =~ /y|Y/) {
$KANJI=1;
} elsif ($TTY =~ m#/dev/tty[0 9]+#) {
print STDERR
"Japanese sentence in ASCII characters 'Shall I invoke \'KON\'? [Y/n] ";
$a = <>;
exec("kon  e $THIS $OPT") if ($a !~ /n|N/);
$KANJI=0;






footer




 

 

 

 

 Home | About Us | Network | Services | Support | FAQ | Control Panel | Order Online | Sitemap | Contact

indiana web hosting

 

Our partners: PHP: Hypertext Preprocessor Best Web Hosting Java Web Hosting Inexpensive Web Hosting  Jsp Web Hosting

Cheapest Web Hosting Jsp Hosting Cheap Hosting

Visionwebhosting.net Business web hosting division of Web Design Plus. All rights reserved