Translator

Introduction

The platform supports application’s multilingualism through language files determined in component’s or module’s space.

The default path of translation files defined by module is src/modules/<module_name>/resources/lang/<language>/ (e.g. src/modules/sample_module/resources/lang/en/messages.php).

Configuration

Determining the location of a language file usually happens in module’s service provider ‘boot’ method by calling:

$this->addLanguageComponent('antares/foo', 'antares/foo', "{$path}/lang");

where the $path variable determines the location of language files’ catalogue. You have to remember about retaining the correct structure as below:

AT_TRANS01.PNG

It is also possible to use a global catalogue located in:

resources/lang

or user’s per level:

resources/lang/administrators

Remember that such solution will cause that translations will no longer be available in the ‘translations’ component and may be overwritten by publication.

Usage

Referring to the translation contained in the configuration file is possible with the use of:

{{ trans('antares/foo::messages.foo_test') }}

where antares/foo is the name of the module, messages is the name of the file, whereas foo_test is the translated phrase. More information about how the translator works can be found here.