[604] | 1 | RRCI18X ; 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.
|
---|
| 21 | V 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
|
---|
| 29 | M2EX(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 | ; ============
|
---|
| 47 | TEST ; 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 | ; ============
|
---|
| 64 | P2EX ; 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 | ; ============
|
---|
| 95 | PICK(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 | ; ============
|
---|
| 104 | SEND ; Resolve the String as being in DIALOG or add it.
|
---|
| 105 | N Y
|
---|
| 106 | I LC>30000 D NEWFILE U FILE
|
---|
| 107 | S Y=$G(^DI(.84,D0,2,1,0))
|
---|
| 108 | I $L(Y)>$L(X) S X=Y
|
---|
| 109 | W X_TB_TB_TB,!
|
---|
| 110 | S LC=LC+1
|
---|
| 111 | QUIT
|
---|
| 112 | ; ============
|
---|
| 113 | NEWFILE ; Close any current file (FILE) and then open a new file
|
---|
| 114 | N NM
|
---|
| 115 | S LC=0
|
---|
| 116 | I FILE'="" D ENDFILE ; Close the current file with an easily identifiable terminator
|
---|
| 117 | S FN=$G(FN)+1
|
---|
| 118 | S NM=$O(SET(""))
|
---|
| 119 | S:'$L(NM) NM="DIALOG"
|
---|
| 120 | S FILE="WV-"_NM_"-"_$TR($J(FN,4)," ","0")_".txt"
|
---|
| 121 | O FILE:NEW
|
---|
| 122 | U FILE
|
---|
| 123 | W "ENGLISH"_TB_"SPANISH"_TB,!
|
---|
| 124 | QUIT
|
---|
| 125 | ; ============
|
---|
| 126 | ENDFILE ; Load the Exclusion File from ^RRCTMP("I18","ODD",
|
---|
| 127 | N C,I
|
---|
| 128 | S C=$TR($J("",20)," ","#")
|
---|
| 129 | F I=1:1:5 W C_TB_C_TB_C_TB,!
|
---|
| 130 | C FILE
|
---|
| 131 | QUIT
|
---|
| 132 | ; ============
|
---|
| 133 | LOADX ; Load the Exclusion File from ^RRCTMP("I18","ODD",
|
---|
| 134 | N D0,DA,F,FN,X
|
---|
| 135 | S U="^"
|
---|
| 136 | S X="",F=$G(^WVDI(250.84,0))
|
---|
| 137 | S (DA,D0)=0
|
---|
| 138 | F S X=$O(^RRCTMP("I18","ODD",X)) Q:X="" D
|
---|
| 139 | . S DA=$O(^WVDI(250.84,"B",X,""))
|
---|
| 140 | . I DA="" S D0=$P(F,U,3)+1,$P(F,U,3,4)=D0_U_D0,DA=D0
|
---|
| 141 | . S ^WVDI(250.84,DA,0)=X,^WVDI(250.84,"B",X,DA)=""
|
---|
| 142 | .QUIT
|
---|
| 143 | S ^WVDI(250.84,0)=F
|
---|
| 144 | QUIT
|
---|
| 145 | ; ============
|
---|
| 146 |
|
---|