@param null $langcode
481271
public function process($langcode = NULL)
  {
    if ($this->computed == TRUE) {
      return;
    }
    $values = [];

    $item = $this->getParent();
    if (!empty($item->value)) {


      /* @var $item StrawberryFieldItem */
      $flattened = $item->provideFlatten(FALSE);

      $definition = $this->getDataDefinition();

      // This key is passed by the property definition in the field class
      $needle = $definition['settings']['jsonkey'];

      // @TODO, see if we need to quote everything
      if (isset($flattened[$needle]) && is_array($flattened[$needle])) {
        foreach ($flattened[$needle] as &$item) {
          // If this is true we have a complex structure nested
          // But Solr won't be able to deal with it. Lets jsonencode it.
          if (is_array($item)) {
            // @TODO should we allow unicode directly?
            $item = json_encode($item,JSON_UNESCAPED_UNICODE);
          }
        }
        // This is an array, don't double nest to make the normalizer happy.
        $values = array_map('trim', $flattened[$needle]);
      }
      elseif (isset($flattened[$needle])) {
        $values[] = trim($flattened[$needle]);
      }

      /*foreach ($flattened as $graphitems) {
        if (isset($graphitems[$needle])) {
          if (is_array($graphitems[$needle])) {
            $values[] = implode(",", $graphitems[$needle]);
          }
          else {
            $values[] = $graphitems[$needle];
          }
        }

      }*/

      $this->processed = array_values($values);
      foreach ($this->processed as $delta => $item) {
        $this->list[$delta] = $this->createItem($delta, $item);
      }
    }
    else {
      $this->processed = NULL;
    }
    $this->computed = TRUE;
  }
566323
function removeTranslation( $languageCode )
    {

        $versionNum = $this->attribute( 'version' );

        $contentObjectAttributes = $this->contentObjectAttributes( $languageCode );

        $db = eZDB::instance();
        $db->begin();
        foreach ( $contentObjectAttributes as $attribute )
        {
            $attribute->removeThis( $attribute->attribute( 'id' ), $versionNum );
        }
        $db->commit();

        $this->updateLanguageMask();
    }
45850
public function getLanguageName(string $languageCode): string
    {
        $posixLanguageCode = $this->localeConverter->convertToPOSIX($languageCode);
        if ($posixLanguageCode === null) {
            return '';
        }

        $posixLanguageCode = mb_substr($posixLanguageCode, 0, 2);
        $languageName = Intl::getLanguageBundle()->getLanguageName($posixLanguageCode, null, $posixLanguageCode);

        return ucwords($languageName);
    }
394897
protected function install_language_pack($langcode) {

        // initialise new component installer to process this language
        $installer = new component_installer('https://download.moodle.org', 'download.php/direct/langpack/' . $this->version,
            $langcode . '.zip', 'languages.md5', 'lang');

        if (!$installer->requisitesok) {
            throw new lang_installer_exception('installer_requisites_check_failed');
        }

        $status = $installer->install();

        if ($status == COMPONENT_ERROR) {
            if ($installer->get_error() === 'remotedownloaderror') {
                return self::RESULT_DOWNLOADERROR;
            } else {
                throw new lang_installer_exception($installer->get_error(), $langcode);
            }

        } else if ($status == COMPONENT_UPTODATE) {
            return self::RESULT_UPTODATE;

        } else if ($status == COMPONENT_INSTALLED) {
            return self::RESULT_INSTALLED;

        } else {
            throw new lang_installer_exception('unexpected_installer_result', $status);
        }
    }
50420
public function listGlobalAliases($languageCode = null, $offset = 0, $limit = -1)
    {
        return $this->service->listGlobalAliases($languageCode, $offset, $limit);
    }
1056625
private function getLanguage(string $languageCode): Language
    {
        try {
            $language = $this->languageService->loadLanguage($languageCode);
        } catch (NotFoundException $e) {
            throw new NotFoundHttpException("Language $languageCode not found!");
        }

        return $language;
    }
207180
public function offsetGet($langcode)
    {
        $noDefaultVersion = $this->getDefault() !== $langcode
            and ! isset($this->lang[$this->getDefault()][$this->getCategory()]);
        if (!isset($this->lang[$langcode][$this->getCategory()])) {
            if ($this->isFileExistsInSubDir($langcode)) {
                $this->loadFromFileInSubDir($langcode);
            } elseif ($this->isFileExistsWithSuffix($langcode)) {
                $this->loadFromFileWithSuffix($langcode);
            } elseif ($this->isFileExistsWithoutSuffix($langcode)) {
                $this->loadFromFileWithoutSuffix($langcode);
            } elseif ($noDefaultVersion and $this->isFileExistsInSubDir($this->getDefault())) {
                $langcode = $this->getDefault();
                $this->loadFromFileInSubDir($langcode);
            } elseif ($noDefaultVersion and $this->isFileExistsWithSuffix($this->getDefault())) {
                $langcode = $this->getDefault();
                $this->loadFromFileWithSuffix($langcode);
            } elseif ($noDefaultVersion and $this->isFileExistsWithoutSuffix($this->getDefault())) {
                $langcode = $this->getDefault();
                $this->loadFromFileWithoutSuffix($langcode);
            }
        }

        return $this->lang[$langcode][$this->getCategory()];
    }
