Ignore:
Timestamp:
Jan 23, 2013, 1:10:58 AM (13 years ago)
Author:
Alex Taylor
Message:

Start NLS-enablement.

Location:
trunk/gui/printer/cupswiz
Files:
1 added
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/gui/printer/cupswiz/cupswiz.VRP

    r17 r18  
    11VX-REXX OS/2 V2.14 Build B3
    22VRX: cupswiz.VRX
    3 MacroPath: VRM:G:\netlabs\svn\ecups\trunk\gui\printer\cupswiz
     3MacroPath: VRM:E:\DEVELOPMENT\VXREXX\Projects\cupswiz
    44EXEPath:
    55RunParameters:
    66RunDirectory:
    7 VRXWindow: __VREMainWindow,1,602,2554,5770,9106
    8 VRXWindow: __VRESectionListWindow,1,650,11804,4529,3891
    9 VRXWindow: __VREToolsWindow,1,1674,9877,4965,1659
    10 VRXWindow: __VREWindListWindow,1,5215,11804,2650,3891
     7VRXWindow: __VREMainWindow,1,614,2554,5770,9106
     8VRXWindow: __VRESectionListWindow,1,675,11804,4529,3891
     9VRXWindow: __VREToolsWindow,1,1686,9877,4971,1659
     10VRXWindow: __VREWindListWindow,1,5228,11804,2650,3891
    1111UserFile: 1
    1212UserWindow: WN_MAIN,1
  • trunk/gui/printer/cupswiz/cupswiz.VRX

    r17 r18  
    119119    CALL SetPage4
    120120    CALL VRSet 'WN_MAIN', 'Pointer', 'WAIT'
    121     CALL VRSet 'DT_INFO', 'Caption', 'Creating printer...'
     121    CALL NLSSetText 'DT_INFO', 'Caption', 50                                /* 50: Creating printer... */
    122122    ok = CreatePrinter( globals.!os2printer )
     123
    123124    CALL VRSet 'DT_INFO', 'Caption', ''
    124125    CALL VRSet 'WN_MAIN', 'Pointer', '<default>'
     
    126127    IF ok <> 0 THEN DO
    127128        SELECT
    128             WHEN ok == 1 THEN reason = 'Error importing PPD file.'
    129             WHEN ok == 2 THEN reason = 'Error creating CUPS printer.  See' globals.!log1 'for more information.'
    130             WHEN ok == 3 THEN reason = 'Error creating printer object.  See' globals.!log1 'for more information.'
    131             OTHERWISE reason = 'Unknown error.'
    132         END
    133         CALL VRMessage VRWindow(), 'The following error occurred when trying to create the printer:' ||,
    134                        '0d0a0d0a'x || reason, 'Error Creating Printer', 'E'
    135         CALL VRSet 'DT_INFO', 'Caption', 'The printer could not be created.'
    136         CALL VRSet 'PB_NEXT',   'Caption', 'Return'
     129            WHEN ok == 1 THEN reason = NLSGetMessage( 70 )                  /* 70: Error importing PPD file. */
     130            WHEN ok == 2 THEN reason = NLSGetMessage( 71, globals.!log1 )   /* 71: Error creating CUPS printer.  See %1 for more information. */
     131            WHEN ok == 3 THEN reason = NLSGetMessage( 72, globals.!log1 )   /* 72: Error creating printer object.  See %1 for more information. */
     132            OTHERWISE reason = NLSGetMessage( 73)                           /* 73: Unknown error. */
     133        END
     134        CALL VRMessage VRWindow(), NLSGetMessage( 60 ) ||,                  /* 60: The following error occurred when trying to create the printer: */
     135                       '0d0a0d0a'x || reason, NLSGetMessage( 56 ), 'E'      /* 56: Error Creating Printer */
     136        CALL NLSSetText 'DT_INFO', 'Caption', 52                            /* 52: The printer could not be created. */
     137        CALL NLSSetText 'PB_NEXT', 'Caption', 54                            /* 54: Return */
    137138    END
    138139    ELSE DO
    139         CALL VRSet 'DT_INFO',   'Caption', 'The printer has been created.'
    140         CALL VRSet 'PB_NEXT',   'Caption', 'Create another'
    141     END
    142     CALL VRSet 'PB_CANCEL', 'Caption', 'Close'
     140        CALL NLSSetText 'DT_INFO', 'Caption', NLSGetMessage( 51 )           /* 51: The printer has been created. */
     141        CALL NLSSetText 'PB_NEXT', 'Caption', NLSGetMessage( 53 )           /* 53: Create another */
     142    END
     143    CALL NLSSetText 'PB_CANCEL', 'Caption', NLSGetMessage( 55 )             /* 55: Close */
    143144
    144145    CALL LINEOUT globals.!log1, ''
     
    160161    IF globals.!prt_dev <> '' THEN
    161162        cups_cmd = cups_cmd '-v "'globals.!prt_port'" -m' globals.!prt_dev
    162     ELSE IF globals.!mode == 2 THEN 
     163    ELSE IF globals.!mode == 2 THEN
    163164        cups_cmd = cups_cmd '-v "'globals.!prt_port'" -P "'globals.!prt_ppd'"'
    164165    ELSE DO
     
    204205
    205206    /* Determine the printer driver source directories/files.  Yes, this is
    206      * repeated from ImportPPD, but we have to do it again here because 
     207     * repeated from ImportPPD, but we have to do it again here because
    207208     * (a) we might not have gone through ImportPPD to get to this point, and
    208209     * (b) even if we did, the repository information might have changed.
     
    217218    IF driver_path == '' THEN DO
    218219        /* TODO allow the user to browse for the driver on their system */
    219         CALL VRMessage VRWindow(), 'The printer driver' prnt_drv 'could not  ',
    220                                    'be located.  If you have the driver      ',
    221                                    'files, please copy them to the directory ',
    222                                    globals.!os2dir'\DLL\'prnt_drv' and then  ',
    223                                    'try again.', 'Driver Not Found', 'E'
     220        CALL VRMessage VRWindow(),,
     221                       NLSGetMessage( 61, prnt_drv, globals.!os2dir'\DLL\'prnt_drv ),,    /* 61: The printer driver %1 could not be located.  If you have the driver files, please copy them to the directory %2 and then try again. */
     222                       NLSGetMessage( 57 ), 'E'                                           /* 57: Driver Not Found */
    224223        RETURN 1
    225224    END
     
    232231
    233232    /* New logic to create the printer ourselves (instead of using RINSTPRN).
    234      * There are two necessary steps: make sure the driver is installed, and 
     233     * There are two necessary steps: make sure the driver is installed, and
    235234     * then create the printer object (which causes the underlying device and
    236235     * queue to be created automatically as well).
     
    240239    CALL LINEOUT globals.!log1, 'InstallPrintDriver(' prnt_drv',' driver_path',' printer_model ') RC =' result
    241240
    242     IF result == 0 THEN 
     241    IF result == 0 THEN
    243242        result = CreatePrinterObject( prnt_drv, printer_model,,
    244243                                      port_name, queue_name, printer_title )
     
    250249        CALL DeletePort port_name
    251250    ELSE IF port_ok == 1 THEN DO
    252         CALL VRMessage VRWindow(),
    253                        'The installed version of CUPS.PDR appears to be out of ',
    254                        'date.  As a result, the desktop printer will not be ',
    255                        'usable until the desktop is restarted.',,
    256                        'Port Driver Problem', 'W'
     251        CALL VRMessage VRWindow(),,
     252                       NLSGetMessage( 62 ),,        /* 62: The installed version of CUPS.PDR appears to be out of date.  As a result, the desktop printer will not be usable until the desktop is restarted. */
     253                       NLSGetMessage( 58 ), 'W'     /* 58: Port Driver Problem */
    257254    END
    258255
     
    281278            IF ok <> 0 THEN DO
    282279                CALL LINEOUT globals.!log1, 'PPD import failed:' ok
    283                 RETURN 1                /** RC=1  PPD import failed **/
     280                CALL VRMessage VRWindow(), NLSGetMessage( 69 ),,        /* 69: The printer parameters could not ... PPD file. */
     281                               NLSGetMessage( 70 ), 'W'                 /* 70: Error importing PPD file */
     282                CALL PromptForPMName
     283                /* RETURN 1                RC=1  PPD import failed **/
    284284            END
    285285        END
     
    294294                IF ok <> 0 THEN DO
    295295                    CALL LINEOUT globals.!log1, 'PPD import failed:' ok
    296                     RETURN 1                /** RC=1  PPD import failed **/
     296                    CALL VRMessage VRWindow(), NLSGetMessage( 69 ),  NLSGetMessage( 70 ), 'W'
     297                    CALL PromptForPMName
     298                    /* RETURN 1                RC=1  PPD import failed **/
    297299                END
    298300            END
     
    308310/*:VRX         DDCB_PROTOCOL_Change
    309311*/
    310 DDCB_PROTOCOL_Change: PROCEDURE
     312DDCB_PROTOCOL_Change: PROCEDURE EXPOSE globals.
    311313
    312314    idx = VRGet('DDCB_PROTOCOL', 'Selected')
     
    317319            show_user  = 1
    318320            show_pass  = 1
    319             CALL VRSet 'DT_SERVER',  'Caption', 'Printer or server address:'
    320             CALL VRSet 'DT_QUEUE',   'Caption', 'Printer queue name:'
    321             CALL VRSet 'DT_USERID',  'Caption', 'User ID:'
     321            server_caption = 82          /* 82: Printer or server address: */
     322            queue_caption  = 84          /* 84: Printer queue name: */
     323            userid_caption = 86          /* 86: User ID: */
    322324        END
    323325        WHEN which == 2 THEN DO     /* SOCKET */
     
    325327            show_user  = 0
    326328            show_pass  = 0
    327             CALL VRSet 'DT_SERVER',  'Caption', 'Printer or server address:'
     329            server_caption = 82          /* 82: Printer or server address: */
     330            queue_caption  = 84          /* 84: Printer queue name: */
     331            userid_caption = 86          /* 86: User ID: */
    328332        END
    329333        WHEN which == 3 THEN DO     /* LPD */
     
    331335            show_user  = 1
    332336            show_pass  = 0
    333             CALL VRSet 'DT_SERVER',  'Caption', 'Printer or server address:'
    334             CALL VRSet 'DT_QUEUE',   'Caption', 'Printer queue name:'
    335             CALL VRSet 'DT_USERID',  'Caption', 'User ID (if required):'
     337            server_caption = 82          /* 82: Printer or server address: */
     338            queue_caption  = 84          /* 84: Printer queue name: */
     339            userid_caption = 87          /* 87: User ID (if required): */
    336340        END
    337341        WHEN which == 4 THEN DO     /* SMB */
     
    339343            show_user  = 1
    340344            show_pass  = 1
    341             CALL VRSet 'DT_SERVER',  'Caption', 'Print server name:'
    342             CALL VRSet 'DT_QUEUE',  'Caption', 'Shared printer name:'
    343             CALL VRSet 'DT_USERID', 'Caption', 'User ID:'
     345            server_caption = 83          /* 83: Print server name: */
     346            queue_caption  = 85          /* 85: Shared printer name: */
     347            userid_caption = 86          /* 86: User ID: */
    344348        END
    345349        OTHERWISE DO                /* CUPS */
     
    347351            show_user  = 0
    348352            show_pass  = 0
    349             CALL VRSet 'DT_SERVER',  'Caption', 'CUPS server name:'
    350             CALL VRSet 'DT_QUEUE',  'Caption',  'CUPS printer name:'
    351         END
    352     END
     353            server_caption = 88          /* 88: CUPS server name: */
     354            queue_caption  = 89          /* 89: CUPS printer name: */
     355            userid_caption = 86          /* 86: User ID: */
     356        END
     357    END
     358
     359    r = NLSSetText('DT_SERVER', 'Caption', server_caption )
     360    r = NLSSetText('DT_QUEUE',  'Caption', queue_caption )
     361    r = NLSSetText('DT_USERID', 'Caption', userid_caption )
    353362
    354363    CALL VRSet 'DT_QUEUE',    'Visible', show_queue
     
    395404GetCupsPorts: PROCEDURE EXPOSE globals.
    396405
    397     CALL VRSet 'DT_INFO', 'Caption', 'Looking for connected printers.  Please wait...'
     406    CALL NLSSetText 'DT_INFO', 'Caption', 30        /* 30: Looking for connected printers.  Please wait... */
    398407
    399408    lpinfo_cmd = globals.!cupsdir'\sbin\lpinfo.exe -v |rxqueue'
     
    405414    defqueue  = RXQUEUE('SET', listqueue )
    406415
    407     /* Use the SNMP backend to find network printers.  We do this in addition 
    408      * to lpinfo because SNMP may provide the actual printer name.  We'll 
     416    /* Use the SNMP backend to find network printers.  We do this in addition
     417     * to lpinfo because SNMP may provide the actual printer name.  We'll
    409418     * merge this with the output of lpinfo in the next step.
    410419     */
     
    432441            i = i + 1
    433442            IF _queue <> '' THEN _queue = '(queue '_queue')'
    434             IF SYMBOL('netnames._name') == 'VAR' THEN 
    435                 devices.i = 'Detected network printer ('_protocol') "'netnames._name'" at' _host _queue
     443            IF SYMBOL('netnames._name') == 'VAR' THEN
     444                devices.i = NLSGetMessage( 32, _protocol, netnames._name, _host _queue )    /* 32: Detected network printer (%1) "%2" at %3 */
    436445            ELSE
    437                 devices.i = 'Detected network printer ('_protocol') at' _host _queue
     446                devices.i = NLSGetMessage( 33, _protocol, _host _queue )                    /* 33: Detected network printer (%1) at %2 */
    438447        END
    439448        ELSE IF _type <> 'direct' THEN ITERATE
     
    441450            IF _name == 'hp' THEN ITERATE
    442451            i = i + 1
    443             devices.i = 'Local printer:' _name
     452            devices.i = NLSGetMessage( 35, _name )                                          /* 35: Local printer: %1 */
    444453        END
    445454        ports.i = _name
     
    453462    CALL VRSet    'LB_SELECT', 'Painting', 0
    454463    CALL VRMethod 'LB_SELECT', 'AddStringList', 'devices.',, 'ports.'
    455     CALL VRMethod 'LB_SELECT', 'AddString', 'Network printer (manual configuration)',, ''
     464    CALL VRMethod 'LB_SELECT', 'AddString', NLSGetMessage( 34 ),, ''                        /* 34: Network printer (manual configuration) */
    456465    CALL VRSet    'LB_SELECT', 'Selected', 1
    457466    CALL VRSet    'LB_SELECT', 'Painting', 1
    458467
    459     CALL VRSet 'DT_INFO', 'Caption', 'Select the connection for this printer.'
     468    CALL VRSet 'DT_INFO', 'Caption', NLSGetMessage( 31 )                                    /* 31: Select the connection for this printer. */
    460469
    461470RETURN
     
    465474GetCupsPrinters: PROCEDURE EXPOSE globals. manufacturers.
    466475
    467     CALL VRSet 'DT_INFO', 'Caption', 'Getting list of supported printers.  Please wait...'
     476    CALL NLSSetText 'DT_INFO', 'Caption', 20                /* 20: Getting list of supported printers.  Please wait... */
    468477
    469478    lpinfo_cmd = globals.!cupsdir'\sbin\lpinfo.exe --exclude-schemes drv -m 2>&1 |rxqueue'
     
    519528 *    manufacturers.i.!printers.j.!remark2    any distinguishing remarks for the alternate driver
    520529 */
    521 
    522530    manufacturers.0 = WORDS( makers )
    523531    DO i = 1 TO manufacturers.0
     
    584592     */
    585593    count = manufacturers.0 + 1
    586     manufacturers.count.!name = '-- Custom --'
     594    manufacturers.count.!name = NLSGetMessage( 22 )                     /* 22: -- Custom -- */
    587595    manufacturers.count.!printers.0 = 1
    588     manufacturers.count.!printers.1.!model   = '-- Other printer (requires PPD) --'
     596    manufacturers.count.!printers.1.!model   = NLSGetMessage( 23 )      /* 23: -- Other printer (requires PPD) -- */
    589597    manufacturers.count.!printers.1.!driver  = ''
    590598    manufacturers.count.!printers.1.!type    = ''
    591     manufacturers.count.!printers.1.!remark  = '-- Other printer (requires PPD) --'
     599    manufacturers.count.!printers.1.!remark  = manufacturers.count.!printers.1.!model
    592600    manufacturers.count.!printers.1.!driver2 = ''
    593601    manufacturers.count.!printers.1.!remark2 = ''
    594602    manufacturers.0 = count
    595603
    596     CALL VRSet 'DT_INFO', 'Caption', 'Select the printer manufacturer and model from the list below.'
     604    CALL NLSSetText 'DT_INFO', 'Caption', 21                            /* 21: Select the printer manufacturer and model from the list below. */
    597605
    598606RETURN
     
    653661         * directory later on if they install the driver from PM.
    654662         */
    655         pbtn.1 = 'OK'
    656         pbtn.2 = 'Cancel'
     663        pbtn.1 = NLSGetMessage( 2 )                     /* 2: OK */
     664        pbtn.2 = NLSGetMessage( 3 )                     /* 3: Cancel */
    657665        pbtn.0 = 2
    658         ptext = 'The install files for the' driver 'driver could not be '  ||,
    659                 'located.  These files will be recreated from the driver ' ||,
    660                 'files which are already installed on your system.'        ||,
    661                 '0d0a0d0a'x || 'Please enter the directory where the '     ||,
    662                 'install files will be placed.'
     666        ptext = NLSGetMessage( 63, driver ) ||,         /* 63: The install files for the %1 driver could not be located.  These files will be recreated from the driver files which are already installed on your system. */
     667                '0d0a0d0a'x || NLSGetMessage( 64 )      /* 64: Please enter the directory where the install files will be placed. */
     668
    663669        PARSE VALUE VRGetIni('PM_INSTALL', driver'_DIR', 'USER') WITH drvr_dir '00'x .
    664670        IF drvr_dir == '' THEN
    665671            PARSE VALUE VRGetIni('InstPDR', 'PATH_TO_'driver, 'USER') WITH drvr_dir '00'x .
    666         ok = VRPrompt('WN_MAIN', ptext, 'drvr_dir',,
    667                       'Enter Directory', 'pbtn.', 1, 2 )
     672        ok = VRPrompt('WN_MAIN', ptext, 'drvr_dir', NLSGetMessage( 59 ), 'pbtn.', 1, 2 )        /* 59: Enter Directory */
    668673        IF ok <> 1 THEN RETURN 9        /** RC=9  User cancelled **/
    669674        drvr_dir = VRExpandFileName( drvr_dir )
     
    766771     * to our working directory.
    767772     */
    768     ADDRESS CMD '@'ppd_exe ppdfile ppd_use '2>&1 | RXQUEUE' nq
     773    ADDRESS CMD '@'ppd_exe ppdfile ppd_use '2>NUL 1| RXQUEUE' nq
    769774    DO QUEUED()
    770775        PULL output
     
    782787     */
    783788    count = 0
    784     ADDRESS CMD '@'pin_exe 'ppd' ppddir drv_out '2>&1 | RXQUEUE' nq
     789    ADDRESS CMD '@'pin_exe 'ppd' ppddir drv_out '2>NUL 1| RXQUEUE' nq
    785790    DO QUEUED()
    786791        PARSE PULL output
     
    898903    SIGNAL ON NOVALUE NAME __NoValue
    899904
     905    /* Hide the VX-REXX console window
     906     */
     907    CALL VRSet 'Console', 'WindowListTitle', ''
     908
    900909    CALL RxFuncAdd 'SysLoadFuncs', 'REXXUTIL', 'SysLoadFuncs'
    901910    CALL SysLoadFuncs
    902911
    903912    CALL LoadSettings
     913    CALL SetLanguage
    904914
    905915    IF InitArgs.0 > 0 THEN globals.!cupsdir = InitArgs.1
     
    907917    IF \VRIsDir( globals.!cupsdir ) THEN DO
    908918        IF TRANSLATE( globals.!cupsdir ) <> '/R' THEN
    909             CALL VRMessage VRWindow(),,
    910                            'CUPS could not be located.  If you wish to use ' ||,
    911                            'a local installation of CUPS, please specify '   ||,
    912                            'the path where CUPS is installed on the command '||,
    913                            'line to this program (e.g "CUPSWIZ F:\CUPS").'   ||,
    914                            '0d0a0d0a'x ||,
    915                            'Only remote CUPS queues will be available for '  ||,
    916                            'printers created in this session.  (To skip '    ||,
    917                            'this message in the future, start this program ' ||,
    918                            'with the /R parameter.)',,
    919                            'CUPS Path Not Found or Not Valid', 'E'
     919            CALL VRMessage VRWindow(),
     920                           NLSGetMessage( 65, 'CUPSWIZ F:\CUPS') ||,    /* 65: CUPS could not be located ... on the command line to this program (e.g "%1"). */
     921                           '0d0a0d0a'x || NLSGetMessage( 66 ),,         /* 66: Only remote CUPS queues ... start this program with the /R parameter.) */
     922                           NLSGetMessage( 28 ), 'E'                     /* 28: CUPS Path Not Found or Not Valid */
    920923        globals.!cupsdir = ''
    921924    END
     
    932935    drop window
    933936
     937    manufacturers.0 = 0
    934938    CALL SetPage1
    935939
     
    10231027                IF driver == '' THEN
    10241028                    type = ''
    1025                 ELSE IF remark == '' THEN 
     1029                ELSE IF remark == '' THEN
    10261030                    type = ' ('driver')'
    10271031                ELSE
     
    10781082    globals.!prdrv      = STREAM( globals.!os2dir'\install\prdrv.lst',  'C', 'QUERY EXISTS')
    10791083    globals.!prdesc     = STREAM( globals.!os2dir'\install\prdesc.lst', 'C', 'QUERY EXISTS')
     1084
     1085    /* Set the language file name.
     1086     */
     1087    globals.!nlsfile = 'cupswz'
    10801088
    10811089RETURN 0
     
    11091117/*:VRX         PB_ABOUT_Click
    11101118*/
    1111 PB_ABOUT_Click: 
     1119PB_ABOUT_Click:
    11121120    CALL SW_ABOUT_Close
    11131121RETURN
     
    12141222
    12151223    IF invalid == 1 THEN DO
    1216         CALL VRMessage VRWindow(), 'Missing required value(s).', 'Missing Value(s)', 'E'
     1224        CALL VRMessage VRWindow(), NLSGetMessage( 74 ),,        /* 74: Missing required value(s). */
     1225                                   NLSGetMessage( 75 ), 'E'     /* 75: Missing Value(s) */
    12171226        RETURN
    12181227    END
     
    12391248            IF which == '' THEN DO
    12401249                globals.!mode = 2   /* Mode 2: user-selected PPD file */
    1241                 ppd = VRFileDialog( VRWindow(), 'Select PPD', 'O', '*.ppd')
     1250                ppd = VRFileDialog( VRWindow(), NLSGetMessage( 24 ), 'O', '*.ppd')      /* 24: Select PPD */
    12421251                IF ppd == '' THEN RETURN
    12431252                globals.!prt_ppd  = ppd
     
    12451254                globals.!prt_nick = GetNameFromPPD( ppd )
    12461255                IF globals.!prt_nick == '' THEN DO
    1247                     CALL VRMessage VRWindow(), 'Could not read printer name '||,
    1248                                                'from' ppd'.', 'Invalid PPD', 'E'
     1256                    CALL VRMessage VRWindow(), NLSGetMessage( 76, ppd ),,       /* 76: Could not read printer name from %1. */
     1257                                               NLSGetMessage( 77 ), 'E'         /* 77: Invalid PPD */
    12491258                    RETURN
    12501259                END
     
    13181327            DO
    13191328                IF ( globals.!remotecups <> '') THEN
    1320                     _errmsg = 'You must enter a description.'
     1329                    _errmsg = NLSGetMessage( 42 )                               /* 42: You must enter a description. */
    13211330                ELSE
    1322                     _errmsg = 'You must enter a name, a location, and a description.'
    1323                 CALL VRMessage VRWindow(), _errmsg, 'Missing Value(s)', 'E'
     1331                    _errmsg = NLSGetMessage( 43 )                               /* 43: You must enter a name, a location, and a description. */
     1332                CALL VRMessage VRWindow(), _errmsg, NLSGetMessage( 75 ), 'E'    /* 75: Missing Value(s) */
    13241333                RETURN
    13251334            END
     
    13291338                ( VERIFY( globals.!prt_name, '/# ' || '09'x, 'MATCH') <> 0 )) THEN
    13301339            DO
    1331                 CALL VRMessage VRWindow(),  'The printer name must start '     ||,
    1332                                'with a letter, and may not include "/", "#", ' ||,
    1333                                'space, or tab characters.', 'Invalid Name', 'E'
     1340                CALL VRMessage VRWindow(), NLSGetMessage( 44 ),,                /* 44: The printer name must start with ... or tab characters. */
     1341                                           NLSGetMessage( 45 ), 'E'             /* 45: Invalid Name */
    13341342                RETURN
    13351343            END
     
    13481356
    13491357        WHEN globals.!page == 4 THEN DO
    1350             CALL VRSet 'PB_NEXT',     'Caption', 'Next >'
     1358            CALL NLSSetText 'PB_NEXT', 'Caption', 5                 /* 5: Next > */
    13511359            CALL VRSet 'EF_NAME',     'Value', ''
    13521360            CALL VRSet 'EF_LOCATION', 'Value', ''
     
    13751383         * Just use the generic PS driver.
    13761384         */
    1377         CALL VRMessage VRWindow(),,
    1378                        'The printer "'globals.!prt_nick'" does not appear to' ,
    1379                        'be supported by the' globals.!os2driver 'driver, and' ,
    1380                        'no similar models were found.  The generic PostScript',
    1381                        'driver will be used for application support.',,
    1382                        'Printer Name Not Found', 'W'
     1385        CALL VRMessage VRWindow(), NLSGetMessage( 67, globals.!prt_nick, globals.!os2driver ),,     /* 67: The printer "%1" does not ... application support. */
     1386                                   NLSGetMessage( 68 ), 'W'                                         /* 68: Printer Name Not Found */
    13831387        globals.!prt_nick = 'Generic PostScript Printer'
    13841388        RETURN
     
    13971401return
    13981402
     1403/*:VRX         SetLanguage
     1404*/
     1405SetLanguage: PROCEDURE EXPOSE globals.
     1406    PARSE ARG locale
     1407
     1408    /*
     1409     * This function locates the proper language files, and uses the message
     1410     * file to sets all UI text.  If the language could not be determined, we
     1411     * default to English.
     1412     */
     1413    execPath = VRGet('Application', 'Program')
     1414    execDir  = VRParseFileName( execPath, 'DP')
     1415
     1416    /*
     1417     * First, figure out what language/message file to use.
     1418     */
     1419    IF locale <> '' THEN
     1420        syslanguage = locale
     1421    ELSE
     1422        syslanguage = VALUE('LANG',,'OS2ENVIRONMENT')
     1423
     1424    SELECT
     1425        WHEN TRANSLATE( syslanguage ) == 'ZH_TW' THEN nlv = 'tw'
     1426        WHEN TRANSLATE( syslanguage ) == 'ZH_CN' THEN nlv = 'cx'
     1427        OTHERWISE                                PARSE VAR syslanguage nlv '_' .
     1428    END
     1429    nlvfile = globals.!nlsfile || nlv
     1430    IF ( STREAM( execDir'\'nlvfile'.msg', 'C', 'QUERY EXISTS') \= '') | ( SysSearchPath('DPATH', nlvfile'.msg') \= '') THEN DO
     1431        globals.!messages = nlvfile'.msg'
     1432        helpfile          = nlvfile'.hlp'
     1433        CALL VRSet 'WN_MAIN', 'HelpFile', helpfile
     1434    END
     1435    ELSE DO
     1436        globals.!messages = globals.!nlsfile || 'en.msg'
     1437        helpfile          = globals.!nlsfile || 'en.hlp'
     1438        CALL VRSet 'WN_MAIN', 'HelpFile', helpfile
     1439    END
     1440
     1441    /*
     1442     * If the message file is missing or unreadable, display an error and then exit.
     1443     */
     1444    IF NLSGetMessage( 1 ) == '' THEN DO
     1445        CALL VRMessage VRWindow(), 'Language file' TRANSLATE( globals.!messages ) 'could not be loaded.', 'Cannot Continue', 'E'
     1446        RETURN 0
     1447    END
     1448
     1449    /*
     1450     * Now set the captions for the UI controls on the main window, according
     1451     * to the specified language.
     1452     */
     1453    CALL NLSSetText 'WN_MAIN',    'Caption', 1         /* 1: Create CUPS Printer */
     1454    CALL NLSSetText 'PB_NEXT',    'Caption', 5         /* 5: Next > */
     1455    CALL NLSSetText 'PB_CANCEL',  'Caption', 3         /* 3: Cancel */
     1456    CALL NLSSetText 'PB_REFRESH', 'Caption', 6         /* 6: Refresh */
     1457
     1458RETURN 1
     1459
    13991460/*:VRX         SetPage1
    14001461*/
    14011462SetPage1: PROCEDURE EXPOSE globals. manufacturers.
    14021463
     1464    CALL VRMethod 'LB_BRAND', 'Clear'
    14031465    CALL VRSet 'PB_NEXT',  'Enabled', 0
    14041466    CALL VRSet 'LB_BRAND', 'Visible', 1
     
    14261488    CALL VRSet 'WN_MAIN', 'Pointer', 'WAIT'
    14271489
    1428     /* Populate the manufacturer list */
    1429     IF globals.!cupsdir == '' THEN DO
    1430         manufacturers.1.!name = '-- Custom --'
    1431         manufacturers.1.!printers.0 = 1
    1432         manufacturers.1.!printers.1.!model   = '-- Other printer (requires PPD) --'
    1433         manufacturers.1.!printers.1.!driver  = ''
    1434         manufacturers.1.!printers.1.!type    = ''
    1435         manufacturers.1.!printers.1.!remark  = '-- Other printer (requires PPD) --'
    1436         manufacturers.1.!printers.1.!driver2 = ''
    1437         manufacturers.1.!printers.1.!remark2 = ''
    1438         manufacturers.0 = 1
    1439     END
    1440     ELSE
    1441         CALL GetCupsPrinters
     1490    IF manufacturers.0 == 0 THEN DO
     1491
     1492        /* Populate the manufacturer list */
     1493        IF globals.!cupsdir == '' THEN DO
     1494            manufacturers.1.!name = NLSGetMessage( 22 )                     /* 22: -- Custom -- */
     1495            manufacturers.1.!printers.0 = 1
     1496            manufacturers.1.!printers.1.!model   = NLSGetMessage( 23 )      /* 23: -- Other printer (requires PPD) -- */
     1497            manufacturers.1.!printers.1.!driver  = ''
     1498            manufacturers.1.!printers.1.!type    = ''
     1499            manufacturers.1.!printers.1.!remark  = NLSGetMessage( 23 )      /* 23: -- Other printer (requires PPD) -- */
     1500            manufacturers.1.!printers.1.!driver2 = ''
     1501            manufacturers.1.!printers.1.!remark2 = ''
     1502            manufacturers.0 = 1
     1503        END
     1504        ELSE
     1505            CALL GetCupsPrinters
     1506
     1507    END
    14421508
    14431509    CALL VRSet 'LB_BRAND',  'Painting', 0
     
    14641530    CALL VRSet 'LB_BRAND', 'Visible', 0
    14651531    CALL VRSet 'PB_NEXT',  'Enabled', 0
    1466     CALL VRSet 'WN_MAIN', 'StatusText', 'Selected printer: ' globals.!prt_nick
     1532    CALL NLSSetText 'WN_MAIN', 'StatusText', 29, globals.!prt_nick          /* 29: Selected printer:  %1 */
    14671533
    14681534    /* Resize LB_SELECT to the full width of GB_INFO */
     
    14761542    CALL VRSet 'WN_MAIN', 'Pointer', 'WAIT'
    14771543    IF globals.!cupsdir == '' THEN DO
    1478         CALL VRMethod 'LB_SELECT', 'AddString', 'Network printer (manual configuration)',, ''
     1544        CALL VRMethod 'LB_SELECT', 'AddString', NLSGetMessage( 34 ),, ''    /* 34: Network printer (manual configuration) */
    14791545        CALL VRSet    'LB_SELECT', 'Selected', 1
    14801546    END
     
    14921558    globals.!page = 3
    14931559    CALL VRSet 'EF_DESC', 'Value', globals.!prt_nick
     1560    CALL NLSSetText DT_NAME,     'Caption', 103             /* 103: Name: */
     1561    CALL NLSSetText DT_LOCATION, 'Caption', 105             /* 105: Location: */
     1562    CALL NLSSetText DT_DESC,     'Caption', 106             /* 106: Description: */
    14941563
    14951564    CALL VRMethod 'LB_SELECT', 'Clear'
     
    14981567    CALL VRSet 'GB_INFO',     'Visible', 1
    14991568    IF globals.!remotecups == '' THEN DO
    1500         CALL VRSet 'DT_INFO', 'Caption', 'Choose the printer name, and enter its location and a short description.'
     1569        CALL NLSSetText 'DT_INFO', 'Caption', 40        /* 40: Choose the printer name, and enter its location and a short description. */
    15011570        CALL VRSet 'DT_NAME',     'Visible', 1
    15021571        CALL VRSet 'EF_NAME',     'Visible', 1
     
    15051574    END
    15061575    ELSE
    1507         CALL VRSet 'DT_INFO', 'Caption', 'Enter a short description of this printer. ',
    1508                                          'This will be used for the printer object that appears on your desktop.'
     1576        CALL NLSSetText 'DT_INFO', 'Caption', 41        /* 41: Enter a short description of this printer.  This will be used for the printer object that appears on your desktop. */
    15091577    CALL VRSet 'DT_DESC',     'Visible', 1
    15101578    CALL VRSet 'EF_DESC',     'Visible', 1
     
    15271595/*:VRX         SW_ABOUT_Close
    15281596*/
    1529 SW_ABOUT_Close: 
     1597SW_ABOUT_Close:
    15301598    call SW_ABOUT_Fini
    15311599return
     
    15331601/*:VRX         SW_ABOUT_Create
    15341602*/
    1535 SW_ABOUT_Create: 
     1603SW_ABOUT_Create:
    15361604    call SW_ABOUT_Init
    15371605return
     
    15391607/*:VRX         SW_ABOUT_Fini
    15401608*/
    1541 SW_ABOUT_Fini: 
     1609SW_ABOUT_Fini:
    15421610    window = VRInfo( "Window" )
    15431611    call VRDestroy window
     
    15461614/*:VRX         SW_ABOUT_Init
    15471615*/
    1548 SW_ABOUT_Init:
    1549 
    1550     CALL VRSet 'DT_BOOTDRIVE',  'Caption', 'System boot volume:' TRANSLATE( globals.!bootdrv )
    1551     CALL VRSet 'DT_CUPSPATH',   'Caption', 'Local CUPS directory:' TRANSLATE( globals.!cupsdir )
    1552     CALL VRSet 'DT_REPOSITORY', 'Caption', 'Local driver repository:' TRANSLATE( globals.!repository )
     1616SW_ABOUT_Init:
     1617
     1618    CALL NLSSetText 'SW_ABOUT',  'Caption', 10                                          /* 10: Product Information */
     1619    CALL NLSSetText 'DT_ABOUT1', 'Caption', 11                                          /* 11: eCups Printer Install Utility */
     1620    CALL NLSSetText 'DT_ABOUT2', 'Caption', 12, '0.98'                                  /* 12: Version %1 */
     1621    CALL NLSSetText 'DT_ABOUT3', 'Caption', 13, '2010,2012'                             /* 13: (C) %1 Alex Taylor */
     1622    CALL NLSSetText 'PB_ABOUT',  'Caption', 2                                           /* 10: Product Information */
     1623
     1624    CALL NLSSetText 'DT_BOOTDRIVE',  'Caption', 14, TRANSLATE( globals.!bootdrv )       /* 14: System boot volume: %1 */
     1625    CALL NLSSetText 'DT_CUPSPATH',   'Caption', 15, TRANSLATE( globals.!cupsdir )       /* 15: Local CUPS directory: %1 */
     1626    CALL NLSSetText 'DT_REPOSITORY', 'Caption', 16, TRANSLATE( globals.!repository )    /* 16: Local driver repository: %1 */
    15531627
    15541628    window = VRInfo( "Object" )
     
    15841658SW_CREATE_Init:
    15851659
     1660    CALL NLSSetText 'SW_CREATE',  'Caption', 115                 /* 115: Confirm Create Printer */
     1661    CALL NLSSetText 'DT_CRMODEL', 'Caption', 102                 /* 102: Model: */
     1662    CALL NLSSetText 'DT_CRLOC',   'Caption', 105                 /* 105: Location: */
     1663    CALL NLSSetText 'DT_CRDESC',  'Caption', 106                 /* 106: Description: */
     1664
     1665    CALL NLSSetText 'CHK_CREATEPM', 'Caption',  109              /* 109: Create printer object */
     1666    CALL NLSSetText 'DT_PRESDRV',   'Caption',  110              /* 110: Presentation driver: */
     1667    CALL NLSSetText 'PB_CREATEOK',  'Caption',  111              /* 111: Create */
     1668    CALL NLSSetText 'PB_CREATECANCEL', 'Caption',  3             /* 3: Cancel */
     1669    CALL NLSSetText 'PB_CREATEHELP',   'Caption',  4             /* 4: ~Help */
     1670
    15861671    CALL VRSet 'EF_CRMODEL', 'Value', globals.!prt_nick
    15871672
     
    15911676         * that points to it.
    15921677         */
    1593         CALL VRSet 'DT_CREATE', 'Caption', 'Ready to create printer object with the following parameters.'
     1678        CALL NLSSetText 'DT_CREATE', 'Caption', 101             /* 101: Ready to create printer object with the following parameters. */
    15941679
    15951680        PARSE VAR globals.!remotecups cups_host cups_printer .
    1596         CALL VRSet 'DT_CRNAME',    'Caption', 'CUPS server:'
     1681        CALL NLSSetText 'DT_CRNAME', 'Caption', 107             /* 107: CUPS server: */
     1682        CALL NLSSetText 'DT_CRURI',  'Caption', 108             /* 108: CUPS queue:  */
     1683        CALL VRSet 'DT_CRLOC',     'Visible', 0
    15971684        CALL VRSet 'EF_CRNAME',    'Value',   cups_host
    1598         CALL VRSet 'DT_CRURI',     'Caption', 'CUPS queue:'
    15991685        CALL VRSet 'EF_CRURI',     'Value',   cups_printer
    1600         CALL VRSet 'DT_CRLOC',     'Visible', 0
    16011686        CALL VRSet 'EF_CRLOC',     'Visible', 0
    16021687        CALL VRSet 'CHK_CREATEPM', 'Visible', 0
    16031688    END
    16041689    ELSE DO
     1690        CALL NLSSetText 'DT_CREATE', 'Caption', 100             /* 100: Ready to create CUPS printer with the following parameters. */
     1691        CALL NLSSetText 'DT_CRNAME', 'Caption', 103             /* 103: Name: */
     1692        CALL NLSSetText 'DT_CRURI',  'Caption', 104             /* 104: URI: */
    16051693        CALL VRSet 'EF_CRNAME', 'Value', globals.!prt_name
    16061694        CALL VRSet 'EF_CRURI',  'Value', globals.!prt_port
     
    16201708        CALL VRSet 'DDCB_PRESDRV', 'Selected', def_idx
    16211709    END
    1622     ELSE DO
    1623         CALL VRMessage VRWindow(), 'No eCups-compatible OS/2 presentation drivers are installed.',
    1624                        '0d0a0d0a'x || 'Please install the ECUPS or ECUPS-HP printer driver before continuing.',,
    1625                        'Missing PM Driver', 'E'
     1710    ELSE DO                                             /* 112: No eCups-compatible OS/2 presentation drivers are installed. */
     1711                                                        /* 113: Please install the ECUPS or ECUPS-HP printer driver before continuing. */
     1712        CALL VRMessage VRWindow(),
     1713                       NLSGetMessage( 112 ) || '0d0a0d0a'x || NLSGetMessage( 113 ),, 
     1714                       NLSGetMessage( 114 ), 'E'                                        /* 114: Missing PM Driver */
    16261715        CALL VRSet 'PB_CREATEOK', 'Enabled', 0
    16271716    /* TODO give an error if no drivers were found */
     
    16641753SW_MODEL_Init:
    16651754
     1755    CALL NLSSetText 'SW_MODEL', 'Caption', 120                      /* 120: Select Printer Model */
     1756
    16661757    /* We should have a list of suggested printer models whose names at least
    16671758     * partially match the requested model, sorted in order with the closest
     
    16721763        CALL VRSet 'LB_OS2MODELS', 'Selected', best
    16731764
    1674     CALL VRSet 'DT_MODEL1', 'Caption',,
    1675                'The printer "'globals.!prt_nick'" could not be found in the'  ,
    1676                globals.!os2driver'.DRV driver under that name.  Please choose',
    1677                'the model of printer which will be reported to applications.'
     1765    CALL NLSSetText 'DT_MODEL1', 'Caption',,
     1766                    121, globals.!prt_nick, globals.!os2driver      /* 121: The printer "%1" could not ... to applications. */
     1767    CALL NLSSetText 'DT_MODEL2', 'Caption', 122                     /* 122: You can select one of ... use a generic driver. */
     1768
     1769    CALL NLSSetText 'PB_MODELOK',     'Caption', 2                  /* 2: OK */
     1770    CALL NLSSetText 'PB_MODELCANCEL', 'Caption', 3                  /* 3: Cancel */
    16781771
    16791772    CALL VRSet 'WN_MAIN', 'Pointer', '<default>'
     
    17121805SW_NETWORK_Init:
    17131806
     1807    CALL NLSSetText 'SW_NETWORK',   'Caption',  80    /* 80: Network Printer */
     1808    CALL NLSSetText 'DT_PROTOCOL',  'Caption',  81    /* 81: Network protocol: */
     1809    CALL NLSSetText 'DT_PASSWORD',  'Caption',  90    /* 90: Password: */
     1810    CALL NLSSetText 'PB_NETOK',     'Caption',  2     /* 2: OK */
     1811    CALL NLSSetText 'PB_NETCANCEL', 'Caption',  3     /* 3: Cancel */
     1812    CALL NLSSetText 'PB_NETHELP',   'Caption',  4     /* 4: ~Help */
     1813
    17141814    IF globals.!cupsdir == '' THEN DO
    17151815        protos.0 = 1
    1716         protos.1 = 'Existing CUPS printer (remote server)'
     1816        protos.1 = NLSGetMessage( 91 )              /* 91: Existing CUPS printer (remote server) */
    17171817        pnums.0 = 1
    17181818        pnums.1 = 5
     
    17201820    ELSE DO
    17211821        protos.0 = 5
    1722         protos.1 = 'Internet Printing Protocol (IPP)'
    1723         protos.2 = 'AppSocket/JetDirect'
    1724         protos.3 = 'Line Printer Remote daemon (LPD)'
    1725         protos.4 = 'Windows/SMB network'
    1726         protos.5 = 'Existing CUPS printer'
     1822        protos.1 = NLSGetMessage( 92 )              /* 92: Internet Printing Protocol (IPP) */
     1823        protos.2 = NLSGetMessage( 93 )              /* 93: AppSocket/JetDirect */
     1824        protos.3 = NLSGetMessage( 94 )              /* 94: Line Printer Remote daemon (LPD) */
     1825        protos.4 = NLSGetMessage( 95 )              /* 95: Windows/SMB network */
     1826        protos.5 = NLSGetMessage( 96 )              /* 96: Existing CUPS printer */
    17271827        pnums.0 = 5
    17281828        pnums.1 = 1
  • trunk/gui/printer/cupswiz/readme.1st

    r17 r18  
    11CUPSWIZ - CUPS printer-creation wizard
    2 Version 0.96
     2Version 0.98
    33
    44  This program is simple graphical front-end for creating CUPS-based printers
     
    109109  - The CUPS printer is always created with default job options.  If you want
    110110    to change them, you will have to do so from the CUPS administration GUI.
    111   - This program is currently available in English only.
    112111  - There is no help.
    113112  - There may well be undiscovered bugs; please report any you find.
  • trunk/gui/printer/cupswiz/todo

    r17 r18  
    44- Offer the option to show both simplified/expert drivers.
    55- Allow setting at least some basic job options like paper/colour/quality.
    6 - I18N support
Note: See TracChangeset for help on using the changeset viewer.