@param string $localeName
@param string $keyName
@param string $text

@return array
10011
protected function addTranslation($localeName, $keyName, $text)
    {
        $locale = new LocaleTransfer();
        $locale->setLocaleName($localeName);
        $translation = [];

        $translation['text'] = $text;
        $translation['created'] = false;
        $translation['updated'] = false;

        if (!$this->glossaryFacade->hasTranslation($keyName, $locale)) {
            $this->glossaryFacade->createAndTouchTranslation($keyName, $locale, $text, true);
            $translation['created'] = true;

            return $translation;
        }

        $this->glossaryFacade->updateAndTouchTranslation($keyName, $locale, $text, true);
        $translation['updated'] = true;

        return $translation;
    }
1224721
public function textDomain( $textDomain = self::DEFAULT_TEXT_DOMAIN,
                                $locale     = null )
    {
        $translator = $this->getTranslator();
        $locale     = $locale ?: $translator->getLocale();

        if ( ! isset( $translator->myMessages[$textDomain][$locale] ) )
        {
            $translator->loadMyMessages( $textDomain, $locale );
        }

        if ( ! isset( $translator->messages[$textDomain][$locale] ) )
        {
            $translator->loadMessages( $textDomain, $locale );
        }

        $my     = $translator->myMessages[$textDomain][$locale];
        $global = $translator->messages[$textDomain][$locale];

        if ( $my instanceof TextDomain )
        {
            $my = $my->getArrayCopy();
        }
        else if ( empty( $my ) )
        {
            $my = array();
        }

        if ( $global instanceof TextDomain )
        {
            $global = $global->getArrayCopy();
        }
        else if ( empty( $global ) )
        {
            $global = array();
        }

        return array_replace( $global, $my );
    }
299328
public static function all($locale = null)
    {
        return static::keys()->mapWithKeys(function ($key) use ($locale) {
            return [$key => trans("blog::posts.statuses.{$key}", [], $locale)];
        });
    }
161629
public function translate($key, $translation, $locale = null) {
        $locale = $this->locale($locale);

        return Lang::get($key, null, $locale);
    }
218403
public function getHelpTextByKeyLocale($translationKey, $locale)
    {
        $qb = $this->createQueryBuilder('h');
        $qb->where('h.locale LIKE :locale')
            ->andWhere('h.translationKey LIKE :translationKey')
            ->orderBy('h.id', 'asc')
            ->setParameter(':locale', substr($locale, 0, 2).'%')
            ->setParameter(':translationKey', $translationKey.'%');

        try {
            $helpText = $qb->getQuery()->getSingleResult();
        } catch (NoResultException $e) {
            $qb = $this->createQueryBuilder('h');
            $qb->where('h.locale LIKE :locale')
                ->andWhere('h.translationKey = :translationKey')
                ->orderBy('h.id', 'asc')
                ->setParameter(':locale', substr($locale, 0, 2).'%')
                ->setParameter(':translationKey', 'not_found');
            $helpText = $qb->getQuery()->getSingleResult();
        }

        return $helpText;
    }
395029
public static function getStaticSummonerSpell( string $summonerspell_key, string $locale = 'en_US', string $version = null ) : array
	{
		$data = self::getStaticSummonerSpells($locale, $version);
		if (isset($data['data'][$summonerspell_key]) == false)
			throw new ArgumentException('Summoner spell with given key was not found.', 404);

		return $data['data'][$summonerspell_key];
	}
684423
public static function arrayChangeKeys($data, $keyName = 'id')
    {
        $temp = [];
        if (is_array($data)) {
            foreach ($data as $key => $row) {
                if (isset($row[$keyName])) {
                    $temp[$row[$keyName]] = $row;
                } else {
                    $temp[] = $row;
                }
            }
        }
        return $temp;
    }
