Multi-Lingual

Want to add more languages? We'll explore how you can do this.

Enabling customization

The first step to use multi-lingual is to follow the steps described in Customization to allow for adding new language file.

Then, in your own locale folder, add the new language file and complete the translation of the different strings from the base file.

Modifying configurations

You will then need to enable these new languages by modifying the configurations in DevConfigs.php.

$app['translator.default_language'] = 'en_CA';
$app['translator.available_languages'] = ['en_CA', 'fr_CA'];
		

In this case, we would have English and French available as languages and English would be the default language.

Using different languages

To use a different language than the default one, you will need to send the proper headers while making API calls. Here is an example for the forgot password email.

curl -X PUT -H "Content-Type: application/json" -H "Accept-Language: fr_CA"
     -d '{"email":"v@berest.io","password":"reset"}'
     http://127.0.0.1/users/me