/*:VRX NLVGetMessage */ NLVGetMessage: PROCEDURE EXPOSE settings. options. fs. msgfile = settings.!messages msgnum = ARG( 1 ) IF msgnum == '' THEN RETURN '' SELECT WHEN ARG() == 2 THEN msgtxt = SysGetMessage( msgnum, msgfile, ARG(2) ) WHEN ARG() == 3 THEN msgtxt = SysGetMessage( msgnum, msgfile, ARG(2), ARG(3) ) WHEN ARG() == 4 THEN msgtxt = SysGetMessage( msgnum, msgfile, ARG(2), ARG(3), ARG(4) ) WHEN ARG() == 5 THEN msgtxt = SysGetMessage( msgnum, msgfile, ARG(2), ARG(3), ARG(4), ARG(5) ) WHEN ARG() == 6 THEN msgtxt = SysGetMessage( msgnum, msgfile, ARG(2), ARG(3), ARG(4), ARG(5), ARG(6) ) WHEN ARG() == 7 THEN msgtxt = SysGetMessage( msgnum, msgfile, ARG(2), ARG(3), ARG(4), ARG(5), ARG(6), ARG(7) ) WHEN ARG() == 8 THEN msgtxt = SysGetMessage( msgnum, msgfile, ARG(2), ARG(2), ARG(4), ARG(5), ARG(6), ARG(7), ARG(8) ) WHEN ARG() == 9 THEN msgtxt = SysGetMessage( msgnum, msgfile, ARG(2), ARG(2), ARG(4), ARG(5), ARG(6), ARG(7), ARG(8), ARG(9) ) WHEN ARG() == 10 THEN msgtxt = SysGetMessage( msgnum, msgfile, ARG(2), ARG(2), ARG(4), ARG(5), ARG(6), ARG(7), ARG(8), ARG(9), ARG(10) ) OTHERWISE msgtxt = SysGetMessage( msgnum, msgfile ) END PARSE VAR msgtxt message '0D'x . IF translate(SUBSTR( message, 1, 4 )) == 'SYS0' THEN message = '' RETURN message /*:VRX NLVSetText */ /* * Sets the specified property of the specified control to the specified * message text. */ NLVSetText: PROCEDURE EXPOSE settings. options. fs. PARSE ARG control, property, message, substitution success = 1 IF substitution == '' THEN text = NLVGetMessage( message ) ELSE text = NLVGetMessage( message, substitution ) IF text == '' THEN success = 0 ELSE CALL VRSet control, property, text RETURN success /*:VRX */ NLVSetup: PROCEDURE EXPOSE settings. options. /* This subroutine is (c) by Alex Taylor, portions (c) Herwig Bauernfeind */ IF options.!debug == 1 THEN SAY 'NLVSetup() started' IF options.!debug == 1 THEN SAY ' NLVSetup() is (c) Alex Taylor, portions (c) Herwig Bauernfeind' /* Sets all UI text from the message file. Any string that can't be loaded * will default to the built-in English. */ execPath = VRGet("Application", "Program") if execPath = "" then parse source . . execPath execDir = VRParseFileName( execPath, "DP") filestem = VRParseFileName( execPath, "N")'_' say ' NLV filestem = "'filestem'"' /* First, figure out what language/message file to use. */ Syslang = TRANSLATE( VALUE('LANG',,'OS2ENVIRONMENT')) SELECT WHEN Syslang == 'ZH_TW' THEN nlv = 'tw' WHEN Syslang == 'ZH_CN' THEN nlv = 'cx' OTHERWISE PARSE VAR Syslang nlv '_' . END /* Find the language file */ select when STREAM( execDir'\'filestem||nlv'.msg', 'C', 'QUERY EXISTS') \= '' then do say " Found NLV file directly!" settings.!messages = execdir'\'filestem||nlv'.msg' settings.!helpfile = execdir'\'filestem||nlv'.hlp' end when SysSearchPath('DPATH', filestem||nlv'.msg') \= '' THEN DO execDir = VRParseFileName(SysSearchPath('DPATH', filestem||nlv'.msg'),"DP") say " Found NLV file via DPATH" settings.!messages = execdir'\'filestem||nlv'.msg' settings.!helpfile = execdir'\'filestem||nlv'.hlp' end otherwise do /* Added by Herwig Bauernfeind */ say " Searching subdirectories" ok = SysFileTree(execDir'\'filestem||nlv'.msg',nlvmsg.,'FOS') if nlvmsg.0 = 1 then do say " Found NLV file in subdirectory" settings.!messages = VRParseFilename(nlvmsg.1,"DPN")'.msg' settings.!helpfile = VRParseFilename(nlvmsg.1,"DPN")'.hlp' say " Adding NLV file path to DPATH" OldDPATH = value("DPATH",,"OS2ENVIRONMENT") ok = value("DPATH",VRParseFilename(nlvmsg.1,"DP")';'OldDPATH,"OS2ENVIRONMENT") say " DPATH="value("DPATH",,"OS2ENVIRONMENT") /* End addition by Herwig Bauernfeind */ end else do say " Fallback to English" if STREAM( execDir'\'filestem||'en.msg', 'C', 'QUERY EXISTS') = '' then do say " Found English via DPATH" execDir = VRParseFileName(SysSearchPath('DPATH', filestem||'en.msg'),"DP") end settings.!messages = execDir'\'filestem||'en.msg' settings.!helpfile = execDir'\'filestem||'en.hlp' end end end /* In case the message file exists but not the help file */ if STREAM( settings.!helpfile , 'C', 'QUERY EXISTS') = "" then do settings.!helpfile = execDir'\'filestem||'en.hlp' end IF options.!debug == 1 THEN SAY ' NLVMessageFile = "'settings.!messages'"' IF options.!debug == 1 THEN SAY ' NLVHelpFile = "'settings.!helpfile'"' IF options.!debug == 1 THEN SAY 'NLVSetup() done' RETURN