Retrieves all languages availables with Google Translate API
If a target language is specified, returns languages name translated in target language.

@param string $target A target language to translate languages names

@return string
8500
public function get($target = null)
    {
        $options = ['key' => $this->apiKey];

        if (null !== $target) {
            $this->url = sprintf('%s&target={target}', $this->url);

            $options['target'] = $target;
        }

        return $this->process($options);
    }
1229041
public function getMessageForAllLanguages($key, $lang = null) {
		
		if (!$this->messages) {
			$this->loadAllMessages();
		}
		
		$messageArray = array();
		foreach ($this->messages as $language=>$messageLanguage) {
			if(is_null($lang) || $lang == "")
				$messageArray[$language] = $messageLanguage->getMessage($key);
			elseif($lang == $language)
				$messageArray[$language] = $messageLanguage->getMessage($key);
		}
		return $messageArray;
	}
1095574
protected function translate($key)
  {
    $key = strtoupper($key);
    if ( isset(self::$translations[$key]) ){
      return self::$translations[$key];
    }
    
    return $key;
  }
796866
public function copyLanguage($dir, $target)
	{
		// Equals administrator/language or language
		$path  = $this->getSourceFolder() . "/" . $dir;
		$files = array();

		$hdl = opendir($path);

		while ($entry = readdir($hdl))
		{
			$p = $path . "/" . $entry;

			// Which languages do we have
			// Ignore hidden files
			if (substr($entry, 0, 1) != '.')
			{
				// Language folders
				if (!is_file($p))
				{
					// Make folder at destination
					$this->_mkdir($target . "/" . $dir . "/" . $entry);

					$fileHdl = opendir($p);

					while ($file = readdir($fileHdl))
					{
						// Only copy language files for this extension (and sys files..)
						if (substr($file, 0, 1) != '.' && strpos($file, $this->ext . "."))
						{
							$files[] = array($entry => $file);

							// Copy file
							$this->_copy($p . "/" . $file, $target . "/" . $dir . "/" . $entry . "/" . $file);
						}
					}

					closedir($fileHdl);
				}
			}
		}

		closedir($hdl);

		return $files;
	}
790056
public function getLanguage() {
        if (!isset($this->respondentLanguage)) {
            $this->respondentLanguage = $this->_gemsData['grs_iso_lang'];
        }
        return $this->respondentLanguage;
    }
868757
public function apply($target)
    {
        $filters = $this->getFilters();

        foreach ($filters as $filter) {
            $target = preg_replace($filter->search, $filter->replace, $target);
        }

        return $target;
    }
63439
public function getAllMessages($language = null) {
	
		$this->loadAllMessages();

		// The array of messages by message, then by language:
		// array(message_key => array(language => message))
		$msgs = array();
	
		$keys = $this->getAllKeys();
	
		$languages = $this->getSupportedLanguages();
	
		foreach ($keys as $key) {
			$msgs[$key] = $this->getMessageForAllLanguages($key, $language);
		}
	
		ksort($msgs);
		$response = array("languages"=>$languages, "msgs"=>$msgs);
		return $response;
	}
513978
public function getBaseStylesheet($target){
        $base = $this->getResolvedBase($target);
        if(is_string($base)){
            return $base;
        }else if(is_array($base) && isset($base['css'])){
            return $base['css'];
        }
        return null;
    }
642858
public function moveTo(string $target): ?string
    {
        $ret = $this->handle->rpoplpush($this->name, $target);
        return (false === $ret) ? null : $ret;
    }
267169
private function getLanguage(string $language): string
    {
        $language = trim($language);

        if (strlen($language) !== 2) {
            throw new InvalidArgumentException("Unexpected language code ({$language}), codes should be 2 characters");
        }

        return $language;
    }
184654
public function equals($target) {
		return $target instanceof self &&
			$this->languageCode === $target->languageCode &&
			$this->sentenceTree->equals($target->sentenceTree) &&
			$this->measures == $target->measures;
	}
73838
private function getLanguages($options)
    {
        if (!empty($options['lang'])) {
            return Text::getArrayFromString($options['lang']);
        }

        return $this->siteAccessHelper->getLanguages($options['mandatorId'], $options['siteaccess']);
    }
