[LON-CAPA-dev] Internationalization

Minoru Akiyama lon-capa-dev@mail.lon-capa.org
Wed, 24 Sep 2003 07:42:08 +0900


Hi Gerd,

Thanks!
Give me ID and Password.
I'll try it.

Minoru
----- Original Message ----- 
From: "Gerd Kortemeyer" <korte@lite.msu.edu>
To: <lon-capa-dev@mail.lon-capa.org>
Cc: "Gerd Kortemeyer" <korte@lite.msu.edu>
Sent: Wednesday, September 24, 2003 12:25 AM
Subject: Re: [LON-CAPA-dev] Internationalization


> Minoru,
>
> Sorry, the language code and the filename is actually "ja", not
"jp" ...
>
> I have installed the sample translator file on
>
>   http://picard.lite.msu.edu/
>
> - if your browser has "ja" as primary language, you should be
able to
> see the translation file in action.
>
> Please let me know if the result makes sense. I might have
destroyed
> the file in transfer, so another test would be for you to
directly
> submit in our CVS.
>
> - Gerd.
>
> On Tuesday, September 23, 2003, at 02:53  AM, Minoru Akiyama
wrote:
>
> > Hi Gerd,
> >
> > I fogot to edit these lines.
> > ----------------------------------------
> > %Lexicon=('_AUTO' => 1,
> >
> > 'char_encoding'=> 'ISO-8859-1',
> > 'language_code'=> 'de',
> > ----------------------------------------
> >   ||
> >   V
> > ----------------------------------------
> > %Lexicon=('_AUTO' => 1,
> >
> > 'char_encoding'=> 'ISO-10646-?',
> > 'language_code'=> 'jp',
> > ----------------------------------------
> > I wonder how 'Char encoding' should be described.
> >
> > Minoru
> > ----- Original Message -----
> > From: "Minoru Akiyama" <akiyama@i-Learning.ne.jp>
> > To: <lon-capa-dev@mail.lon-capa.org>
> > Cc: "Gerd Kortemeyer" <korte@lite.msu.edu>
> > Sent: Tuesday, September 23, 2003 2:34 PM
> > Subject: Re: [LON-CAPA-dev] Internationalization
> >
> >
> >> Hi Gerd,
> >>
> >> here's sample jp.pm encoded in UTF-8.
> >> Please test it if it will work or not.
> >>
> >> Minoru
> >> ----- Original Message -----
> >> From: "Gerd Kortemeyer" <korte@lite.msu.edu>
> >> To: <lon-capa-dev@mail.lon-capa.org>
> >> Cc: "Gerd Kortemeyer" <korte@lite.msu.edu>
> >> Sent: Monday, September 22, 2003 4:34 AM
> >> Subject: Re: [LON-CAPA-dev] Internationalization
> >>
> >>
> >>> Minoru,
> >>>
> >>> Yes, the sample file is in ISO, but we have also
successfully
> >> worked
> >>> with UTF-8. If you could send me a small Japanese sample
file
> >> in UTF-9,
> >>> I can install it here, and we can test the setup.
> >>>
> >>> Thanks!
> >>>
> >>> - Gerd.
> >>>
> >>> On Sunday, September 21, 2003, at 01:18  AM, Minoru Akiyama
> >> wrote:
> >>>
> >>>> Hi, Gerd,
> >>>>
> >>>> Sample file is not  encoded in UTF-8.
> >>>> I'd like to develop Japanese lexicon, but I'm afraid it
> > won't
> >>>> work in the case of Japanese(double byte code).
> >>>>
> >>>> i-Learning / EMIT Japan
> >>>> Minoru Akiyama
> >>>>
> >>>> ----- Original Message -----
> >>>> From: "Gerd Kortemeyer" <korte@lite.msu.edu>
> >>>> To: <lon-capa-dev@mail.lon-capa.org>; "Leonardo Mendes"
> >>>> <lmendes@decom.fee.unicamp.br>; "Ricardo Luis Kulzer"
> >>>> <ricardol@decom.fee.unicamp.br>; "Horst Bögel"
> >>>> <boegel@chemie.uni-halle.de>; "Shoji Kajita"
> >>>> <kajita@itc.nagoya-u.ac.jp>; "Timothy Takemoto"
> >>>> <tim@yamaguchi-u.ac.jp>; "Michael Thoennessen"
> >>>> <thoennessen@nscl.msu.edu>
> >>>> Cc: "Gerd Kortemeyer" <korte@lite.msu.edu>; "Ed Kashy"
> >>>> <kashy@nscl.msu.edu>; <cspeier@msu.edu>; "Deborah Kashy"
> >>>> <kashyd@pilot.msu.edu>; "Wolfgang Bauer"
> > <bauer@pa.msu.edu>;
> >>>> "Helen Keefe" <helen@lon-capa.org>
> >>>> Sent: Thursday, September 18, 2003 9:28 PM
> >>>> Subject: [LON-CAPA-dev] Internationalization
> >>>>
> >>>>
> >>>>> Hi,
> >>>>>
> >>>>> As you might have seen from a number of CVS commits in
the
> >> last
> >>>> two
> >>>>> days, we have started to internationalize LON-CAPA, so
> > that
> >> it
> >>>> can run
> >>>>> in different languages. We have also started localizing
> > for
> >>>> German and
> >>>>> Portuguese. Internalizing is the bulk of the work right
> > now,
> >>>> localizing
> >>>>> can be done anytime, and involves no programming.
> >>>>>
> >>>>> The internationalization process involves putting a
> > wrapper
> >>>> around
> >>>>> on-screen user messages and menus and turning them into
> >> keys,
> >>>> which the
> >>>>> Maketext library translates into the desired language
> > output
> >>>> using a
> >>>>> look-up table ("lexicon").
> >>>>>
> >>>>> As keys we are currently using the plain English
messages,
> >> and
> >>>> Maketext
> >>>>> is configured to replace the message by its own key if no
> >>>> translation
> >>>>> is found. This makes it easy to phase in the
> >>>> internationalization
> >>>>> without disturbing the screen output.
> >>>>>
> >>>>> Internationalization is tedious, and the more we can
> >> distribute
> >>>> the
> >>>>> work, the better.
> >>>>>
> >>>>> *** New software should be written in internationalized
> >> format
> >>>> from now
> >>>>> on.
> >>>>>
> >>>>> *** If you feel like doing something brainless but
> >> productive,
> >>>> grab a
> >>>>> module and internationalize it.
> >>>>>
> >>>>> *** As you come across some code during normal
> > programming,
> >>>> just insert
> >>>>> the wrappers.
> >>>>>
> >>>>> *** HERE'S WHAT TO DO:
> >>>>>
> >>>>> Into the "use" section of a module, we need to insert
> >>>>>
> >>>>>   use Apache::lonlocal;
> >>>>>
> >>>>> - note that there are NO BRACKETS, we *want* to pollute
> > our
> >>>> namespace.
> >>>>>
> >>>>> Inside might be something like this
> >>>>>
> >>>>> sub message {
> >>>>>     my $status=shift;
> >>>>>     my $message='Status unknown';
> >>>>>     if ($status eq 'WON') {
> >>>>>        $message='You have won.';
> >>>>>     } elsif ($status eq 'LOST') {
> >>>>>        $message='You are a total looser.';
> >>>>>     }
> >>>>>     return $message;
> >>>>> }
> >>>>> ...
> >>>>> $r->print('<h3>Gamble your Homework Points</h3>');
> >>>>> ...
> >>>>> $r->print(<<ENDMSG);
> >>>>> <font size="1">Rules:</font>
> >>>>> <font size="0">No purchase necessary. Illegal where not
> >>>> allowed.</font>
> >>>>> ENDMSG
> >>>>>
> >>>>> We have to now wrap the subroutine &mt() ("maketext")
> > around
> >>>> our
> >>>>> messages, but not around markup, etc. We also want
minimal
> >>>> disturbance.
> >>>>> The first two examples are easy:
> >>>>>
> >>>>> sub message {
> >>>>>     my $status=shift;
> >>>>>     my $message='Status unknown';
> >>>>>     if ($status eq 'WON') {
> >>>>>        $message='You have won.';
> >>>>>     } elsif ($status eq 'LOST') {
> >>>>>        $message='You are a total looser.';
> >>>>>     }
> >>>>>     return &mt($message);
> >>>>> }
> >>>>> ...
> >>>>> $r->print('<h3>'.&mt('Gamble your Homework
> >> Points').'</h3>');
> >>>>>
> >>>>> The last one is a bummer, since you cannot call
> > subroutines
> >>>> inside of
> >>>>> (<<MARKER). I have written a little subroutine to
generate
> > a
> >>>> translated
> >>>>> hash for that purpose:
> >>>>>
> >>>>> my %lt=&Apache::lonlocal::texthash('header' => 'Rules',
> >>>> 'disclaimer' =>
> >>>>> 'No purchase necessary. Illegal where not allowed.');
> >>>>> $r->print(<<ENDMSG);
> >>>>> <font size="1">$lt{'header'}:</font>
> >>>>> <font size="0">$lt{'disclaimer'}</font>
> >>>>> ENDMSG
> >>>>>
> >>>>> As a programmer, your job is done here. If everything
> >> worked,
> >>>> you
> >>>>> should see no changes on the screen.
> >>>>>
> >>>>> As a translator, you need to provide the lexicon for the
> >> keys,
> >>>> which in
> >>>>> this case is the plain text message. The lexicons sit in
> >>>>> loncom/localize/localize, with the language code as
> >> filename,
> >>>> for
> >>>>> example de.pm for the German translation. The file then
> >> simply
> >>>> looks
> >>>>> like this:
> >>>>>
> >>>>>     'You have won.'
> >>>>> => 'Sie haben gewonnen.',
> >>>>>
> >>>>>     'You are a total looser.'
> >>>>> => 'Sie sind der totale Verlierer.',
> >>>>>
> >>>>>     'Rules'
> >>>>> => 'Regeln',
> >>>>>
> >>>>>     'No purchase necessary. Illegal where not allowed.'
> >>>>> => 'Es ist erlaubt, einfach zu verlieren, und das ist
Ihre
> >>>> Schuld.'
> >>>>>
> >>>>> The German translation lexicon is in pretty okay shape,
> > but
> >> not
> >>>>> complete yet. Portuguese currently only covers the login
> >>>> screen.
> >>>>> Russian is purely experimental. Looks like UTF-8 is the
> > way
> >> to
> >>>> encode
> >>>>> this, at least for latin/greek-based languages, but we
> > still
> >>>> have to
> >>>>> learn a lot.
> >>>>>
> >>>>> This is a relatively easy programming task, and any help
> > is
> >>>> appreciated.
> >>>>>
> >>>>> Maketext can do a whole lot more, see
> >>>>>
> >>>>>
> >>>>
> >>
> >
http://search.cpan.org/dist/Locale-Maketext/lib/Locale/Maketext.pod
> >>>>>
> >>>>> but for most purposes, we do not have to mess with that.
> >>>>>
> >>>>> - Gerd.
> >>>>>
> >>>>>
> >>>>>
> >>>>> _______________________________________________
> >>>>> LON-CAPA-dev mailing list
> >>>>> LON-CAPA-dev@mail.lon-capa.org
> >>>>> http://mail.lon-capa.org/mailman/listinfo/lon-capa-dev
> >>>>>
> >>>>
> >>>>
> >>>> _______________________________________________
> >>>> LON-CAPA-dev mailing list
> >>>> LON-CAPA-dev@mail.lon-capa.org
> >>>> http://mail.lon-capa.org/mailman/listinfo/lon-capa-dev
> >>>
> >>> _______________________________________________
> >>> LON-CAPA-dev mailing list
> >>> LON-CAPA-dev@mail.lon-capa.org
> >>> http://mail.lon-capa.org/mailman/listinfo/lon-capa-dev
> >>>
> >>
> >
> >
> > _______________________________________________
> > LON-CAPA-dev mailing list
> > LON-CAPA-dev@mail.lon-capa.org
> > http://mail.lon-capa.org/mailman/listinfo/lon-capa-dev
>
> _______________________________________________
> LON-CAPA-dev mailing list
> LON-CAPA-dev@mail.lon-capa.org
> http://mail.lon-capa.org/mailman/listinfo/lon-capa-dev
>