zerospam / laravel-gettext

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

Alias _ (single underscore) is not working #25

Closed ClimberBear closed 5 years ago

ClimberBear commented 5 years ago

Hi

I have a legacy code using a lot of gettext translations with alias _.

But this alias is not working in laravel-gettext

I have checked and it's defined in Support/helpers.php, in this way

if (!function_exists('_')) {
    /**
     * Generic translation function
     *
     * @param $message
     *
     * @return mixed
     */
    function _($message, $args = null)
    {
        return _i($message, $args);
    }
}

How can I get this working?

Belphemur commented 5 years ago

Hello,

Laravel use that function, I can't do anything about it since the framework is loaded before the plug-in.

If you check the Readme is written at the end of it. I advise you to use _i instead which is the function defined by the plug-in.


From: ClimberBear notifications@github.com Sent: Thursday, December 27, 2018 13:46 To: Belphemur/laravel-gettext Cc: Subscribed Subject: [Belphemur/laravel-gettext] Alias _ (single underscore) is not working (#25)

Hi

I have a legacy code using a lot of gettext translations with alias _.

But this alias is not working in laravel-gettext

I have checked and it's defined in Support/helpers.php, in this way

if (!functionexists('')) {     /*       Generic translation function             @param $message             @return mixed      */     function _($message, $args = null)     {         return _i($message, $args);     } }

How can I get this working?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.