MenaraSolutions\Geographer\Repositories\File::getTranslationsPath PHP Method

getTranslationsPath() public method

public getTranslationsPath ( MenaraSolutions\Geographer\Contracts\IdentifiableInterface $subject, $language ) : string
$subject MenaraSolutions\Geographer\Contracts\IdentifiableInterface
$language
return string
    public function getTranslationsPath(IdentifiableInterface $subject, $language)
    {
        $elements = explode('\\', get_class($subject));
        $key = strtolower(end($elements));
        $root = $this->getTranslationsPrefix() . DIRECTORY_SEPARATOR . 'geographer-' . $language;
        if (get_class($subject) == City::class) {
            $country = $subject->getMeta()['country'];
            return $root . DIRECTORY_SEPARATOR . 'resources' . DIRECTORY_SEPARATOR . $key . DIRECTORY_SEPARATOR . $country . '.json';
        }
        return $root . DIRECTORY_SEPARATOR . 'resources' . DIRECTORY_SEPARATOR . $key . DIRECTORY_SEPARATOR . 'all.json';
    }