zerospam / laravel-gettext

Adds localization support to laravel applications using PoEdit and GNU-Gettext.
99 stars 56 forks source link

Gettext in Console / Commands? #14

Closed CedNet closed 6 years ago

CedNet commented 6 years ago

Hi! This Gettext package doesn't translate stuff ran via the artisan schedule:run and any command there. Also not for phpunit tests.

Is there any way to force this package to load always no matter starter?

Belphemur commented 6 years ago

Hello,

The package is always loaded.

In case you run queue, cron, etc ... you need in the command/job itself to set the language (and set it back to what it was if you don't want to run in some issue).

Simply use the facade in your command/job \LaravelGettext::setLocale($locale);

CedNet commented 6 years ago

Thx for that info. My issue I just realized was that the default lang in the config for the package was english. I changed there to Swedish and it worked.

Please close this or remove fully. :)