Changeset 361 for branches/guitools-2.0/shared/nlv.vrs
- Timestamp:
- Jan 6, 2010, 3:01:57 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/guitools-2.0/shared/nlv.vrs
r348 r361 12 12 execPath = VRGet("Application", "Program") 13 13 if execPath = "" then parse source . . execPath 14 execDir = VRParseFileName( execPath, "DP") 14 execDir = translate(VRParseFileName( execPath, "DP")) 15 parse var execDir srchroot '\BIN' 16 15 17 say ' NLV execDir = "'execDir'"' 18 say ' NLV srchroot = "'srchRoot'"' 16 19 17 20 filestem = VRParseFileName( execPath, "N")'_' … … 19 22 say ' NLV filestem = "'filestem'"' 20 23 21 /* First, figure out what language/message file to use. 22 */ 24 /* First, figure out what language/message file to use */ 23 25 Syslang = TRANSLATE( VALUE('LANG',,'OS2ENVIRONMENT')) 24 26 SELECT 25 WHEN Syslang == 'ZH_TW' THEN nlv = ' tw'26 WHEN Syslang == 'ZH_CN' THEN nlv = ' cx'27 WHEN Syslang == 'ZH_TW' THEN nlv = 'TW' 28 WHEN Syslang == 'ZH_CN' THEN nlv = 'CX' 27 29 OTHERWISE PARSE VAR Syslang nlv '_' . 28 30 END 29 31 30 /* Find the language file */ 31 select 32 when STREAM( execDir'\'filestem||nlv'.msg', 'C', 'QUERY EXISTS') \= '' then do 33 say " Found NLV file directly!" 34 settings.!messages = strip(execdir'\'filestem||nlv'.msg','L','\') 35 settings.!helpfile = strip(execdir'\'filestem||nlv'.hlp','L','\') 36 end 37 when SysSearchPath('DPATH', filestem||nlv'.msg') \= '' THEN DO 38 execDir = VRParseFileName(SysSearchPath('DPATH', filestem||nlv'.msg'),"DP") 39 say " Found NLV file via DPATH" 40 settings.!messages = strip(execdir'\'filestem||nlv'.msg','L','\') 41 settings.!helpfile = strip(execdir'\'filestem||nlv'.hlp','L','\') 42 end 43 otherwise do 44 /* Added by Herwig Bauernfeind */ 45 say " Searching subdirectories" 46 ok = SysFileTree(execDir'\'filestem||nlv'.msg',nlvmsg.,'FOS') 47 if nlvmsg.0 = 1 then do 48 say " Found NLV file in subdirectory" 49 settings.!messages = VRParseFilename(nlvmsg.1,"DPN")'.msg' 50 settings.!helpfile = VRParseFilename(nlvmsg.1,"DPN")'.hlp' 51 say " Adding NLV file path to DPATH" 52 OldDPATH = value("DPATH",,"OS2ENVIRONMENT") 53 ok = value("DPATH",VRParseFilename(nlvmsg.1,"DP")';'OldDPATH,"OS2ENVIRONMENT") 54 say " DPATH="value("DPATH",,"OS2ENVIRONMENT") 55 /* End addition by Herwig Bauernfeind */ 56 end 57 else do 58 say " Fallback to English" 59 if STREAM( execDir'\'filestem||'en.msg', 'C', 'QUERY EXISTS') = '' then do 60 say " Found English via DPATH" 61 execDir = VRParseFileName(SysSearchPath('DPATH', filestem||'en.msg'),"DP") 62 end 63 settings.!messages = strip(execDir'\'filestem||'en.msg','L','\') 64 settings.!helpfile = strip(execDir'\'filestem||'en.hlp','L','\') 65 end 66 end 67 end 32 /* Find the messagefile and helpfile */ 33 settings.!messages = NLVsearch(nlv,'LANG','MSG','DPATH') 34 settings.!helpfile = NLVsearch(nlv,'HELP','HLP','HELP') 68 35 69 /* In case the message file exists but not the help file */ 70 if STREAM( settings.!helpfile , 'C', 'QUERY EXISTS') = "" then do 71 settings.!helpfile = strip(execDir'\'filestem||'en.hlp','L','\') 72 end 73 74 IF options.!debug == 1 THEN SAY ' NLVMessageFile = "'settings.!messages'"' 75 IF options.!debug == 1 THEN SAY ' NLVHelpFile = "'settings.!helpfile'"' 36 IF options.!debug == 1 THEN SAY ' NLV MessageFile = "'settings.!messages'"' 37 IF options.!debug == 1 THEN SAY ' NLV HelpFile = "'settings.!helpfile'"' 76 38 77 39 IF options.!debug == 1 THEN SAY time()' NLVSetup() done' 78 40 RETURN 41 42 /*:VRX NLVSearch 43 */ 44 NLVSearch: procedure expose filestem execdir srchroot 45 nlv = arg(1) 46 SubDir = arg(2) 47 Suffix = arg(3) 48 PathVar = arg(4) 49 say time()" NLVSearch() started" 50 NLVSrchDone = 0 51 NLVFile = "" 52 do until NLVSrchDone = 1 53 say ' NLV 'Suffix' file = "'filestem||nlv'.'Suffix'"' 54 select 55 when VRFileExists(srchRoot'\'SubDir'\'filestem||nlv'.'Suffix) then do 56 say " NLV "Suffix" file found directly!" 57 NLVFile = strip(srchRoot'\'SubDir'\'filestem||nlv'.'Suffix,'L','\') 58 NLVSrchDone = 1 59 end 60 when SysSearchPath(PathVar, filestem||nlv'.'Suffix) \= '' then do 61 execDir = VRParseFileName(SysSearchPath(PathVar, filestem||nlv'.'Suffix),"DP") 62 say " NLV "Suffix" file found via "PathVar 63 NLVFile = strip(execdir'\'filestem||nlv'.'Suffix,'L','\') 64 NLVSrchDone = 1 65 end 66 otherwise do 67 say " Searching subdirectories" 68 ok = SysFileTree(srchRoot'\'filestem||nlv'.'Suffix,nlvmsg.,'FOS') 69 if nlvmsg.0 = 1 then do 70 say " Found NLV "Suffix" file in subdirectory" 71 settings.!messages = VRParseFilename(nlvmsg.1,"DPN")'.msg' 72 say " Adding NLV "Suffix" path to "PathVar 73 OldPathVar = value(PathVar,,"OS2ENVIRONMENT") 74 ok = value(PathVar,VRParseFilename(nlvmsg.1,"DP")';'OldPathVar,"OS2ENVIRONMENT") 75 NLVSrchDone = 1 76 end 77 else say " NLV "Suffix" file not found in subdirectories!" 78 end 79 end 80 if NLVSrchDone = 0 then do /* Fallback to English */ 81 if nlv = "EN" then NLVSrchDone = 1 /* We give up and leave */ 82 else do 83 say " NLV "Suffix" File not found, falling back to EN." 84 nlv = "EN" 85 end 86 end 87 end 88 say time()' NLVSearch() done, returning "'NLVFile'"' 89 return NLVFile 79 90 80 91 /*:VRX NLVGetMessage
Note:
See TracChangeset
for help on using the changeset viewer.