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_push.erl | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'src/mod_push.erl') diff --git a/src/mod_push.erl b/src/mod_push.erl index 8ba3d7e72..db56a24b2 100644 --- a/src/mod_push.erl +++ b/src/mod_push.erl @@ -52,6 +52,7 @@ -include("ejabberd_commands.hrl"). -include("logger.hrl"). -include("xmpp.hrl"). +-include("translate.hrl"). -define(PUSH_CACHE, push_cache). @@ -261,10 +262,10 @@ unregister_iq_handlers(Host) -> -spec process_iq(iq()) -> iq(). process_iq(#iq{type = get, lang = Lang} = IQ) -> - Txt = <<"Value 'get' of 'type' attribute is not allowed">>, + Txt = ?T("Value 'get' of 'type' attribute is not allowed"), xmpp:make_error(IQ, xmpp:err_not_allowed(Txt, Lang)); process_iq(#iq{lang = Lang, sub_els = [#push_enable{node = <<>>}]} = IQ) -> - Txt = <<"Enabling push without 'node' attribute is not supported">>, + Txt = ?T("Enabling push without 'node' attribute is not supported"), xmpp:make_error(IQ, xmpp:err_feature_not_implemented(Txt, Lang)); process_iq(#iq{from = #jid{lserver = LServer} = JID, to = #jid{lserver = LServer}, @@ -276,10 +277,10 @@ process_iq(#iq{from = #jid{lserver = LServer} = JID, ok -> xmpp:make_iq_result(IQ); {error, db_failure} -> - Txt = <<"Database failure">>, + Txt = ?T("Database failure"), xmpp:make_error(IQ, xmpp:err_internal_server_error(Txt, Lang)); {error, notfound} -> - Txt = <<"User session not found">>, + Txt = ?T("User session not found"), xmpp:make_error(IQ, xmpp:err_item_not_found(Txt, Lang)) end; process_iq(#iq{from = #jid{lserver = LServer} = JID, @@ -291,10 +292,10 @@ process_iq(#iq{from = #jid{lserver = LServer} = JID, ok -> xmpp:make_iq_result(IQ); {error, db_failure} -> - Txt = <<"Database failure">>, + Txt = ?T("Database failure"), xmpp:make_error(IQ, xmpp:err_internal_server_error(Txt, Lang)); {error, notfound} -> - Txt = <<"Push record not found">>, + Txt = ?T("Push record not found"), xmpp:make_error(IQ, xmpp:err_item_not_found(Txt, Lang)) end; process_iq(IQ) -> -- cgit v1.2.3