-
Notifications
You must be signed in to change notification settings - Fork 7
/
intl.prg
5266 lines (4553 loc) · 146 KB
/
intl.prg
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
* Program...........: intl.prg
#DEFINE ccProgramName "Steven Black's INTL Toolkit for Visual FoxPro"
* Version...........:
#DEFINE ccMajorVersion "1"
#DEFINE ccMinorVersion "0"
#DEFINE ccPatchVersion "0"
#DEFINE ccDate "October 24, 2019"
* Author............: Steven Black
* Project...........: INTL for Visual FoxPro
* Repository........: https://github.com/StevenBlack/intl/
* Created...........: 04/30/93
* Copyright.........: (c) Steven Black Consulting 1993-2019
* License...........: MIT
* Description.......: Multilingual Visual FoxPro tools and classes
*
* Calling Samples...:
*
* Visual FoxPro
* =============
* * Forms:
*
* SET PROC TO INTL ADDITIVE
*
* _SCREEN.ADDOBJECT( "oINTL", "INTL", "German")
* _SCREEN.oINTL.Localize( thisform )
* ...
* _SCREEN.oINTL.SetLanguage( "Spanish")
* _SCREEN.oINTL.Localize( thisform )
* ...
* _SCREEN.oINTL.Localize( thisform, "French")
* ....
*
* * Menus: Called by GENMENUX as follows:
* 1. _GENMENU=<path>\GENMENUX.PRG
* 2. "*:MNXDRV2 INTL" in menu setup snippet
* or with "_MNXDRV2=INTL" in CONFIG.FPx
*
*-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
*******************************************************************************
*-- Default language behavior
*******************************************************************************
*-- cMylang must be PROPER()!
*-- Change this #DEFINE as appropriate
#DEFINE ccDefaultLanguage "Original"
#DEFINE ccDefaultLanguageField "c"+ ccDefaultLanguage
#DEFINE ccDefaultLocale "Default"
#DEFINE ccDefaultStringsTable "STRINGS.DBF"
#DEFINE ccMyLang "English"
#DEFINE ccMyLocale "Default"
#DEFINE clDefaultRightToLeft .F.
*******************************************************************************
*-- Timing behavior
*******************************************************************************
*? Note: Visual INTL is Run=Time only
#DEFINE cLocalize "Run"
* #DEFINE cLocalize "Generate"
*******************************************************************************
*-- String resource limit
*******************************************************************************
*-- Width of the localized string fields in STRINGS -- used when INTL needs
*-- to create thr STRINGS.DBF table
#DEFINE cnStringWidth "120"
*******************************************************************************
*-- Mapping properties to classes
*******************************************************************************
*? When VFP gets better at array-member speed, encoding
*? the following into structures may be best. However, for now...
*? Note: No changes for 5.0 from 3.0
#DEFINE ccBoundColumns "COMBOBOX LISTBOX "
#DEFINE ccCaptions "CHECKBOX COMMANDBUTTON FORM HEADER LABEL "+ ;
"OPTIONBUTTON PAGE TOOLBAR "
#DEFINE ccContainers "COLUMN COMMANDGROUP CONTAINER CUSTOM FORM "+;
"FORMSET GRID OPTIONGROUP PAGE PAGEFRAME TOOLBAR "
#DEFINE ccControlSources "COLUMN COMBOBOX EDITBOX SPINNER TEXTBOX "
#DEFINE ccCurrencies "EDITBOX SPINNER TEXTBOX "
#DEFINE ccDisabledPictures "CHECKBOX COMMANDBUTTON OPTIONBUTTON "
#DEFINE ccDownPictures "COMMANDBUTTON OPTIONBUTTON "
#DEFINE ccDragIcons "CHECKBOX COMBOBOX COMMANDBUTTON COMMANDGROUP "+ ;
"CONTAINER CONTROL EDITBOX GRID IMAGE "+ ;
"LABEL LISTBOX OPTIONBUTTON OPTIONGROUP " + ;
"PAGE SHAPE SPINNER TEXTBOX "
#DEFINE ccDynamicFonts "COLUMN "
#DEFINE ccFonts "CHECKBOX COLUMN COMBOBOX COMMANDBUTTON EDITBOX "+ ;
"FORM GRID HEADER LABEL LISTBOX OPTIONBUTTON "+ ;
"PAGE SPINNER TEXTBOX "
#DEFINE ccHelp "CHECKBOX COMBOBOX COMMANDBUTTON COMMANDGROUP "+ ;
"EDITBOX FORM GRID IMAGE LABEL LINE LISTBOX "+ ;
"OLEBOUNDCONTROL OLECONTAINER OPTIONBUTTON "+ ;
"OPTIONGROUP PAGE SHAPE SPINNER TEXTBOX TOOLBAR "
#DEFINE ccIcons "FORM "
*?///////////////////////////////////////////////////////////////////////////
*? Performance note: For slightly better performance, Comment the line below
*? if your application isn't destined for Hebrew or Arabic localizations
#DEFINE ccHebrewArabic "<<=== COMMENT ME FOR BETTER PREFORMANCE"
#IFDEF ccHebrewArabic
#DEFINE ccIgnoreables "DATAENVIRONMENT " + ;
"FORMSET "
#DEFINE ccNoRightToLeft "FORM FORMSET PAGE CUSTOM TOOLBAR "
#ELSE
#DEFINE ccIgnoreables "COMMANDGROUP DATAENVIRONMENT OPTIONGROUP " + ;
"FORMSET LINE PAGEFRAME "
#ENDIF
*?////////////////////////////////////////////////////////////////////////////
#DEFINE ccInputMasks "SPINNER TEXTBOX "
#DEFINE ccPictures "CHECKBOX COMBOBOX COMMANDBUTTON CONTROL "+ ;
"FORM IMAGE LISTBOX OPTIONBUTTON PAGE "
#DEFINE ccRecordSources "GRID "
#DEFINE ccRowSources "COMBOBOX LISTBOX "
#DEFINE ccStatusBarTexts "CHECKBOX COMBOBOX COMMANDBUTTON EDITBOX GRID "+ ;
"LISTBOX OPTIONBUTTON SPINNER TEXTBOX "
#DEFINE ccToolTips "CHECKBOX COMBOBOX COMMANDBUTTON EDITBOX GRID "+ ;
"LISTBOX OPTIONBUTTON SHAPE SPINNER TEXTBOX "
*******************************************************************************
*-- Mapping classes to broad categories
*******************************************************************************
#DEFINE ccCaptionObjects ccCaptions+ ccToolTips+ ccStatusBarTexts
#DEFINE ccDataObjects ccBoundColumns+ ccControlSources+ ccInputMasks+ ;
ccRowSources+ ccRecordSources
#DEFINE ccPictureObjects ccDisabledPictures+ ccDownPictures+ ccDragIcons+ ;
ccIcons+ ccPictures
*******************************************************************************
*-- Mapping default strategies to generic engines
*******************************************************************************
#DEFINE INTERFACE_UNKNOWN "Unknown"
#DEFINE IID_ABSTRACT "cINTLAbstract"
#DEFINE IID_MEMENTO "cINTLMemento"
#DEFINE IID_DECORATOR "cINTLDecorator"
#DEFINE IID_INTL "Intl"
#DEFINE IID_STRING_STRATEGY "cINTLString"
#DEFINE IID_CURRENCY_STRATEGY "cINTLCurrency"
#DEFINE IID_PICTURE_STRATEGY "cINTLPicture"
#DEFINE IID_DATA_STRATEGY "cINTLData"
#DEFINE IID_RIGHTTOLEFT_STRATEGY "cINTLRightToLeft"
#DEFINE MEMENTO_ELEMENTS 5
*******************************************************************************
*-- Operational helpers
*******************************************************************************
#DEFINE INTL_HOOK_TEST ! ISNULL( this.oHook) AND ;
TYPE ("this.oHook.INTL_Abstract_ID") <> "U"
*******************************************************************************
*-- Parameters
*******************************************************************************
*-- Three parameters max, primarily to resolve any conflicts arising from
*-- parametric GENMENUX procedure calls.
PARAMETERS txParam1, txParam2, txParam3
*******************************************************************************
*-- Link resolution
*******************************************************************************
*-- These following functions exist in GENMENUX, which is
*-- in the calling stack when these are invoked.
EXTERNAL ARRAY ConfigFp, WordSearch, laObj
*******************************************************************************
*-- GENMENUX hook-out
*******************************************************************************
*-- Are we under GENMENUX? If so, invoke the GENMENUX menu
*-- localization procedure.
IF TYPE( "m.lMprDrv2")<> "U"
=IntlMenu()
RETURN
ENDIF
RETURN
*//////////////////////////////////////////////////////////////////////////////
* CLASS....: c I N T L A b s t r a c t
* Purpose..: This class serves to define the interface for the whole INTL class
* hierarchy. Not designed to be instantiated directly.
* Version..: March 25 1996
*//////////////////////////////////////////////////////////////////////////////
DEFINE CLASS cINTLAbstract AS Line
*-- Abstract Properties
oLogicalParent = NULL
oHook = NULL
*-- Exposed Properties
INTL_Abstract_ID = "Visual INTL" && Class signature, don't change.
Name = "cINTLAbstract" && Identifyer, don't change.
*-- Protected Properties
PROTECTED Visible, cMajorVersion, cMinorVersion, cPatchVersion, cDate
cMajorVersion = ccMajorversion
cMinorVersion = ccMinorVersion
cPatchVersion = ccPatchVersion
cDate = ccDate
cType = "Abstract"
Visible = .F.
*-- Concrete methods
*====================================
*-- cINTLAbstract::GetLogicalParent()
*====================================
* Returns the logical parent.
* Not Hooked
*
FUNCTION GetLogicalParent()
RETURN this.oLogicalParent
*====================================
*-- cINTLAbstract::GetHook()
*====================================
* Returns an object reference to the hook member.
* Not Hooked
*
FUNCTION GetHook()
RETURN this.oHook
*====================================
*-- cINTLAbstract::GetType()
*====================================
* Returns the object's type
* Not Hooked
*
FUNCTION GetType()
RETURN this.cType
*====================================
*-- cINTLAbstract::IsINTLClass( o )
*====================================
* Returns logical true if the passed parameter
* is an object of the INTL Class.
* Not hookable.
*
FUNCTION IsINTLClass( toPassed )
RETURN TYPE( "toPassed.INTL_Abstract_ID" )<> "U"
*====================================
*-- cINTLAbstract::SetLogicalParent( o )
*====================================
* Sets the logical parent property of a
* given INTL object.
* Not hookable.
*
FUNCTION SetLogicalParent( toParent )
LOCAL llRetval
llRetVal = .F.
IF ISNULL( toParent )
this.oLogicalparent = NULL
llRetVal = .T.
ENDIF
IF !llRetVal AND TYPE( "toParent" ) = "O"
this.oLogicalparent = toParent
llRetVal = .T.
ENDIF
RETURN llRetVal
*-- Abstract methods
*====================================
*-- cINTLAbstract::AdornMemento( o )
*====================================
* Puts an INTL memento in oMementoHolder
* Not Hookable
*
FUNCTION AdornMemento( oMementoHolder )
RETURN NULL
*====================================
*-- cINTLAbstract::alang( a )
*====================================
* Fills an array with the currently supported languages.
* Hookable.
*
FUNCTION aLang( taArray )
IF INTL_HOOK_TEST
RETURN this.oHook.alang( @taArray )
ELSE
RETURN NULL
ENDIF
*====================================
*-- cINTLAbstract::aStrat( an )
*====================================
* Fills an array with the names of the loaded strategies
* in their execution order.
* Hookable.
*
FUNCTION aStrat( taArray, tnType )
IF INTL_HOOK_TEST
RETURN this.oHook.aStrat( @taArray, @tnType )
ELSE
RETURN NULL
ENDIF
*====================================
*-- cINTLAbstract::CreateStrategyCDX
*====================================
* Rebuild the strategy's resource index.
* Hookable.
*
FUNCTION CreateStrategyCDX()
IF INTL_HOOK_TEST
RETURN this.oHook.CreateStrategyCDX()
ELSE
RETURN NULL
ENDIF
*====================================
*-- cINTLAbstract::CreateStrategyTable( c )
*====================================
FUNCTION CreateStrategyTable( tcPassed )
* Creates the strategy's resource table
* Hookable.
*
IF INTL_HOOK_TEST
RETURN this.oHook.CreateStrategyTable( @tcPassed )
ELSE
RETURN NULL
ENDIF
*====================================
*-- cINTLAbstract::GetAlias()
*====================================
* Return the resource alias, if applicable
* Hookable.
*
FUNCTION GetAlias()
IF INTL_HOOK_TEST
RETURN this.oHook.GetAlias()
ELSE
RETURN NULL
ENDIF
*====================================
*-- cINTLAbstract::Execute( xx )
*====================================
* Execute this object's primitive assignment
* Hookable.
*
FUNCTION Execute( lxPassedn, txPassed2 )
IF INTL_HOOK_TEST
RETURN this.oHook.Execute( @lxPassed, @txPassed2 )
ELSE
RETURN NULL
ENDIF
*====================================
*-- cINTLAbstract::GetConfig()
*====================================
FUNCTION GetConfig()
* Return configuration integer
* Hookable.
*
IF INTL_HOOK_TEST
RETURN this.oHook.GetConfig()
ELSE
RETURN NULL
ENDIF
*====================================
*-- cINTLAbstract::GetConversion( cxx )
*====================================
* Return a conversion factor
* Hookable.
*
FUNCTION GetConversion( tcLocale, txOther1, txOther2 )
IF INTL_HOOK_TEST
RETURN this.oHook.GetConversion( @tcLocale, @txOther1, @txOther2 )
ELSE
RETURN NULL
ENDIF
*====================================
*-- cINTLAbstract::GetExplicit()
*====================================
* Return the current explicit mode setting.
* Hookable.
*
FUNCTION GetExplicit()
IF INTL_HOOK_TEST
RETURN this.oHook.GetExplicit()
ELSE
RETURN NULL
ENDIF
*====================================
*-- cINTLAbstract::GetLanguage()
*====================================
* Return the current localization language
* Hookable.
*
FUNCTION GetLanguage()
IF INTL_HOOK_TEST
RETURN this.oHook.GetLanguage()
ELSE
RETURN NULL
ENDIF
*====================================
*-- cINTLAbstract::GetLocale()
*====================================
* Return the current localization locale
* Hookable.
*
FUNCTION GetLocale()
IF INTL_HOOK_TEST
RETURN this.oHook.GetLocale()
ELSE
RETURN NULL
ENDIF
*====================================
*-- cINTLAbstract::GetRightToLeft()
*====================================
* Return the current Right To Left localization setting
* Hookable.
*
FUNCTION GetRightToLeft()
IF INTL_HOOK_TEST
RETURN this.oHook.GetRightToLeft()
ELSE
RETURN NULL
ENDIF
*====================================
*-- cINTLAbstract::GetStrategy( cx )
*====================================
* Return a strategy object for a given strategy alias
* Hookable.
*
FUNCTION GetStrategy( tcService, txOther )
IF INTL_HOOK_TEST
RETURN this.oHook.GetStrategy( @tcService, @txOther )
ELSE
RETURN NULL
ENDIF
*====================================
*-- cINTLAbstract::GetStrategyClass( c )
*====================================
* Return the strategy class of a given strategy alias
* Hookable.
*
FUNCTION GetStrategyClass( tcService )
IF INTL_HOOK_TEST
RETURN this.oHook.GetStrategyClass( @tcService )
ELSE
RETURN NULL
ENDIF
*====================================
*-- cINTLAbstract::GetTable()
*====================================
* Return the table for this object
* Hookable.
*
FUNCTION GetTable()
IF INTL_HOOK_TEST
RETURN this.oHook.GetTable()
ELSE
RETURN NULL
ENDIF
*====================================
*-- cINTLAbstract::GetUpdateMode()
*====================================
* Return the current update mode setting
* Hookable.
*
FUNCTION GetUpdateMode()
IF INTL_HOOK_TEST
RETURN this.oHook.GetUpdateMode()
ELSE
RETURN NULL
ENDIF
*====================================
*-- cINTLAbstract::I()
*====================================
* Localize the passed object
* Hookable.
*
FUNCTION I( txpara1, tcSpecialProc )
IF INTL_HOOK_TEST
RETURN this.oHook.I( @txpara1, @tcSpecialProc )
ELSE
RETURN NULL
ENDIF
*====================================
*-- cINTLAbstract::Init()
*====================================
*
FUNCTION Init( txPara1, txPara2, txPara3 )
RETURN
*====================================
*-- cINTLAbstract::IsValidLanguage()
*====================================
* Hookable.
*
FUNCTION IsValidLanguage( tcLanguage )
IF INTL_HOOK_TEST
RETURN this.oHook.IsValidLanguage( @tcLanguage )
ELSE
RETURN NULL
ENDIF
*====================================
*-- cINTLAbstract::IsInResource(x )
*====================================
* Hookable.
*
FUNCTION IsInResource( txElement )
IF INTL_HOOK_TEST
RETURN this.oHook.IsInResource( txElement )
ELSE
RETURN NULL
ENDIF
*====================================
*-- cINTLAbstract::LoadStrategies()
*====================================
* Not Hooked
*
FUNCTION LoadStrategies()
RETURN NULL
*====================================
*-- cINTLAbstract::Localize( xx )
*====================================
FUNCTION Localize( txPara1, txPara2 )
IF INTL_HOOK_TEST
RETURN this.oHook.Localize( @txPara1, @txPara2 )
ELSE
RETURN NULL
ENDIF
*====================================
*-- cINTLAbstract::LoopOut( o )
*====================================
*
FUNCTION LoopOut( toPara1 )
IF INTL_HOOK_TEST
RETURN this.oHook.LoopOut( @toPara1 )
ELSE
RETURN NULL
ENDIF
*====================================
*-- cINTLAbstract::Mov( on )
*====================================
* Not Hooked
*
FUNCTION Mov( toPassed, tnStackLevel )
RETURN NULL
*====================================
*-- cINTLAbstract::objArray( oa )
*====================================
* Not Hooked: Traverses an object hierarchy
* and fills a passed array with object references.
*
FUNCTION objArray( toPassedObject, taPassedArray )
RETURN NULL
*====================================
*-- cINTLAbstract::OpenStrategy( cc )
*====================================
* Open a particular strategy
* Hookable.
*
FUNCTION OpenStrategy( tcFile, tcOptions )
IF INTL_HOOK_TEST
RETURN this.oHook.OpenStrategy( @tcFile, @tcOptions )
ELSE
RETURN NULL
ENDIF
*====================================
*-- cINTLAbstract::Pitch()
*====================================
* Not Hooked
*
FUNCTION Pitch()
RETURN NULL
*====================================
*-- cINTLAbstract::Pop()
*====================================
* Not Hooked
*
FUNCTION Pop( toPassed )
RETURN NULL
*====================================
*-- cINTLAbstract::Push()
*====================================
* Not Hooked
*
FUNCTION Push( toPassed )
RETURN NULL
*====================================
*-- cINTLAbstract::QueryInterface()
*====================================
* Not Hooked
*
FUNCTION QueryInterface( IID, oInterface )
RETURN NULL
*====================================
*-- cINTLAbstract::Release()
*====================================
* Not Hooked
*
FUNCTION Release()
IF INTL_HOOK_TEST
this.oHook.Release()
ENDIF
RELEASE This
*====================================
*-- cINTLAbstract::ResourceInsert( x )
*====================================
* Hookable.
*
FUNCTION ResourceInsert( txPassed )
IF INTL_HOOK_TEST
RETURN this.oHook.ResourceInsert( @txPassed )
ELSE
RETURN NULL
ENDIF
*====================================
*-- cINTLAbstract::SetAlias( c )
*====================================
* Hookable.
*
FUNCTION SetAlias( tcAlias )
IF INTL_HOOK_TEST
RETURN this.oHook.SetAlias( @tcAlias )
ELSE
RETURN NULL
ENDIF
*====================================
*-- cINTLAbstract::SetConfig( x )
*====================================
* Hookable.
*
FUNCTION SetConfig( txPara1 )
IF INTL_HOOK_TEST
RETURN this.oHook.SetConfig( @txPara1 )
ELSE
RETURN NULL
ENDIF
*====================================
*-- cINTLAbstract::SetConversion( cnx )
*====================================
* Hookable.
*
FUNCTION SetConversion( tcLocale, tnFactor, txOther )
IF INTL_HOOK_TEST
RETURN this.oHook.SetConversion( @tcLocale, @tnFactor, @txOther )
ELSE
RETURN NULL
ENDIF
*====================================
*-- cINTLAbstract::SetDefaults()
*====================================
* Hookable.
*
FUNCTION SetDefaults()
IF INTL_HOOK_TEST
RETURN this.oHook.SetDefaults()
ELSE
RETURN NULL
ENDIF
*====================================
*-- cINTLAbstract::SetExplicit( l )
*====================================
* Hookable.
*
FUNCTION SetExplicit( tlSetting )
IF INTL_HOOK_TEST
RETURN this.oHook.SetExplicit( @tlSetting )
ELSE
RETURN NULL
ENDIF
*====================================
*-- cINTLAbstract::SetLanguage( cc )
*====================================
* Hookable.
*
FUNCTION SetLanguage( tcLanguage, txPassed1 )
IF INTL_HOOK_TEST
RETURN this.oHook.SetLanguage( @tcLanguage, @txPassed1 )
ELSE
RETURN NULL
ENDIF
*====================================
*-- cINTLAbstract::SetLocale( c )
*====================================
* Hookable.
*
FUNCTION SetLocale( tcLocale )
IF INTL_HOOK_TEST
RETURN this.oHook.SetLocale( @tcLocale )
ELSE
RETURN NULL
ENDIF
*====================================
*-- cINTLAbstract::SetHook( x )
*====================================
* Hookable.
*
FUNCTION SetHook( txPassed )
IF INTL_HOOK_TEST
RETURN this.oHook.SetHook( @txPassed )
ELSE
RETURN NULL
ENDIF
*====================================
*-- cINTLAbstract::SetRightToLeft( l )
*====================================
* Hookable.
*
FUNCTION SetRightToLeft( tlSetting )
IF INTL_HOOK_TEST
RETURN this.oHook.SetRightToLeft( @tlSetting )
ELSE
RETURN NULL
ENDIF
*====================================
*-- cINTLAbstract::SetStrategy( cx )
*====================================
* Hookable.
*
FUNCTION SetStrategy( tcService, txClass )
IF INTL_HOOK_TEST
RETURN this.oHook.SetStrategy( @tcService, @txClass )
ELSE
RETURN NULL
ENDIF
*====================================
*-- cINTLAbstract::SetStrategyClass( cc )
*====================================
* Hookable.
*
FUNCTION SetStrategy( tcService, tcClass )
IF INTL_HOOK_TEST
RETURN this.oHook.SetStrategyClass( @tcService, @tcClass )
ELSE
RETURN NULL
ENDIF
*====================================
*-- cINTLAbstract::SetTable( c )
*====================================
* Hookable.
*
FUNCTION SetTable( tcFile )
IF INTL_HOOK_TEST
RETURN this.oHook.SetTable( @tcFile )
ELSE
RETURN NULL
ENDIF
*====================================
*-- cINTLAbstract::SetUpdateMode( l )
*====================================
* Hookable.
*
FUNCTION SetUpdateMode( tlTurnOn )
IF INTL_HOOK_TEST
RETURN this.oHook.SetUpdateMode( @tlTurnOn )
ELSE
RETURN NULL
ENDIF
*====================================
*-- cINTLAbstract::GetVersion( x )
*====================================
* NotHookable.
*
FUNCTION GetVersion( txPassed )
RETURN ccProgramName + " " + this.cMajorVersion + "." + this.cMinorVersion + "." + this.cPatchVersion + " " + this.cDate
*====================================
*-- cINTLAbstract::UpdateResource( xx )
*====================================
* Hookable.
*
FUNCTION UpdateResource( txPassed, txLocation )
IF INTL_HOOK_TEST
RETURN this.oHook.UpdateResource( @txPassed, @txLocation )
ELSE
RETURN NULL
ENDIF
ENDDEFINE
*//////////////////////////////////////////////////////////////////////////////
* CLASS....: c I N T L M e m e n t o
* Purpose..: This class serves as the parent class for most INTL classes and,
* among other things, accesses protected properties.
* Version..: March 25 1996
*//////////////////////////////////////////////////////////////////////////////
DEFINE CLASS cINTLMemento AS cINTLAbstract
*-- Exposed Properties
Name = "cINTLMemento"
cLang = NULL
cLocale = NULL
oCurrencyStrategy = NULL
oDataStrategy = NULL
oFontStrategy = NULL
oHook = NULL
oPictureStrategy = NULL
oStringStrategy = NULL
oRightToLeftStrategy = NULL
DIMENSION Languages[1]
languages[1] = NULL
DIMENSION aStrategies[1, 2]
aStrategies[1] = NULL
*-- Protected Properties
* PROTECTED ARRAY a_Stack[1, MEMENTO_ELEMENTS]
DIMENSION a_Stack[1, MEMENTO_ELEMENTS]
a_Stack[1] = NULL
PROTECTED ;
cCurrencyStrategy , ;
cDataStrategy , ;
cFontStrategy , ;
cLang , ;
cLocale , ;
cStringStrategy , ;
cRightToLeftStrategy, ;
cType , ;
lExplicit , ;
lRightToLeft , ;
nDefaultConfig
cType = "Memento"
nConfig = NULL
*-- Connaisance alert: In this problem domain, there
*-- are many elements that one can reasonably expect.
*-- Here they are, references stored in domain-specific
*-- properties, there for the asking.
cCurrencyStrategy = NULL
cDataStrategy = NULL
cFontStrategy = NULL
cLang = NULL
cLocale = NULL
cStringStrategy = NULL
cRightToLeftStrategy = NULL
lExplicit = NULL
lRightToLeft = NULL
nDefaultConfig = NULL
*====================================
*-- cINTLMemento::Init( [o])
*====================================
*
FUNCTION Init( toPrototype, txPassed2, txPassed3 )
IF this.IsINTLClass( toPrototype )
*-- Grab properties from the prototype
toPrototype.Mov( This )
ELSE
*-- Configure properties to default values
this.SetDefaults()
ENDIF
RETURN
*====================================
*-- cINTLMemento::aStrat( an )
*====================================
* This function, like all VFP "a" finctions,
* loads an array, in this case an array of
* supported localization strategies.
*
* n=0: Standard 1- D array of strategy names
* n=1: 2- D array, strategy names and pointers
* n=2: 2- D array, strategy names and config integers
*
FUNCTION aStrat( taArray, tnArrayType )
*-- Reject null parameters
IF ISNULL( taArray) OR ISNULL( tnArrayType )
RETURN NULL
ENDIF
LOCAL lnRetVal, lnI
lnRetVal = 0
IF TYPE( "taArray[1]" ) = "U"
RETURN lnRetVal
ENDIF
IF EMPTY( tnArrayType) OR ;
TYPE( "tnArrayType" )<> "N"
tnArrayType = 0
ENDIF
DO CASE
*-- Standard 1- D array of strategy names
CASE tnArrayType = 0
FOR lnI = 1 TO ALEN( this.aStrategies, 1 )
IF this.IsINTLClass( this.aStrategies[lnI, 2])
lnRetVal = lnRetVal+ 1
DIMENSION taArray[lnRetVal]
taArray[lnRetval] = this.aStrategies[lnI, 1]
ENDIF
ENDFOR
*-- 2- D array, strategy names and pointers
CASE tnArrayType = 1
FOR lnI = 1 TO ALEN( this.aStrategies, 1 )
IF this.IsINTLClass( this.aStrategies[lnI, 2])
lnRetVal = lnRetVal+ 1
DIMENSION taArray[lnRetVal, 2]
taArray[lnRetval, 1] = this.aStrategies[lnI, 1]
taArray[lnRetval, 2] = this.aStrategies[lnI, 2]
ENDIF
ENDFOR
*-- 2- D array, strategy names and config integers
CASE tnArrayType = 2
FOR lnI = 1 TO ALEN( this.aStrategies, 1 )
lnRetVal = lnRetVal+ 1
DIMENSION taArray[lnRetVal, 2]
taArray[lnRetval, 1] = this.aStrategies[lnI, 1]
IF this.IsINTLClass( this.aStrategies[lnI, 2])
taArray[lnRetval, 2] = this.aStrategies[lnI, 2].GetConfig()
ELSE
taArray[lnRetval, 2] = this.aStrategies[lnI, 2]
ENDIF
ENDFOR
ENDCASE
RETURN lnRetVal
*====================================
*-- cINTLMemento::AdornMemento( [o])
*====================================
* Puts an INTL cookie into the passed object...
*
FUNCTION AdornMemento( oMementoHolder )
* ... if it can hold one.
IF TYPE( "oMementoHolder.BaseClass" )<>"U" AND ;
( oMementoHolder.Baseclass == "Form" OR ;
oMementoHolder.Baseclass == "Page" OR ;
oMementoHolder.Baseclass == "Toolbar" )
IF TYPE( "oMementoHolder.oINTLMemento" )<> "O"
oMementoHolder.AddObject( "oINTLMemento", "cINTLMemento" )
ELSE
*-- Make SURE it is of class INTL
IF ! this.IsINTLClass( oMementoHolder.oINTLMemento )
oMementoHolder.oINTLMemento = CREATE( "cINTLMemento" )
ENDIF
ENDIF
ELSE
RETURN NULL
ENDIF
this.Mov( oMementoHolder.oINTLMemento )
RETURN oMementoHolder.oINTLMemento
*====================================
*-- cINTLMemento::GetConfig()
*====================================
* Return the configuration integer
*