source: branches/guitools-1.0/shared/nlv.vrs@ 269

Last change on this file since 269 was 269, checked in by Herwig Bauernfeind, 16 years ago

Create branch for GUI tools

File size: 5.1 KB
Line 
1/*:VRX NLVGetMessage
2*/
3NLVGetMessage: PROCEDURE EXPOSE settings. options. fs.
4
5 msgfile = settings.!messages
6 msgnum = ARG( 1 )
7
8 IF msgnum == '' THEN RETURN ''
9
10 SELECT
11 WHEN ARG() == 2 THEN
12 msgtxt = SysGetMessage( msgnum, msgfile, ARG(2) )
13 WHEN ARG() == 3 THEN
14 msgtxt = SysGetMessage( msgnum, msgfile, ARG(2), ARG(3) )
15 WHEN ARG() == 4 THEN
16 msgtxt = SysGetMessage( msgnum, msgfile, ARG(2), ARG(3), ARG(4) )
17 WHEN ARG() == 5 THEN
18 msgtxt = SysGetMessage( msgnum, msgfile, ARG(2), ARG(3), ARG(4), ARG(5) )
19 WHEN ARG() == 6 THEN
20 msgtxt = SysGetMessage( msgnum, msgfile, ARG(2), ARG(3), ARG(4), ARG(5), ARG(6) )
21 WHEN ARG() == 7 THEN
22 msgtxt = SysGetMessage( msgnum, msgfile, ARG(2), ARG(3), ARG(4), ARG(5), ARG(6), ARG(7) )
23 WHEN ARG() == 8 THEN
24 msgtxt = SysGetMessage( msgnum, msgfile, ARG(2), ARG(2), ARG(4), ARG(5), ARG(6), ARG(7), ARG(8) )
25 WHEN ARG() == 9 THEN
26 msgtxt = SysGetMessage( msgnum, msgfile, ARG(2), ARG(2), ARG(4), ARG(5), ARG(6), ARG(7), ARG(8), ARG(9) )
27 WHEN ARG() == 10 THEN
28 msgtxt = SysGetMessage( msgnum, msgfile, ARG(2), ARG(2), ARG(4), ARG(5), ARG(6), ARG(7), ARG(8), ARG(9), ARG(10) )
29 OTHERWISE
30 msgtxt = SysGetMessage( msgnum, msgfile )
31 END
32
33 PARSE VAR msgtxt message '0D'x .
34
35 IF translate(SUBSTR( message, 1, 4 )) == 'SYS0' THEN message = ''
36
37RETURN message
38
39/*:VRX NLVSetText
40*/
41/*
42 * Sets the specified property of the specified control to the specified
43 * message text.
44 */
45NLVSetText: PROCEDURE EXPOSE settings. options. fs.
46 PARSE ARG control, property, message, substitution
47
48 success = 1
49 IF substitution == '' THEN
50 text = NLVGetMessage( message )
51 ELSE
52 text = NLVGetMessage( message, substitution )
53
54 IF text == '' THEN success = 0
55 ELSE CALL VRSet control, property, text
56
57RETURN success
58
59/*:VRX */
60NLVSetup: PROCEDURE EXPOSE settings. options.
61 /* This subroutine is (c) by Alex Taylor, portions (c) Herwig Bauernfeind */
62 IF options.!debug == 1 THEN SAY 'NLVSetup() started'
63 IF options.!debug == 1 THEN SAY ' NLVSetup() is (c) Alex Taylor, portions (c) Herwig Bauernfeind'
64
65 /* Sets all UI text from the message file. Any string that can't be loaded
66 * will default to the built-in English.
67 */
68 execPath = VRGet("Application", "Program")
69 if execPath = "" then parse source . . execPath
70 execDir = VRParseFileName( execPath, "DP")
71
72 filestem = VRParseFileName( execPath, "N")'_'
73 say ' NLV filestem = "'filestem'"'
74
75 /* First, figure out what language/message file to use.
76 */
77 Syslang = TRANSLATE( VALUE('LANG',,'OS2ENVIRONMENT'))
78 SELECT
79 WHEN Syslang == 'ZH_TW' THEN nlv = 'tw'
80 WHEN Syslang == 'ZH_CN' THEN nlv = 'cx'
81 OTHERWISE PARSE VAR Syslang nlv '_' .
82 END
83
84 /* Find the language file */
85 select
86 when STREAM( execDir'\'filestem||nlv'.msg', 'C', 'QUERY EXISTS') \= '' then do
87 say " Found NLV file directly!"