Laravel - Package Development - Translations
If your package contains translation files, you may use the loadTranslationsFrom
method to inform Laravel how to load them. For example, if your package is named courier
, you should add the following to your service provider's boot
method:
/**
* Bootstrap any package services.
*
* @return void
*/
public function boot()
{
$this->loadTranslationsFrom(__DIR__.'/../resources/lang', 'courier');
}
Package translations are referenced using the package::file.line
syntax convention. So, you may load the courier
package's welcome
line from the messages
file like so:
echo trans('courier::messages.welcome');