View Source t__ (t__ v0.1.0)

Link to this section Summary

Functions

Returns the name of the application to which the calling process belongs. If the specified process does not belong to any application the function returns 't__'.
Deletes configuration for the calling process application with infinity timeout.

See also: t__:config_delete/2.

Deletes configuration for the specified application with infinity timeout.

See also: t__:config_delete/2.

Deletes configuration for the specified application with the specified timeout.

Deletes configuration for the specified application asynchronous Sends an asynchronous request to the process handling the implementation and returns ok immediately.

See also: t__:config_delete/2.

Returns the current configuration for the calling process.

Returns the current configuration for the specified application.

Returns the value of configuration t__config for Application
Sets a new configuration for the calling process application with infinity timeout.

See also: t__:config_set/3.

Sets a new configuration for the specified application with infinity timeout.

See also: t__:config_set/3.

Sets a new configuration for the specified application with the specified timeout.

Sets a new configuration for the specified application asynchronous Sends an asynchronous request to the process handling the implementation and returns ok immediately.

See also: t__:config_set/3.

Returns the current language for the calling process.

Translate a singular or plural term, with or without repository, language and context This is the main translate function that does everything. using #t__p
Translate with data

See also: t__:translate/3.

Translate with data and reference as separate parameters using #t__p

Link to this section Types

-type config() :: #t__config{}.
-type p() :: #t__p{}.
-type repository() :: #t__repository{}.

Link to this section Functions

-spec application() -> t__ | Application when Application :: atom().
Returns the name of the application to which the calling process belongs. If the specified process does not belong to any application the function returns 't__'.
-spec config_delete() -> ok | {error, Error} when Error :: term().
Deletes configuration for the calling process application with infinity timeout.

See also: t__:config_delete/2.

Link to this function

config_delete(Application)

View Source
-spec config_delete(Application) -> ok | {error, Error} when Application :: atom(), Error :: term().
Deletes configuration for the specified application with infinity timeout.

See also: t__:config_delete/2.

Link to this function

config_delete(Application, Timeout)

View Source
-spec config_delete(Application, Timeout) -> ok | {error, Error}
                 when Application :: atom(), Timeout :: timeout(), Error :: term().

Deletes configuration for the specified application with the specified timeout.

There is a blocking gen_server call behind this! That's why there is a config_delete_cast version of this function for convenience.

Deleting applications config is possible but should not be abused. The system was designed for you to be able to change it at the application start or from an administration panel, from time to time.
Link to this function

config_delete_cast(Application)

View Source
-spec config_delete_cast(Application) -> ok | {error, Error} when Application :: atom(), Error :: term().
Deletes configuration for the specified application asynchronous Sends an asynchronous request to the process handling the implementation and returns ok immediately.

See also: t__:config_delete/2.

-spec config_get() -> Config when Config :: t__:config().

Returns the current configuration for the calling process.

Please notice that the language config record field may not be the same to the calling process application config because language can also be configured at the process level. (The process level language overwrites the application configured language).

If you want to get the config holding application language, call t__:config/1 function.

The function will perform the following steps: - call erlang:get(t__language) to get any calling process specific language that will overwrite the language returned from the next calls - call application:get_env(t__config) - call application:get_env(t__, t__config) - if no t__config environment key was set for both the current application or the t__ application we return t__ default config
-spec config_get(Application) -> Config when Application :: atom(), Config :: t__:config().

Returns the current configuration for the specified application.

The function will perform the following steps: - call application:get_env(t__config) - call application:get_env(t__, t__config) - if no t__config environment key was set for both the current application or the t__ application we return t__ default config
Link to this function

config_get_environment(Application)

View Source
Returns the value of configuration t__config for Application
-spec config_set(Config) -> ok | {error, Error} when Config :: t__:config(), Error :: term().
Sets a new configuration for the calling process application with infinity timeout.

See also: t__:config_set/3.

Link to this function

config_set(Application, Config)

View Source
-spec config_set(Application, Config) -> ok | {error, Error}
              when Application :: atom(), Config :: t__:config(), Error :: term().
Sets a new configuration for the specified application with infinity timeout.

See also: t__:config_set/3.

Link to this function

config_set(Application, Config, Timeout)

View Source
-spec config_set(Application, Config, Timeout) -> ok | {error, Error}
              when
                  Application :: atom(),
                  Config :: t__:config(),
                  Timeout :: timeout(),
                  Error :: term().

Sets a new configuration for the specified application with the specified timeout.

There is a blocking gen_server call behind this! That's why there is a config_set_cast version of this function for convenience. However I don't recommend using that because you will not know if the operation failed.

Changing applications config is possible but should not be abused. The system was designed for you to be able to change it at the application start or from an administration panel, from time to time.
Link to this function

config_set_cast(Application, Config)

View Source
-spec config_set_cast(Application, Config) -> ok | {error, Error}
                   when Application :: atom(), Config :: t__:config(), Error :: term().
Sets a new configuration for the specified application asynchronous Sends an asynchronous request to the process handling the implementation and returns ok immediately.

See also: t__:config_set/3.

-spec language() -> Language when Language :: string().

Returns the current language for the calling process.

When you properly setup the language for the process, the expected time complexity for the current implementation of this macro is O(1) and the worst case time complexity is O(N), where N is the number of items in the process dictionary.

The function will perform the following steps in order to determine the default language: - call erlang:get(t__language) - call application:get_env(t__config) - call application:get_env(t__, t__config) - if no t__config environment key was set for both the current application or the t__ application we return t__ default language.
-spec translate(Param) -> Msg when Param :: term(), Msg :: string().
Translate a singular or plural term, with or without repository, language and context This is the main translate function that does everything. using #t__p
-spec translate(Param, Data) -> Msg when Param :: term(), Data :: undefined | list(), Msg :: string().
Translate with data

See also: t__:translate/3.

Link to this function

translate(Param, Data, Reference)

View Source
-spec translate(Param, Data, Reference) -> Msg
             when
                 Param :: term(),
                 Data :: undefined | list(),
                 Reference :: undefined | string(),
                 Msg :: string().
Translate with data and reference as separate parameters using #t__p
Link to this function

translate(Application, Repository, Language, Context, Msg, Data, Reference)

View Source
-spec translate(Application, Repository, Language, Context, Msg, Data, Reference) -> TranslatedMsg
             when
                 Application :: undefined | atom(),
                 Repository :: undefined | string() | atom() | binary(),
                 Language :: undefined | string() | atom() | binary(),
                 Context :: undefined | string() | atom() | binary(),
                 Msg :: string() | atom() | binary(),
                 Data :: undefined | list(),
                 Reference :: undefined | string(),
                 TranslatedMsg :: string().
Translate with all separate parameters.