-
Notifications
You must be signed in to change notification settings - Fork 7
/
RexCat.sd
41 lines (28 loc) · 1.14 KB
/
RexCat.sd
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
##rem $Id: RexCat.sd,v 2.1 2010/02/11 18:46:51 AmigaPhil $
##stringtype None
/* - Locale support in ARexx (RexCat) - %b
REMOVE THE tls() AND gettlstext() FUNCTIONS FROM YOUR SCRIPT, IF ANY;
AND COPY/PASTE THE NEWER FUNCTIONS BELOW THIS LINE INSTEAD.
(Note: You need to replace these functions each time you update your
script and the Catalog Description is modified.)
--------------------------------------------------------------------- */
/* (RexCat) Function which translates the strings */
tls: PROCEDURE EXPOSE tlstext.
PARSE ARG instring
IF instring = '' THEN RETURN instring
IF LENGTH(instring) > 250 THEN instring = LEFT(instring,250)
XID = "XID_" || C2X(instring)
IF tlstext.XID == 'TLSTEXT.' || XID THEN RETURN instring
IF tlstext.XID = '' THEN RETURN instring
RETURN tlstext.XID
/* (RexCat) Function to load the translation file */
gettlstext: PROCEDURE EXPOSE tlstext.
IF ~SHOW('L',"locale.library") THEN
IF ~ADDLIB("locale.library",0,-30) THEN RETURN 0
cat = OPENCATALOG("%b.catalog","%l",%v)
IF cat = 0 THEN DO
CALL CLOSECATALOG(cat)
RETURN 0
END
tlstext.%i=GETCATALOGSTR(cat,%d,"")
RETURN 1