The Laravel Chained Translator can combine several translators that can override each others translations.

2.4.1 2024-05-13 21:35 UTC

This package is auto-updated.

Last update: 2024-06-13 21:50:03 UTC


Laravel Chained Translator

Laravel Chained Translator

Latest Version on Packagist Total Downloads

The chained translator can combine several translators that can override each others translations. Typically, at some point during the development phase, a content manager wants to translate or finetune the translation strings added by developers. This often results in merge and versioning issues, when developers and content managers are working on the translation files at the same time.

The Chained Translator package allows translations created by developers to exist separately from translations edited by the content manager in separate lang directories. The library merges the translations of both language directories, where the translations of the content manager (the custom translations) override those of the developer (the default translations).

For instance, the default translations created by developers are written in the default Laravel lang directory in resources/lang, and the translations by the content manager are added to resources/lang-custom. When a translation key exists in the resources/lang-custom directory, this is preferred, otherwise we fallback to the default translations.

We offer two package that provide a UI to let content managers edit translations.


Via composer:

composer require statikbe/laravel-chained-translator


Merge the custom translations back into the default translation files

If you want to combine the translation files made in the current environment by the content manager with the default translation files, you can use the following command. You need to pass the locale as a parameter, since this library is agnostic of the locales supported by your Laravel application. Laravel sadly does not have a default supported locales list. So if you want to merge all files for all supported locales, run this command for each locale.

For example, for French:

php artisan chainedtranslator:merge fr

This command can be useful to merge the translation work of a translator back into the default translation files.


You can publish the configuration by running this command:

php artisan vendor:publish --provider="Statikbe\LaravelChainedTranslator\TranslationServiceProvider" --tag=config

The following configuration fields are available:

1. Custom lang directory

By default, the custom translations are saved in resources/lang-custom. This can be configured using custom_lang_directory_name.

2. .gitignore in custom lang directory

If add_gitignore_to_custom_lang_directory is set to true, a .gitignore file is added to the custom language directory.

3. Group keys in nested arrays

If group_keys_in_array is set to true, dotted translation keys will be mapped into arrays.

Set to true: saved as nested arrays, f.e.

'key' => [
   'detail' => 'translation',

Set to false: saved as dotted keys, f.e.

'key.detail' => 'translation',

4. Custom json group name

You can edit the group name of all json translations with the json_group.

TODO's & Ideas

  • option to overwrite the default lang directory. This could be useful on local and staging environments to manage the developer translations.


We used Joe Dixon's translation libraries as a source of technical expertise and inspiration:

Thanks a lot for the great work!


The MIT License (MIT). Please see license file for more information.