1224883
public function error($msg, Token $token = null, $code = 0)
    {
        $error = new ParserException(
            Translator::gettext($msg),
            $token,
            $code
        );
        parent::error($error);
    }
327637
public function language($code, $locale = null)
    {
        $codes = explode('_', $code);

        $name = Intl::getLanguageBundle()->getLanguageName(
            $codes[0],
            $codes[1] ?? null,
            $locale ?: $this->localeDetector->getLocale()
        );

        return $name ? $this->fixCharset($name) : '';
    }
935374
public function loadLanguage($code) {
        static $languages_seen = array(); // recursion guard

        // abort if we've already loaded it
        if (isset($this->cache[$code])) return;

        // generate filename
        $filename = $this->dir . '/Language/messages/' . $code . '.php';

        // default fallback : may be overwritten by the ensuing include
        $fallback = ($code != 'en') ? 'en' : false;

        // load primary localisation
        if (!file_exists($filename)) {
            // skip the include: will rely solely on fallback
            $filename = $this->dir . '/Language/messages/en.php';
            $cache = array();
        } else {
            include $filename;
            $cache = compact($this->keys);
        }

        // load fallback localisation
        if (!empty($fallback)) {

            // infinite recursion guard
            if (isset($languages_seen[$code])) {
                trigger_error('Circular fallback reference in language ' .
                    $code, E_USER_ERROR);
                $fallback = 'en';
            }
            $language_seen[$code] = true;

            // load the fallback recursively
            $this->loadLanguage($fallback);
            $fallback_cache = $this->cache[$fallback];

            // merge fallback with current language
            foreach ( $this->keys as $key ) {
                if (isset($cache[$key]) && isset($fallback_cache[$key])) {
                    if (isset($this->mergeable_keys_map[$key])) {
                        $cache[$key] = $cache[$key] + $fallback_cache[$key];
                    } elseif (isset($this->mergeable_keys_list[$key])) {
                        $cache[$key] = array_merge( $fallback_cache[$key], $cache[$key] );
                    }
                } else {
                    $cache[$key] = $fallback_cache[$key];
                }
            }

        }

        // save to cache for later retrieval
        $this->cache[$code] = $cache;

        return;
    }
552090
public function deleteTranslationFromContent($contentId, $languageCode)
    {
        try {
            return $this->innerGateway->deleteTranslationFromContent($contentId, $languageCode);
        } catch (DBALException $e) {
            throw new RuntimeException('Database error', 0, $e);
        } catch (PDOException $e) {
            throw new RuntimeException('Database error', 0, $e);
        }
    }
1339805
protected function mergeModuleTranslations($langcode = null)
    {
        $modules = $this->module->getEnabled();

        // Sort modules in descending order
        // More important modules go first so their translations will be added earlier
        gplcart_array_sort($modules, 'weight', false);

        foreach ($modules as $module) {
            $file = $this->getFile($langcode, $module['module_id']);
            if (is_file($file)) {
                $this->mergeTranslation($file, $langcode);
            }
        }
    }
253035
protected function setLanguage($code)
    {
        $this->data_language = array();

        if (!empty($code)) {

            $this->data_language = $this->language->get($code);

            if (empty($this->data_language)) {
                $this->outputHttpStatus(404);
            }
        }
    }
197757
protected function _validateLanguageCode($langCode)
    {
        if (!$this->_langHelper->validateLanguageCode($langCode)) {
            throw Mage::exception('Radial_Core', $this->_coreHelper->__(self::INVALID_LANGUAGE_CODE_MESSAGE));
        }
        return $this;
    }
670264
public static function validateLanguageCode(string $languageCode = null): string
    {
        // We allow empty languageCode in order to quit asking for more
        if (empty($languageCode)) {
            return '';
        }

        if (!preg_match('/^[a-z][a-z][a-z]-[A-Z][A-Z]$/', $languageCode)) {
            throw new InvalidArgumentException('Language code name is not valid.');
        }

        return $languageCode;
    }
831847
public function loadJsTranslation($langcode = null)
    {
        $strings = $this->loadTranslation($this->getContextJsFile($langcode));

        $translations = array();
        foreach ($strings as $source => $translation) {
            if (isset($translation[0]) && $translation[0] !== '') {
                $translations[$source] = $translation;
            }
        }

        return $translations;
    }
1322253
public function deleteLanguage(string $project, string $langCode): ResponseInterface
    {
        return $this->client->sendRequest($this->createRequest('DELETE', $this->createUri("/api/2/project/$project/language/$langCode/")));
    }