home *** CD-ROM | disk | FTP | other *** search
/ CD-ROM Magazin 1995 November / CD_11_95.BIN / share95 / tools / winbatch / willang.wb_ < prev    next >
Text File  |  1994-09-10  |  2KB  |  82 lines

  1. ;Language change applet for Winbatch
  2. tab=num2char(9)
  3. ;Change to WinBatch home dir to find WWDLANG.* files
  4. DirChange(DirHome())
  5.  
  6. MyDialogFormat=`WWWDLGED,5.0`
  7.  
  8. MyDialogCaption=`WIL Language Selector`
  9. MyDialogX=60
  10. MyDialogY=79
  11. MyDialogWidth=289
  12. MyDialogHeight=146
  13. MyDialogNumControls=6
  14.  
  15. MyDialog01=`2,66,278,56,ITEMBOX,Choice,DEFAULT`
  16. MyDialog02=`20,22,270,DEFAULT,VARYTEXT,current,""`
  17. MyDialog03=`54,126,64,DEFAULT,PUSHBUTTON,DEFAULT,"&Ok",1`
  18. MyDialog04=`148,126,64,DEFAULT,PUSHBUTTON,DEFAULT,"&Cancel",0`
  19. MyDialog05=`10,6,114,DEFAULT,STATICTEXT,DEFAULT,"Current Language is:"`
  20. MyDialog06=`10,46,272,DEFAULT,STATICTEXT,DEFAULT,"Select desired language"`
  21.  
  22.  
  23. ;Determine current language
  24.  
  25. Current=inireadpvt("Main","Language","NONE","WWWBATCH.INI")
  26. if Current=="NONE"
  27.    current="English"
  28. else
  29.    if strlen(Current)!=3 then current="enu"
  30.    current=IniReadPvt("Main","Description","Unknown",strcat(DirGet(),"WWWDLANG.",current))
  31. endif   
  32.  
  33. LangFiles=strupper(FileItemize("WWWDLANG.*"))
  34. a=ItemLocate("WWWDLANG.DLL",LangFiles," ")
  35. if a!=0 then LangFiles=ItemRemove(a,LangFiles," ")
  36. LangFiles=ItemSort(LangFiles," ")
  37.  
  38. LangCount=ItemCount(LangFiles," ")
  39. if LangCount==0
  40.    Message("Language","No WWWDLANG.* Language files found.  Using English")
  41.    return
  42. endif
  43.  
  44. LangList=""
  45. for i=1 to LangCount
  46.    lfile=ItemExtract(i,LangFiles," ")
  47.    Lang=IniReadPvt("Main","Description","NONE",strcat(DirGet(),lfile))
  48.    if Lang=="NONE" then Lang=FileExtension (lfile)
  49.    if i<LangCount then LangList=strcat(LangList,Lang,tab)
  50.    else LangList=strcat(LangList,Lang)
  51. next 
  52.  
  53.  
  54. :tryagain
  55. choice=LangList
  56. Dialog("MyDialog")
  57.   
  58. if Choice=="" then return
  59. if ItemCount(Choice,tab)>1 
  60.    Display(4,"Language","You may only select one language")
  61.    goto tryagain
  62. endif
  63.  
  64. a=ItemLocate(choice,LangList,tab)
  65. lfile=ItemExtract(a,LangFiles," ")
  66. ext=FileExtension(lfile)
  67.  
  68. if ext=="ENU"
  69.    IniDeletePvt("Main","Language","WWWBATCH.INI")
  70.    Message("English chosen as langauge","DLL Will use internal strings instead of language file")
  71. else
  72.    IniWritePvt("Main","Language",ext,"WWWBATCH.INI")
  73.    Message("Language","Language set to %Choice%")
  74. endif
  75.  
  76. IntControl(26,0,0,0,0)   ;Tell DLL to reset language strings
  77.  
  78. return
  79.  
  80.  
  81.  
  82.