Module z_trans_server

Simple server to manage the translations, owns the ets table containing all translations.

Copyright 2010 Marc Worrell Date: 2010-05-18

Behaviours: gen_server.

Authors: Marc Worrell (marc@worrell.nl).

Description

Simple server to manage the translations, owns the ets table containing all translations. When new translations are read then the previous table is kept and the one before the previous is deleted.

Function Index

code_change/3Convert process state when code is changed.
handle_call/3Return the id of the current translation table.
handle_cast/2Rebuild the translations table.
handle_info/2Handling all non call/cast messages.
init/1Initiates the server.
load_translations/1Parse all .po files and reload the found translations in the trans server.
load_translations/2Take a proplist with dicts and reload the translations table.
observe_module_ready/2Reload the translations when modules are changed.
set_context_table/1Set the table id in the context to the newest table id.
start_link/1Starts the server.
start_tests/0
table/1Return the name of the ets table holding all translations.
terminate/2This function is called by a gen_server when it is about to terminate.

Function Details

code_change/3

code_change(OldVsn, State, Extra) -> {ok, NewState}

Convert process state when code is changed

handle_call/3

handle_call(Message::Request, From, State) -> {reply, Reply, State} | {reply, Reply, State, Timeout} | {noreply, State} | {noreply, State, Timeout} | {stop, Reason, Reply, State} | {stop, Reason, State}

Return the id of the current translation table

handle_cast/2

handle_cast(Message::Msg, State) -> {noreply, State} | {noreply, State, Timeout} | {stop, Reason, State}

Rebuild the translations table. Call the template flush routines afterwards. Trans is a dict with all translations per translatable string.

handle_info/2

handle_info(Info, State) -> {noreply, State} | {noreply, State, Timeout} | {stop, Reason, State}

Handling all non call/cast messages

init/1

init(Host::Args) -> {ok, State} | {ok, State, Timeout} | ignore | {stop, Reason}

Initiates the server.

load_translations/1

load_translations(Context) -> any()

Parse all .po files and reload the found translations in the trans server

load_translations/2

load_translations(Trans, Context) -> any()

Take a proplist with dicts and reload the translations table. After reloading the the template server is flushed.

observe_module_ready/2

observe_module_ready(X1, Context) -> any()

Reload the translations when modules are changed.

set_context_table/1

set_context_table(Context) -> any()

Set the table id in the context to the newest table id

start_link/1

start_link(SiteProps) -> {ok, Pid} | ignore | {error, Error}

Starts the server

start_tests/0

start_tests() -> any()

table/1

table(Host) -> any()

Return the name of the ets table holding all translations

terminate/2

terminate(Reason, State) -> void()

This function is called by a gen_server when it is about to terminate. It should be the opposite of Module:init/1 and do any necessary cleaning up. When it returns, the gen_server terminates with Reason. The return value is ignored.


Generated by EDoc, Oct 22 2014, 21:45:09.