oriceon
5 years ago
1283
1
General

Laravel lang from another path

Posted 5 years ago by oriceon

Hello there. I want to create a multi site with multi languages support.

All`s good for now:

  1. i created folder structure:
/Agents/
    /Domains/
        /domain1.dev/
             /lang/
                 /en/
                     translations here...
             config.php
        /domain2.dev/
             /lang/
                 /en/
                     translations here...
             config.php
  1. I created a service provider where i load config from that paths, i load translator with namespace: $this->app['translator']->addNamespace('Agents', $domain_path . 'lang');

Now, the problem is that i want to remove /resources/lang/ entirely and move validation, pagination and passwords translations to my lang folders and need to find a way to load language by default from my custom place to escape using namespace in trans like trans('Agents::key ..') using directly trans('key').

With views i found a way to get views from custom place: $this->app['view']->addLocation($domain_path . 'lang/views/');

But with language i cannot find the right way.

Please sign in or create an account to participate in this conversation.