621078
private function identifyRequest($target = false)
    {
        $retval = false;

        $this->locateURI();

        $nb_engine = CNabuEngine::getEngine();

        if ($target) {
            $temp_target = CNabuSiteTarget::findByURL($this->nb_site, $this->page_uri);
            if ($temp_target instanceof CNabuSiteTarget && $temp_target->isValueNumeric('nb_language_id')) {
                $nb_language = new CNabuLanguage($temp_target);
                if ($nb_language->isFetched()) {
                    $this->nb_language = $nb_language;
                } else {
                    $this->nb_language = $this->nb_site->getDefaultLanguage();
                }
            }

            if (!($target instanceof CNabuSiteTarget) &&
                is_numeric($nb_site_target_id = nb_getMixedValue($target, 'nb_site_target_id'))
            ) {
                $target = new CNabuSiteTarget($nb_site_target_id);
                if ($target->isFetched()) {
                    $this->nb_site_target = $target;
                }
            } else {
                $this->nb_site_target = $target;
            }
            if ($this->nb_site_target instanceof CNabuSiteTarget &&
                $this->nb_language === null && $this->nb_site_target->isValueNumeric('nb_language_id')) {
                $this->nb_language = new CNabuLanguage($this->nb_site_target->getValue('nb_language_id'));
                if ($this->nb_language->isNew()) {
                    $this->nb_language = null;
                }
            }
            if ($this->nb_language === null) {
                $this->nb_language = $this->nb_site->getDefaultLanguage();
            }
            if ($this->nb_site_target !== null &&
                $this->nb_language !== null &&
                $this->nb_site_target->hasTranslation($this->nb_language)
            ) {
                $this->nb_response->setHTTPResponseCode(200);
                $nb_engine->traceLog('Page Status', 'Found');

                $retval = true;
            }
        } elseif ($this->findTargetByURL($this->page_uri)) {
            $nb_engine->traceLog("Page ID", $this->nb_site_target->getId());

            if ($this->nb_language === null) {
                throw new ENabuCoreException(ENabuCoreException::ERROR_LANGUAGE_NOT_FOUND_FOR_PAGE_URI);
            }
            $nb_engine->traceLog("Page language", $this->nb_language->getISO6391());
            $nb_engine->traceLog('Page Status', 'Found');

            $retval = true;
        }

        if (!($this->nb_site_target instanceof CNabuSiteTarget) || !$retval) {
            $nb_engine->traceLog('Page Status', 'Not found');
            $link = $this->nb_site->getPageNotFoundTargetLink();
            if ($link->isLinkable()) {
                if ($link->isTranslatedTarget()) {
                    $this->nb_language = $this->nb_site->getDefaultLanguage();
                    if ($this->nb_language instanceof CNabuLanguage &&
                        ($nb_site_target = $link->getTranslatedObject()) instanceof CNabuSiteTarget &&
                        ($nb_site_target->getTranslation($this->nb_language) instanceof CNabuSiteTargetLanguage)
                    ) {
                        $this->nb_site_target = $nb_site_target;
                        $retval = true;
                    }
                }
            }

            if ($this->nb_response->getHTTPResponseCode() === 0) {
                $this->nb_response->setHTTPResponseCode(404);
            }
        }

        return $retval;
    }
67269
public function lang($lang = NULL)
	{
		if ( ! func_num_args())
		{
			return $this->_lang;
		}
		$this->_lang = $lang;
		return $this;
	}
97722
public function getLanguageCode($language)
    {
        switch ($language) {
            case PaymentHandlerBase::LANGUAGE_EN:
            case PaymentHandlerBase::LANGUAGE_ET:
                return $language;
            default:
                return PaymentHandlerBase::LANGUAGE_EN;
        }
    }
175881
public function getPageLink($navId, $target, $lang = null)
    {
        $linkQuery = Yii::$app->menu->find();
        $linkQuery->where(['nav_id' => $navId]);
        $linkQuery->with(['hidden']);
        if ($lang) {
            $linkQuery->lang($lang);
        }
        $link = $linkQuery->one();
        
        // if a page is found, set the target value from the config.
        if ($link) {
            $link->setTarget($target);
        }
        
        return $link;
    }
308360
public function has($target, $language)
    {
        $key = $target->getId().'_'.$language;

        return isset($this->items[$key]);
    }