Translate the table keys
@param $key
@param $translations
@return mixed
@since 3.2.0
545707
private function translate($key, $translations)
    {
        if (!is_null($translations) && isset($translations[$key])) {
            return $translations[$key];
        }

        return $key;
    }
308474
function keyTranslate( $key )
    {
        $msg = $this->findKey( $key );
        if ( $msg !== null )
            return $msg["translation"];
        else
        {
            return null;
        }
    }
693159
public function processTranslations(
            array $translations, 
            $trans_key = null, 
            $language_key = 'language_id'){
        
        $approved = [];
        
        foreach($translations as $trans){
            //Check if translation is array at and skip
            if(!is_array($trans)){
                continue;
            }
            //Check for translation key
            if(!is_null($trans_key)){
                unset($trans[$trans_key]);
            }
            if(!isset($this->required_trans) && !empty($this->filterNull($trans,$language_key))){
                $approved[] = $trans;
            }
            elseif(isset($this->required_trans) && $this->checkRequired($trans)){
                $approved[] = $trans;
            }
        }
        return $approved;
    }
1107662
public function getTranslation(string $key, string $locale = null)
    {
        $this->throwExceptionIfAttributeIsNotTranslatable($key);

        $translations = $this->getTranslations($key);

        if (count($translations)) {
            $locale = $locale ?: config('app.locale');

            if (isset($translations[$locale])) {
                $translation = $translations[$locale];
            } else {
                $translation = $translations[$this->getDefaultLocale()] ?? head($translations);
            }

        } else {
            $translation = null;
        }

        if ($this->hasGetMutator($key)) {
            return $this->mutateAttribute($key, $translation);
        }

        return $translation;
    }
1359001
private function translate(array $translations)
    {
        foreach ($translations as $key => $part) {
            if (is_array($part)) {
                $translations[$key] = $this->translate($part);
            } else {
                $translations[$key] = $this->translateText($part);
            }
        }

        return $translations;
    }
207332
protected function getCustomMessageFromTranslator($key)
    {
        if (($message = $this->translator->trans($key)) !== $key) {
            return $message;
        }

        // If an exact match was not found for the key, we will collapse all of these
        // messages and loop through them and try to find a wildcard match for the
        // given key. Otherwise, we will simply return the key's value back out.
        $shortKey = preg_replace(
            '/^validation\.custom\./', '', $key
        );

        return $this->getWildcardCustomMessages(Arr::dot(
            (array) $this->translator->trans('validation.custom')
        ), $shortKey, $key);
    }
803151
public function extendedKey($key)
    {
        $cache = $this->repository->getCache();
        if (!$cache->tableHasField($this->table, $key)) {
            if ($cache->tableHasField($this->table . '_i18n', $key)) {
                return '`' . $this->table . '_i18n`.`' . $key . '`';
            }
        }

        return $key;
    }
1315399
public function translate($arrayKeys = []) {
        $result = [];
        
        // Transposition pour les libelles
        foreach ($arrayKeys as $key => $value) {
            
            // Indexed numeric array
            if (is_numeric($key)){
                $fromDictionnary = $this->getString($value);
                $result[] = (false === $fromDictionnary) ?  ucwords($value) : $fromDictionnary;
            }
            else{
                $result[] = $value;
            }
        }
        return $result;
    }
67231
public function translate($key, $translation, $locale = null, $driver = null) {
        $driver = ! is_null($driver) ? $this->getDriver($driver) : $this->driver();

        return $driver->translate(
            $key, $translation, $locale
        );
    }
837098
protected function translate($key, array $arguments = [])
    {
        return \TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate(
            'LLL:EXT:ke_search/Resources/Private/Language/locallang_mod.xml:' . $key,
            'KeSearch',
            $arguments
        );
    }
1173403
protected function createMultiArray(array $translations)
    {
        $res = array();

        foreach ($translations as $keyString => $value) {
            $keys = explode('.', $keyString);

            //$keyString might be "Hello world."
            $keyLength = count($keys);
            if ($keys[$keyLength - 1] == '') {
                unset($keys[$keyLength - 1]);
                $keys[$keyLength - 2] .= '.';
            }

            $this->addValueToMultiArray($res, $value, $keys);
        }

        return $res;
    }
1243388
public function trans(string $key, array $args = [], $lang = '')
    {
        return $this->translate($key, $args, $lang);
    }
371545
public function translateArray($key, $index, $languages = null, $html_out = false)
    {
        if ($this->config->get('system.languages.translations', true)) {
            if ($this->enabled() && $key) {
                if (empty($languages)) {
                    if ($this->config->get('system.languages.translations_fallback', true)) {
                        $languages = $this->getFallbackLanguages();
                    } else {
                        $languages = (array)$this->getDefault();
                    }
                }
            } else {
                $languages = ['en'];
            }

            foreach ((array)$languages as $lang) {
                $translation_array = (array)Grav::instance()['languages']->get($lang . '.' . $key, null);
                if ($translation_array && array_key_exists($index, $translation_array)) {
                    return $translation_array[$index];
                }
            }
        }

        if ($html_out) {
            return '<span class="untranslated">' . $key . '[' . $index . ']</span>';
        }

        return $key . '[' . $index . ']';
    }
891119
function keyTranslate( $key )
    {
        $num = $this->keyPick( $key );
        if ( $num >=0 and $num <= count( $this->Handlers ) )
        {
            $handler = $this->Handlers[$num];
            return $handler->keyTranslate( $key );
        }

        return null;
    }
554905
protected function removeTranslationTable($key)
    {
        if (true === isset(self::$translationTables[$key])) {
            unset(self::$translationTables[$key]);
        }
    }
72590
public function getKeys(
        array $domains = [],
        array $languages = []
    ) : array {
        return array_reduce(
            $this->getTranslations(
                $domains,
                $languages
            ),
            function (array $keys, Translation $translation) {
                $keys[] = $translation->getKey();

                return $keys;
            },
            []
        );
    }
224814
public function getByKeyWithTranslation($key, $language)
    {
        return EmailTemplate::find()
            ->byKey($key)
            ->withTranslation($language)
            ->one();
    }