Skip to content

Commit

Permalink
Added /info request
Browse files Browse the repository at this point in the history
  • Loading branch information
eduard93 committed Apr 14, 2017
1 parent 01887d6 commit 85a0d81
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
12 changes: 12 additions & 0 deletions Form/REST/Main.cls.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
<Route Url="/logout" Method="GET" Call="logout"/>
<Route Url="/test" Method="GET" Call="test"/>
<Route Url="/info" Method="GET" Call="info"/>
</Routes>
]]></Data>
</XData>
Expand Down Expand Up @@ -39,5 +40,16 @@
return $$$OK
]]></Implementation>
</Method>

<Method name="info">
<ClassMethod>1</ClassMethod>
<ReturnType>%Status</ReturnType>
<Implementation><![CDATA[
set info = {}
set info.languages = ##class(Form.Util.Translate).getLanguages()
write info.$toJSON()
quit $$$OK
]]></Implementation>
</Method>
</Class>
</Export>
14 changes: 14 additions & 0 deletions Form/Util/Translate.cls.xml
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,19 @@ do ##class(Form.Util.Translate).Insert()</Description>
set a = $$macroText^%occMessages($lb(text, domain))
]]></Implementation>
</Method>

<Method name="getLanguages">
<ClassMethod>1</ClassMethod>
<ReturnType>%Array</ReturnType>
<Implementation><![CDATA[
set languages = []
#dim list As %ListOfDataTypes
set list = ##class(%MessageDictionary).GetLanguages($$$domain)
for i=1:1:list.Count() {
do languages.$push(list.GetAt(i))
}
quit languages
]]></Implementation>
</Method>
</Class>
</Export>

0 comments on commit 85a0d81

Please sign in to comment.