aboutsummaryrefslogtreecommitdiff
path: root/src/mod_stats.erl
diff options
context:
space:
mode:
authorEvgeny Khramtsov <ekhramtsov@process-one.net>2019-06-22 17:08:45 +0300
committerEvgeny Khramtsov <ekhramtsov@process-one.net>2019-06-22 17:08:45 +0300
commit00f2a736eb555206fd76b65ca32f00cb9df9f026 (patch)
tree5f3f704c329f7a5037e4dca067eb655b54810386 /src/mod_stats.erl
parentChange Travis OTP platform from 19.1 to 19.3 (diff)
Improve extraction of translated strings
Now every such string MUST be encapsulated into ?T() macro. The macro itself is defined in include/translate.hrl. Example: -module(foo). -export([bar/1]). -include("translate.hrl"). bar(Lang) -> translate:translate(Lang, ?T("baz")).
Diffstat (limited to 'src/mod_stats.erl')
-rw-r--r--src/mod_stats.erl7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/mod_stats.erl b/src/mod_stats.erl
index d3a705564..34d1d4c10 100644
--- a/src/mod_stats.erl
+++ b/src/mod_stats.erl
@@ -36,6 +36,7 @@
-include("logger.hrl").
-include("xmpp.hrl").
+-include("translate.hrl").
start(Host, _Opts) ->
gen_iq_handler:add_iq_handler(ejabberd_local, Host, ?NS_STATS,
@@ -51,7 +52,7 @@ depends(_Host, _Opts) ->
[].
process_iq(#iq{type = set, lang = Lang} = IQ) ->
- Txt = <<"Value 'set' of 'type' attribute is not allowed">>,
+ Txt = ?T("Value 'set' of 'type' attribute is not allowed"),
xmpp:make_error(IQ, xmpp:err_not_allowed(Txt, Lang));
process_iq(#iq{type = get, to = To, lang = Lang,
sub_els = [#stats{} = Stats]} = IQ) ->
@@ -89,7 +90,7 @@ get_local_stats(_Server, [<<"running nodes">>, ENode],
Names, Lang) ->
case search_running_node(ENode) of
false ->
- Txt = <<"No running node found">>,
+ Txt = ?T("No running node found"),
{error, xmpp:err_item_not_found(Txt, Lang)};
Node ->
{result,
@@ -97,7 +98,7 @@ get_local_stats(_Server, [<<"running nodes">>, ENode],
Names)}
end;
get_local_stats(_Server, _, _, Lang) ->
- Txt = <<"No statistics found for this item">>,
+ Txt = ?T("No statistics found for this item"),
{error, xmpp:err_feature_not_implemented(Txt, Lang)}.
-define(STATVAL(Val, Unit), #stat{name = Name, units = Unit, value = Val}).