diff options
author | Evgeny Khramtsov <ekhramtsov@process-one.net> | 2019-06-22 17:08:45 +0300 |
---|---|---|
committer | Evgeny Khramtsov <ekhramtsov@process-one.net> | 2019-06-22 17:08:45 +0300 |
commit | 00f2a736eb555206fd76b65ca32f00cb9df9f026 (patch) | |
tree | 5f3f704c329f7a5037e4dca067eb655b54810386 /src/mod_push.erl | |
parent | Change 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_push.erl')
-rw-r--r-- | src/mod_push.erl | 13 |
1 files changed, 7 insertions, 6 deletions
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) -> |