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 
Switch to threaded view of this topic Create a new topic Submit Reply
Internationalization [message #34969] Wed, 07 May 2003 02:43 Go to next message
Miguel ?ngel C?rdoba is currently offline  Miguel ?ngel C?rdoba
Messages: 7
Registered: February 2003
Junior Member
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

--
---------------------------------------------------------
Miguel Angel Cordoba mailto:cordoba@grahi.upc.es
http://campus.uab.es/~2034008

Grup de Recerca Aplicada en Hidrometeorologia (GRAHi-UPC)
http://www.grahi.upc.es
---------------------------------------------------------
Re: Internationalization [message #35021 is a reply to message #34969] Mon, 12 May 2003 02:08 Go to previous message
Miguel ?ngel C?rdoba is currently offline  Miguel ?ngel C?rdoba
Messages: 7
Registered: February 2003
Junior Member
Thank you Reimar,
I found a method based on the IDLffLanguageCat class and then
routines MSG_CAT_COMPILE, MSG_CAT_OPEN, MSG_CAT_CLOSE
and LOCALE_GET.

Regards.

Reimar Bauer wrote:

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

--
---------------------------------------------------------
Miguel Angel Cordoba mailto:cordoba@grahi.upc.es
TEL. 93 4017371
http://campus.uab.es/~2034008

Grup de Recerca Aplicada en Hidrometeorologia (GRAHi-UPC)
http://www.grahi.upc.es
---------------------------------------------------------
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
  Switch to threaded view of this topic Create a new topic Submit Reply
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: Wed Oct 08 19:31:20 PDT 2025

Total time taken to generate the page: 0.00394 seconds