Find a translation per namespace, group and item values

@param  string  $locale
@param  string  $namespace
@param  string  $group
@param  string  $item
@return Translation
329352
public function findByCode($locale, $namespace, $group, $item)
    {
        return $this->model->whereLocale($locale)->whereNamespace($namespace)->whereGroup($group)->whereItem($item)->first();
    }
27731
public function load($locale, $group, $namespace = null)
    {
        $defaults = [];

        if (empty($this->locales) || $this->isSupported($locale))
            $defaults = $this->loadPath($this->getVendorPath(), $locale, $group);

        return array_replace_recursive($defaults, parent::load($locale, $group, $namespace));
    }
205167
public function getTranslations(Locale $locale)
    {
        $localeID = $locale->getID();
        $translations = isset($this->translations[$localeID]) ? $this->translations[$localeID][1] : null;
        if ($translations === null) {
            $translations = clone $this->getSourceStrings(true);
            $translations->setLanguage($locale->getID());
            $this->setTranslations($locale, $translations);
        }

        return $translations;
    }
793455
public function load($locale, $group, $namespace = null)
    {
        $results = [];
        foreach ($this->loaders as $loader) {
            $results = array_merge($results, $loader->load($locale, $group, $namespace));
        }

        return $results;
    }
852494
protected function read($namespace, $group, $locale, $item)
	{
		$this->load($namespace, $group, $locale);

		$data = Arr::get($this->loaded[$namespace][$group][$locale], $item);

		return $data;
	}
940024
protected function getTranslation($key, $locale) {
        if( isset($this->translations[$locale][$key]) )
            return $this->translations[$locale][$key];

        return $key;
    }
633805
public function translate($locale) {
		$localeEntity = clone $this;
		$localeEntity->setLocale($locale);
		if(isset($this->data['translations'][$locale]))
			$localeEntity->_set($this->data['translations'][$locale]);
		unset($localeEntity->data['translations'][$locale]);
		$localeEntity->data['translations'][$this->getLocale()] = $this->data['properties'];

		return $localeEntity;
	}
53234
public function findUsagesByLocales( $locale = null )
    {
        if ( empty( $locale ) )
        {
            $locale = $this->getLocale();
        }

        return $this->getMapper()
                    ->findUsagesByLocales( (array) $locale );
    }
1193561
protected function getLine($namespace, $group, $locale, $item, array $replace)
    {
        $this->load($namespace, $group, $locale);

        $line = static::arrayGet($this->loaded[$namespace][$group][$locale], $item);

        if (is_string($line)) {
            return $this->makeReplacements($line, $replace);
        } elseif (is_array($line) && count($line) > 0) {
            return $line;
        }
    }
753763
public static function getByLocale($locale)
    {
        if (!$locale) {
            return null;
        }

        if ($locale instanceof Locale) {
            return $locale;
        }

        if (!static::$locales_by_title) {
            static::$locales_by_title = [];
            foreach (Locale::getCached() as $localeObj) {
                static::$locales_by_title[$localeObj->Locale] = $localeObj;
            }
        }

        // Get filtered locale
        return isset(static::$locales_by_title[$locale]) ? static::$locales_by_title[$locale] : null;
    }
1009765
public function load($locale, $group, $namespace = null)
	{
		if (is_null($namespace) || $namespace == '*')
		{
			return $this->loadPath($this->path, $locale, $group);
		}
		else
		{
			return $this->loadNamespaced($locale, $group, $namespace);
		}
	}
412794
private function parse($locale)
    {
        $parts = explode('_', $locale);

        $localization = new Localization();
        $localization->setLanguage($parts[0]);
        if (count($parts) > 1) {
            $localization->setCountry($parts[1]);
        }

        return $localization;
    }
1034771
public function findAllByLocale($locale, $filter = array())
    {
        if (empty($filter)) {
            $items = $this->itemRepository->findAllByLocale($locale);
        } else {
            $items = $this->itemRepository->findByLocaleAndFilter($locale, $filter);
        }

        array_walk(
            $items,
            function (&$item) use ($locale) {
                $item = $this->itemFactory->createApiEntity($item, $locale);
            }
        );

        return $items;
    }
791842
public function setLocale($locale = null)
    {
        if (is_null($locale)) {
            $locale = $this->getParent()->getLocale();
        }
        $this->locale = $locale;

        return $this;
    }
85499
public function setLocale($locale)
    {
        $this->locale = LanguageNormalize::toLanguageTag($locale);

        $this->localises[$locale] = null;

        return $this;
    }
1184964
public function getLocaleAccess($locale, $user = 'current')
    {
        $result = self::NONE;
        $user = $this->getUser($user);
        if ($user === null) {
            $result = self::NOT_LOGGED_IN;
        } else {
            $result = self::NONE;
            if ($user->getUserID() == USER_SUPER_ID) {
                $result = self::GLOBAL_ADMIN;
            } elseif ($user->inGroup($this->groups->getGlobalAdministrators())) {
                $result = self::GLOBAL_ADMIN;
            } else {
                $locale = $this->getLocale($locale);
                if ($locale !== null) {
                    if ($user->inGroup($this->groups->getAdministrators($locale))) {
                        $result = self::ADMIN;
                    } elseif ($user->inGroup($this->groups->getTranslators($locale))) {
                        $result = self::TRANSLATE;
                    } elseif ($user->inGroup($this->groups->getAspiringTranslators($locale))) {
                        $result = self::ASPRIRING;
                    }
                }
            }
        }

        return $result;
    }
348690
public function loadArray(array $lines, $locale, $group, $namespace = '*')
    {
        // Transform the lines into a flat dot array:
        $lines = array_dot($lines);
        foreach ($lines as $item => $text) {
            if (is_string($text)) {
                // Check if the entry exists in the database:
                $translation = Translation::whereLocale($locale)
                    ->whereNamespace($namespace)
                    ->whereGroup($group)
                    ->whereItem($item)
                    ->first();

                // If the translation already exists, we update the text:
                if ($translation && !$translation->isLocked()) {
                    $translation->text = $text;
                    $saved             = $translation->save();
                    if ($saved && $translation->locale === $this->defaultLocale) {
                        $this->flagAsUnstable($namespace, $group, $item);
                    }
                }
                // If no entry was found, create it:
                else {
                    $this->create(compact('locale', 'namespace', 'group', 'item', 'text'));
                }
            }
        }
    }