Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

FREDERIC LD's avatar

load translations in custom module

Hi,

Using laravel 5.8

I am trying to load translations in a module I am making, but I am getting no luck. Really annoying... I must be missing something but I can not see it.

service provider file

    public function boot()
    {
    ...
    $this->loadTranslationsFrom(__DIR__.'/Resources/lang/en', 'aaa');
    ...
    }

admin_pages.php

return [

    "welcome" => "Hello"

];

view

{{ __('aaa::admin_pages.welcome') }} 
@lang('aaa::admin_pages.welcome') 

controller

echo trans('aaa::admin_pages.welcome');
echo trans('*::admin_pages.welcome');

I don't know where this are going wrong here.

As a result my views display the text entered in the quotes aaa::admin_pages.welcome*::manage_logs.title

no translations. Is there a way to debug what is loaded?

0 likes
1 reply
FREDERIC LD's avatar
FREDERIC LD
OP
Best Answer
Level 4

Found the issue

public function boot()
    {
    ...
    $this->loadTranslationsFrom(__DIR__.'/Resources/lang', 'aaa');
    ...
    }

Please or to participate in this conversation.