Search code examples
laravelmultilingual

User controll multilingual files inside multi-tenancy laravel application


I have multi-tenancy application

and now I start adding multi language to this tenant ... but in my case

Every tenant can change the translated files that usually inside lang directory.

So how can I implement this changes without affecting other tenants?!

I want to make it dynamic all from tenant dashboard


Solution

  • if you want to make it dynamic from the dashboard then you better store it in the database, and each tenant will have its own translations, otherwise, you can store each tenant in a separate folder like lang/en/{TENANT_ID}/file.php, then you can call it like:

    __(getTenantId() . '.file.word');