25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-20 16:15:59 +01:00

Set translation callback on startup

This commit is contained in:
Evgeniy Khramtsov 2017-03-17 21:35:02 +03:00
parent 2d67ff2249
commit 91245141e9
2 changed files with 4 additions and 2 deletions

View File

@ -24,7 +24,7 @@
{fast_tls, ".*", {git, "https://github.com/processone/fast_tls", "afdd07811e0e6eff444c035ffeb2aa9efb4dbe6d"}},
{stringprep, ".*", {git, "https://github.com/processone/stringprep", {tag, "1.0.7"}}},
{fast_xml, ".*", {git, "https://github.com/processone/fast_xml", {tag, "1.1.21"}}},
{xmpp, ".*", {git, "https://github.com/processone/xmpp", "4aaed37a16fc21be505553aabf9f47a48b8af027"}},
{xmpp, ".*", {git, "https://github.com/processone/xmpp", "cfb5c11280fdd82f8370d9322bbcb3255b743c76"}},
{stun, ".*", {git, "https://github.com/processone/stun", {tag, "1.0.9"}}},
{esip, ".*", {git, "https://github.com/processone/esip", {tag, "1.0.10"}}},
{fast_yaml, ".*", {git, "https://github.com/processone/fast_yaml", {tag, "1.0.8"}}},

View File

@ -43,6 +43,7 @@ start_link() ->
gen_server:start_link({local, ?MODULE}, ?MODULE, [], []).
init([]) ->
process_flag(trap_exit, true),
ets:new(translations, [named_table, public]),
Dir = case os:getenv("EJABBERD_MSGS_PATH") of
false ->
@ -53,6 +54,7 @@ init([]) ->
Path -> Path
end,
load_dir(iolist_to_binary(Dir)),
xmpp:set_tr_callback({?MODULE, translate}),
{ok, #state{}}.
handle_call(_Request, _From, State) ->
@ -66,7 +68,7 @@ handle_info(_Info, State) ->
{noreply, State}.
terminate(_Reason, _State) ->
ok.
xmpp:set_tr_callback(undefined).
code_change(_OldVsn, State, _Extra) ->
{ok, State}.