z_trans_server (zotonic_core v1.0.0-rc.17)
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.
Summary
Functions
Convert process state when code is changed
Trap unknown calls
Rebuild the translations table. Call the template flush routines afterwards. Trans is a map with all translations per translatable string.
Handling all non call/cast messages
Initiates the server.
Parse all .po files and reload the found translations in the trans server
Take a proplist with dicts and reload the translations table. After reloading the the template server is flushed.
Reload the translations when modules are changed.
Set the table id in the context to the newest table id
Starts the server
Return the name of the ets table holding all translations
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.
Functions
Convert process state when code is changed
Trap unknown calls
Rebuild the translations table. Call the template flush routines afterwards. Trans is a map with all translations per translatable string.
Handling all non call/cast messages
Initiates the server.
-spec load_translations(z:context()) -> ok.
Parse all .po files and reload the found translations in the trans server
Take a proplist with dicts and reload the translations table. After reloading the the template server is flushed.
-spec observe_module_ready(module_ready, z:context()) -> ok.
Reload the translations when modules are changed.
Set the table id in the context to the newest table id
-spec start_link(Site :: atom()) -> gen_server:start_ret().
Starts the server
-spec start_tests() -> gen_server:start_ret().
Return the name of the ets table holding all translations
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.