452818
public static String localizedKeyMacro(String keyName, Object[] params) {

        String parameters = "";
        if ((params != null) && (params.length > 0)) {
            for (int i = 0; i < params.length; i++) {
                if (params[i] != null) {
                    parameters += "|" + params[i].toString();
                }
            }
        }
        return ""
            + I_CmsMacroResolver.MACRO_DELIMITER
            + I_CmsMacroResolver.MACRO_START
            + CmsMacroResolver.KEY_LOCALIZED_PREFIX
            + keyName
            + parameters
            + I_CmsMacroResolver.MACRO_END;
    }
537148
public function find_dataset_names($text) {
        preg_match_all(self::PLACEHODLER_REGEX, $text, $matches);
        return array_combine($matches[1], $matches[1]);
    }
1171898
public function getNodeKeyedArray($xPath,$keyName,$valueName, $flat = true){
        $usePath = "{$xPath}/*[@*]";
        $res = $this->content->xpath($usePath);
        $return = array();
        if ( $res !== null){
            foreach ($res as $set){
               $key = (string)$set[$keyName];
               $value = (string)$set[$valueName];
               if ($flat === true){
                   $return[$key] = $value;
               } else {
                $return[] = array($key => $value);
               }
            }

            return $return;
        }
        return NULL;
    }
394804
public static function minLen($text, $minLen)
	{
	    if (is_array($minLen)) {
	        if (!isset($minLen['minLen'])) {
	            throw new \InvalidArgumentException('The $minLen argument must have "minLen" key');
	        }
	        $minLen = $minLen['minLen'];
	    }

	    return strlen($text) >= $minLen;
	}
692798
function languageNameListFromLocaleList( $localeList )
    {
        $languageList = array();
        foreach( $localeList as $locale )
            $languageList[] = $this->languageNameFromLocale( $locale );

        return $languageList;
    }
1340110
public function parseKeywordText($string)
    {
        $pattern = '/(?P<keywords>[^\s\.]+)(\s+(?:as\s+)?(?P<alias>.+))?/';
        if(preg_match_all($pattern, str_replace(BaseBuilder::DELIMITED_IDENTIFIERS, '', $string), $matches) > 0)
        {
            $alias = end($matches['alias']);
            if(!$alias)
            {
                $alias = null;
            }
            return [
                'keywords'  => $matches['keywords'],
                'alias'     => $alias,
            ];
        }
        else
        {
            return [];
        }
    }
831492
public static List<Locale> getLocales(String localeNames) {

        if (localeNames == null) {
            return null;
        }
        return getLocales(CmsStringUtil.splitAsList(localeNames, ','));
    }
84697
public function multiGet(array $keys, $localOnly = false)
    {
        $keys = array_unique($keys);
        $results = array();
        $others = array();
        foreach ($keys as $key) {
            $cacheKey = $this->cacheKey($key);
            if ($this->keepLocalCache && array_key_exists($cacheKey, $this->localCache))
                $results[$cacheKey] = $this->localCache[$cacheKey];
            else
                $others[] = $cacheKey;
        }

        if(!$localOnly) {
            $results = array_merge($results, ($cached = $this->cacheStore->multiGet($others)) == false ? array() : $cached);
            if($this->keepLocalCache && !empty($cached))
		        foreach($cached as $key => $value)
			        $this->localCache[$key] = $value;

            unset($cached);
        }
        unset($keys);
        unset($others);


        return $results;
    }
182671
public function indexLocale(string $projectKey, string $localeId, array $params = [])
    {
        if (isset($params['tags'])) {
            $params['q'] = 'tags:'.$params['tags'];
            unset($params['tags']);
        }

        $response = $this->httpGet(sprintf('/api/v2/projects/%s/locales/%s/translations', $projectKey, $localeId), $params);

        if (!$this->hydrator) {
            return $response;
        }

        if ($response->getStatusCode() !== 200 && $response->getStatusCode() !== 201) {
            $this->handleErrors($response);
        }

        return $this->hydrator->hydrate($response, Index::class);
    }
278516
function getLocalNsIndex( $text ) {
		$lctext = $this->lc( $text );
		$ids = $this->getNamespaceIds();
		return isset( $ids[$lctext] ) ? $ids[$lctext] : false;
	}