RainLab\Translate\Classes\Translator::getPathInLocale PHP Метод

getPathInLocale() публичный Метод

Returns the path prefixed with language code.
public getPathInLocale ( string $path, string $locale = null ) : string
$path string Path to rewrite
$locale string optional language code, default to the system default language
Результат string
    public function getPathInLocale($path, $locale = null)
    {
        $segments = explode('/', $path);
        $segments = array_values(array_filter($segments, function ($v) {
            return $v != '';
        }));
        if (is_null($locale) || !Locale::isValid($locale)) {
            $locale = $this->defaultLocale;
        }
        if (count($segments) == 0 || Locale::isValid($segments[0])) {
            $segments[0] = $locale;
        } else {
            array_unshift($segments, $locale);
        }
        return implode('/', $segments);
    }