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_mix_pam.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 '')
-rw-r--r-- | src/mod_mix_pam.erl | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/mod_mix_pam.erl b/src/mod_mix_pam.erl index 773ca089..7b01965c 100644 --- a/src/mod_mix_pam.erl +++ b/src/mod_mix_pam.erl @@ -34,6 +34,7 @@ -include("xmpp.hrl"). -include("logger.hrl"). +-include("translate.hrl"). -define(MIX_PAM_CACHE, mix_pam_cache). @@ -253,7 +254,7 @@ process_iq_error(#iq{type = error} = ErrIQ, #iq{sub_els = [El]} = IQ) -> ejabberd_router:route_error(IQ, Err) end; process_iq_error(timeout, IQ) -> - Txt = <<"Request has timed out">>, + Txt = ?T("Request has timed out"), Err = xmpp:err_recipient_unavailable(Txt, IQ#iq.lang), ejabberd_router:route_error(IQ, Err). @@ -267,22 +268,22 @@ make_channel_id(JID, ID) -> %%%=================================================================== -spec missing_channel_error(stanza()) -> stanza_error(). missing_channel_error(Pkt) -> - Txt = <<"Attribute 'channel' is required for this request">>, + Txt = ?T("Attribute 'channel' is required for this request"), xmpp:err_bad_request(Txt, xmpp:get_lang(Pkt)). -spec forbidden_query_error(stanza()) -> stanza_error(). forbidden_query_error(Pkt) -> - Txt = <<"Query to another users is forbidden">>, + Txt = ?T("Query to another users is forbidden"), xmpp:err_forbidden(Txt, xmpp:get_lang(Pkt)). -spec unsupported_query_error(stanza()) -> stanza_error(). unsupported_query_error(Pkt) -> - Txt = <<"No module is handling this query">>, + Txt = ?T("No module is handling this query"), xmpp:err_service_unavailable(Txt, xmpp:get_lang(Pkt)). -spec db_error(stanza()) -> stanza_error(). db_error(Pkt) -> - Txt = <<"Database failure">>, + Txt = ?T("Database failure"), xmpp:err_internal_server_error(Txt, xmpp:get_lang(Pkt)). %%%=================================================================== |