|
| 1 | +<?xml version="1.0" encoding="UTF-8"?> |
| 2 | +<Export generator="Cache" version="25"> |
| 3 | +<Class name="Form.Util.Translate"> |
| 4 | +<Description> |
| 5 | +Support for metadata translation </Description> |
| 6 | +<IncludeCode>Form</IncludeCode> |
| 7 | +<TimeCreated>64386,54065.171182</TimeCreated> |
| 8 | + |
| 9 | +<Method name="get"> |
| 10 | +<Description> |
| 11 | +Get translated value of a text |
| 12 | +w ##class(Form.Util.Translate).get()</Description> |
| 13 | +<ClassMethod>1</ClassMethod> |
| 14 | +<FormalSpec>text:%String</FormalSpec> |
| 15 | +<Implementation><![CDATA[ |
| 16 | + set domain = $$$domain |
| 17 | + set language="" |
| 18 | + |
| 19 | + if $isObject($g(%request)) { |
| 20 | + set language=$$MatchLanguage^%occMessages(%request.GetCgiEnv("HTTP_ACCEPT_LANGUAGE")) |
| 21 | + } |
| 22 | + |
| 23 | + set:language="" language = $s($mvv(58)="":"en",1:$mvv(58)) |
| 24 | + |
| 25 | + set id = $zcrc(text, 7) |
| 26 | + set text = $$$GetAppMessage(language, domain, id, text) |
| 27 | + set text = $zcvt(text, "O", "UTF8") |
| 28 | + quit text |
| 29 | +]]></Implementation> |
| 30 | +</Method> |
| 31 | + |
| 32 | +<Method name="insert"> |
| 33 | +<Description> |
| 34 | +Add text to ^CacheMsg |
| 35 | +do ##class(Form.Util.Translate).Insert()</Description> |
| 36 | +<ClassMethod>1</ClassMethod> |
| 37 | +<FormalSpec>text</FormalSpec> |
| 38 | +<Implementation><![CDATA[ |
| 39 | + set text = $$$quote(text) |
| 40 | + set domain = $$$domainq |
| 41 | + set a = $$macroText^%occMessages($lb(text, domain)) |
| 42 | +]]></Implementation> |
| 43 | +</Method> |
| 44 | +</Class> |
| 45 | +</Export> |
0 commit comments