source: internationalization/trunk/p/RRCI18X.m@ 1326

Last change on this file since 1326 was 604, checked in by George Lilly, 15 years ago

Internationalization

File size: 4.4 KB
Line 
1RRCI18X ; Internationalization eXtractor to Excel and From Excel
2 ;RRCI18X V0.0001;;RCR/RCR/27MAY2004
3 ;Donated by Chris Richardson
4 ;Initial database design by Marcus Werner
5 ;Copyright 2008 WorldVistA. Licensed under the terms of the GNU
6 ;General Public License See attached copy of the License.
7 ;
8 ;This program is free software; you can redistribute it and/or modify
9 ;it under the terms of the GNU General Public License as published by
10 ;the Free Software Foundation; either version 2 of the License, or
11 ;(at your option) any later version.
12 ;
13 ;This program is distributed in the hope that it will be useful,
14 ;but WITHOUT ANY WARRANTY; without even the implied warranty of
15 ;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 ;GNU General Public License for more details.
17 ;
18 ;You should have received a copy of the GNU General Public License along
19 ;with this program; if not, write to the Free Software Foundation, Inc.,
20 ;51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21V QUIT
22 ; Note: Snapshot file .84 before this run so that
23 ; it might be restored completely.
24 ; LNG is the language to be loaded (is optional)
25 ; There are two major entry points to this routine;
26 ; M2EX^RRCI18X(LNG) Will generate a series of Excel Files (30,000 rows/file)
27 ; EX2M^RRCI18X(LNG) Will Load an Excel Sheet into the Dialog File
28 ; P2EX^RRCI18X Will scan the Package File and build a list
29M2EX(LNG) ; Load a series of excel loadable files from the Dialog File
30 N FILE,FN,LC,X,D0,TB,SET
31 S U="^",SET=""
32 S D0=0,FILE="",TB=$C(9)
33 S LC=600000,FN=-1
34 F S D0=$O(^DI(.84,D0)) Q:'D0 D
35 . S X=$P($G(^DI(.84,D0,0)),U,3)
36 . Q:X=""
37 . ;
38 . I $L(X," ")>1 D SEND Q ; At least one space
39 . I X?.E1PL.E D SEND Q ; At least some punctuation or lower case
40 . ;
41 . S ^RRCTMP("I18","ODD",X)=""
42 .QUIT
43 D ENDFILE
44 U 0
45 QUIT
46 ; ============
47TEST ; Load a series of excel loadable files from the Dialog File
48 N FILE,FN,LC,X,D0,TB
49 S U="^",SET=""
50 S D0=0,FILE="",TB=$C(9),EXIT=0
51 F D Q:EXIT
52 . S DIC=9.4,DIC(0)="AE"
53 . D ^DIC
54 . I Y>0 D Q
55 . . N K
56 . . S K=$P($G(^DIC(9.4,+Y,0)),U,2)
57 . . I $L(K) S SET(K)=""
58 . .QUIT
59 . ;
60 . S:(+Y)<0 EXIT=1
61 .QUIT
62 QUIT
63 ; ============
64P2EX ; Load a series of excel loadable files from the Dialog File
65 N FILE,FN,LC,X,D0,SET,TB
66 S U="^",SET=""
67 S D0=0,FILE="",TB=$C(9),EXIT=0
68 F D Q:EXIT
69 . S DIC=9.4,DIC(0)="AE"
70 . D ^DIC
71 . I Y>0 D Q
72 . . N K
73 . . S K=$P($G(^DIC(9.4,+Y,0)),U,2)
74 . . I $L(K) S SET(K)=""
75 . .QUIT
76 . ;
77 . S:(+Y)<0 EXIT=1
78 .QUIT
79 S LC=600000,FN=-1
80 F S D0=$O(^DI(.84,D0)) Q:'D0 D
81 . S X=$P($G(^DI(.84,D0,0)),U,3)
82 . Q:X=""
83 . ;
84 . D:$$PICK(D0,.SET)
85 . . I $L(X," ")>1 D SEND Q ; At least one space
86 . . I X?.E1PL.E D SEND Q ; At least some punctuation or lower case
87 . . ;
88 . . S ^RRCTMP("I18","ODD",X)=""
89 . .QUIT
90 .QUIT
91 D ENDFILE
92 U 0
93 QUIT
94 ; ============
95PICK(D,V) ; Find a member of the routines which matches
96 N T,P,J,L
97 S T=0,P=0
98 F S P=$O(^DI(.84,D,5,"B",P)) Q:P="" D Q:T
99 . S J=""
100 . F S J=$O(V(J)) Q:J="" S L=$L(J) I $E(P,1,L)=J S T=1 Q
101 .QUIT
102 QUIT T
103 ; ============
104SEND ; Resolve the String as being in DIALOG or add it.
105 N Y
106 ; I LC>30000 D NEWFILE U FILE
107 I LC>300 D NEWFILE U FILE
108 S Y=$G(^DI(.84,D0,2,1,0))
109 I $L(Y)>$L(X) S X=Y
110 W X_TB_TB_TB,!
111 S LC=LC+1
112 QUIT
113 ; ============
114NEWFILE ; Close any current file (FILE) and then open a new file
115 N NM
116 S LC=0
117 I FILE'="" D ENDFILE ; Close the current file with an easily identifiable terminator
118 S FN=$G(FN)+1
119 S NM=$O(SET(""))
120 S:'$L(NM) NM="DIALOG"
121 S FILE="WV-"_NM_"-"_$TR($J(FN,4)," ","0")_".txt"
122 O FILE:NEW
123 U FILE
124 ; W "ENGLISH"_TB_"SPANISH"_TB,!
125 W "English"_TB_"French"_TB_"Notes"_TB_"Complete/Exclude",!
126 QUIT
127 ; ============
128ENDFILE ; Load the Exclusion File from ^RRCTMP("I18","ODD",
129 N C,I
130 S C=$TR($J("",20)," ","#")
131 F I=1:1:5 W C_TB_C_TB_C_TB,!
132 C FILE
133 QUIT
134 ; ============
135LOADX ; Load the Exclusion File from ^RRCTMP("I18","ODD",
136 N D0,DA,F,FN,X
137 S U="^"
138 S X="",F=$G(^WVDI(250.84,0))
139 S (DA,D0)=0
140 F S X=$O(^RRCTMP("I18","ODD",X)) Q:X="" D
141 . S DA=$O(^WVDI(250.84,"B",X,""))
142 . I DA="" S D0=$P(F,U,3)+1,$P(F,U,3,4)=D0_U_D0,DA=D0
143 . S ^WVDI(250.84,DA,0)=X,^WVDI(250.84,"B",X,DA)=""
144 .QUIT
145 S ^WVDI(250.84,0)=F
146 QUIT
147 ; ============
148
Note: See TracBrowser for help on using the repository browser.