comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Internationalization
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: Internationalization [message #35050 is a reply to message #34969] Thu, 08 May 2003 13:16 Go to previous message
R.Bauer is currently offline  R.Bauer
Messages: 1424
Registered: November 1998
Senior Member
Miguel Angel Cordoba wrote:

> Hi,
> I want to internationalize my aplications but I don't know how
> to do it. I have the translated files of the messages of the application
> but I don't know if IDL can do a precompiled option that change
> the messages in the code in the selected language. Another solution
> is to read the file of messages and store it in and string array, but I
> think
> this solution is not a good idea.
>
>
> Thanx
>

I believe the internationalition isn't yet supported.
I would suggest to do something like this.

you need always txt files named to the belonging routine
e.g. my_prog_lang_en.txt my_prog_lang_de.txt


----routine name lang_message.pro -------

FUNCTION lang_message_fetch_file,file
txt=MAKE_ARRAY(/STRING,fileline(file))
OPENR,lun,/GET_LUN,file
READF,lun,txt
FREE_LUN,lun
RETURN,txt
END
FUNCTION lang_message,_extra=e
IF is_structure(e) THEN BEGIN
l_tags=get_tagname(e,'lang*')
IF is_structure(l_tags) EQ 1 THEN BEGIN
language=(TAG_NAMES(l_tags))[0]
HELP,call=call
routine=(strsplit(call[1],' ',/extract))[0]
msg_file=STRLOWCASE(routine+'_'+language+'.txt')
comments=lang_message_fetch_file(msg_file)
ENDIF ELSE BEGIN
HELP,call=call
routine=(strsplit(call[1],' ',/extract))[0]
msg_file=STRLOWCASE(routine+'_lang_de.txt')
comments=lang_message_fetch_file(msg_file)
ENDELSE
ENDIF ELSE BEGIN
HELP,call=call
routine=(strsplit(call[1],' ',/extract))[0]
msg_file=STRLOWCASE(routine+'_lang_de.txt')
comments=lang_message_fetch_file(msg_file)
ENDELSE
RETURN,comments
END


------

Example script:
pro my_prog,_extra=e
message,lang_message(_extra=e),/info
end

------------

called:
my_prog,/lang_de>
IDL> my_prog,/lang_de
% MY_PROG: Beispiel fᅵr einen Test.

or

my_prog,/lang_en
IDL> my_prog,/lang_en
% MY_PROG: Example


the routine get_tagname you can get from our library:

http://www.fz-juelich.de/icg/icg1/idl_icglib/idl_source/idl_ html/dbase/download/get_tagname.tar.gz
or as idl 5.x bninary
http://www.fz-juelich.de/icg/icg1/idl_icglib/idl_source/idl_ html/dbase/download/get_tagname.sav

For further routines and licensing please have a look at
http://www.fz-juelich.de/icg/icg-i/idl_icglib/idl_lib_intro. html

best regards

Reimar

--
Forschungszentrum Juelich
email: R.Bauer@fz-juelich.de
http://www.fz-juelich.de/icg/icg-i/
============================================================ ======
a IDL library at ForschungsZentrum Juelich
http://www.fz-juelich.de/icg/icg-i/idl_icglib/idl_lib_intro. html
[Message index]
 
Read Message
Read Message
Read Message
Previous Topic: problem with hidden lines in SURFACE in IDL version 5.5 and 5.6
Next Topic: Re: widget_control, <slider_id>, maximum=num ???

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Sun Nov 30 16:55:23 PST 2025

Total time taken to generate the page: 0.00204 seconds