zerospam / laravel-gettext

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

LaravelGettext::setLocale() not working #57

Open andrew26031990 opened 2 years ago

andrew26031990 commented 2 years ago

LaravelGettext::setLocale() not working properly. During executing this code in runtime, an error appeared. Details: Error: Using $this when not in object context in file C:\OpenServer\domains\bla-bla\vendor\zerospam\laravel-gettext\src\Xinax\LaravelGettext\LaravelGettext.php on line 68 ` @return string / public function getLocale() { return $this->translator->getLocale(); }

/**
 * Set current locale
 *
 * @param string $locale
 * @return $this
 * @throws Exceptions\LocaleNotSupportedException
 * @throws \Exception
 */
public function setLocale($locale)
{
    **if ($locale != $this->getLocale()) {**
        $this->translator->setLocale($locale);
    }

    return $this;
}`

Please give me an answer. Laravel version 8.65