From 00f2a736eb555206fd76b65ca32f00cb9df9f026 Mon Sep 17 00:00:00 2001 From: Evgeny Khramtsov Date: Sat, 22 Jun 2019 17:08:45 +0300 Subject: 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")). --- src/mod_stats.erl | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/mod_stats.erl') 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}). -- cgit v1.2.3