Return an array listing untranslated languages available

@param bool $includeUnpublished also list unpublished translations

@return array the page untranslated languages
343450
public function untranslatedLanguages($includeUnpublished = false)
    {
        $filename = substr($this->name, 0, -strlen($this->extension()));
        $config = Grav::instance()['config'];
        $languages = $config->get('system.languages.supported', []);
        $untranslatedLanguages = [];

        foreach ($languages as $language) {
            $path = $this->path . DS . $this->folder . DS . $filename . '.' . $language . '.md';
            if (file_exists($path)) {
                $aPage = new Page();
                $aPage->init(new \SplFileInfo($path), $language . '.md');
                if ($includeUnpublished && !$aPage->published()) {
                    $untranslatedLanguages[] = $language;
                }
            } else {
                $untranslatedLanguages[] = $language;
            }
        }

        return $untranslatedLanguages;
    }
1341122
protected function get_translation_updates() {
		$available = $this->get_installed_languages();

		$func = function() use ( $available ) {
			return $available;
		};

		switch ( $this->obj_type ) {
			case 'plugins':
				add_filter( 'plugins_update_check_locales', $func );

				wp_clean_plugins_cache();
				// Check for Plugin translation updates.
				wp_update_plugins();

				remove_filter( 'plugins_update_check_locales', $func );

				$transient = 'update_plugins';
				break;
			case 'themes':
				add_filter( 'themes_update_check_locales', $func );

				wp_clean_themes_cache();
				// Check for Theme translation updates.
				wp_update_themes();

				remove_filter( 'themes_update_check_locales', $func );

				$transient = 'update_themes';
				break;
			default:
				delete_site_transient( 'update_core' );

				// Check for Core translation updates.
				wp_version_check();

				$transient = 'update_core';
				break;
		}

		$updates   = array();
		$transient = get_site_transient( $transient );

		if ( empty( $transient->translations ) ) {
			return $updates;
		}

		foreach ( $transient->translations as $translation ) {
			$updates[] = (object) $translation;
		}

		return $updates;
	}
1091152
public function get_supported_languages($full_names=false)
    {
        // return array
        $back = array();

        // we walk the lang root
        $dir = dir($this->language_path);

        // foreach entry
        while (false !== ($entry = $dir->read()))
        {
            $full_path = $this->language_path.$entry;

            // Skip all dirs
            if (is_dir($full_path)) {
                continue;
            }

            // we only want lang.php files
            if (!preg_match('/^([^.]+)\.php$/', $entry, $matches)) {
                continue;
            }

            // Raw lang name is here
            $langname = $matches[1];

            // We want the fullname too?
            if ($full_names === true)
            {
                if (false !== ($fullname = $this->get_language_fullname($langname)))
                {
                    $back[$langname] = $fullname; // we go associative
                }
            }
            else
            {
                // just store raw langname
                $back[] = $langname;
            }
        }

        $dir->close();

        return $back;
    }
453517
public function getAvailableLanguages()
    {
        $languages = [];

        $paths = $this->fileSystem->getDirectories($this->getLanguagesPath());

        foreach ($paths as $path) {
            $languages[] = substr($path, strlen($this->getLanguagesPath()) + 1);
        }

        return $languages;
    }
50587
public function filter($translations)
    {
        $cleanedTranslations = array();

        foreach ($translations as $pluginName => $pluginTranslations) {

            if (empty($this->baseTranslations[$pluginName])) {
                $this->filteredData[$pluginName] = $pluginTranslations;
                continue;
            }

            foreach ($pluginTranslations as $key => $translation) {
                if (isset($this->baseTranslations[$pluginName][$key])) {
                    $cleanedTranslations[$pluginName][$key] = $translation;
                }
            }

            if (!empty($cleanedTranslations[$pluginName])) {
                $diff = array_diff($translations[$pluginName], $cleanedTranslations[$pluginName]);
            } else {
                $diff = $translations[$pluginName];
            }
            if (!empty($diff)) {
                $this->filteredData[$pluginName] = $diff;
            }
        }

        return $cleanedTranslations;
    }
1001451
public function getTranslatedList($user_id, $status = true)
    {
        $conditions = array(
            'status' => $status,
            'user_id' => $user_id
        );

        $addresses = array();
        foreach ((array) $this->getList($conditions) as $address_id => $address) {
            $addresses[$address_id] = $this->getTranslated($address, true);
        }

        return $addresses;
    }
1069841
private static function toArray(Translations $translations, $includeHeaders, $forceArray = false)
    {
        $pluralForm = $translations->getPluralForms();
        $pluralSize = is_array($pluralForm) ? ($pluralForm[0] - 1) : null;
        $messages = [];

        if ($includeHeaders) {
            $messages[''] = [
                '' => [self::generateHeaders($translations)],
            ];
        }

        foreach ($translations as $translation) {
            if ($translation->isDisabled()) {
                continue;
            }

            $context = $translation->getContext();
            $original = $translation->getOriginal();

            if (!isset($messages[$context])) {
                $messages[$context] = [];
            }

            if ($translation->hasPluralTranslations(true)) {
                $messages[$context][$original] = $translation->getPluralTranslations($pluralSize);
                array_unshift($messages[$context][$original], $translation->getTranslation());
            } elseif ($forceArray) {
                $messages[$context][$original] = [$translation->getTranslation()];
            } else {
                $messages[$context][$original] = $translation->getTranslation();
            }
        }

        return [
            'domain' => $translations->getDomain(),
            'plural-forms' => $translations->getHeader('Plural-Forms'),
            'messages' => $messages,
        ];
    }
119087
public function getSupportedLanguages(): array
    {
        if (null === $this->supportedLanguages) {
            $process = $this->createProcess('dump dicts');
            $process->run();
            if (!$process->isSuccessful()) {
                throw new ExternalProgramFailedException(
                    $process->getCommandLine(),
                    $process->getErrorOutput(),
                    $process->getExitCode()
                );
            }

            $languages = [];

            $output = explode(PHP_EOL, $process->getOutput());
            foreach ($output as $line) {
                $name = trim($line);
                if (strpos($name, '-variant') !== false) {
                    // Skip variants
                    continue;
                }
                $languages[$name] = true;
            }

            $languages = array_keys($languages);
            sort($languages);
            $this->supportedLanguages = $languages;
        }

        return $this->supportedLanguages;
    }
268832
private function fetchLocales($available = true)
    {
        $available_locales = $this->getAvailableLocales();
        $current_locales = $this->translations()->lists('locale')->toArray();

        return array_filter($available_locales, function ($v) use ($current_locales, $available) {
            return $available ? in_array($v, $current_locales) : !in_array($v, $current_locales);
        }, ARRAY_FILTER_USE_BOTH);
    }
1365292
public function getNodeTranslation($lang, $includeOffline = false)
    {
        $nodeTranslations = $this->getNodeTranslations($includeOffline);
        /* @var NodeTranslation $nodeTranslation */
        foreach ($nodeTranslations as $nodeTranslation) {
            if ($lang == $nodeTranslation->getLang()) {
                return $nodeTranslation;
            }
        }

        return null;
    }
1098011
public function getLanguageFiles(bool $useDefaultLocale = false)
    {
        $files = [];

        if ($useDefaultLocale) {
            $locale = $this->getDefaultLocale();
        } else {
            $locale = $this->getLocale();
        }

        $paths = $this->fileSystem->getFiles($this->getLanguagesPath() . DIRECTORY_SEPARATOR . $locale);

        foreach ($paths as $path) {
            $completeFileName = substr($path, strlen($this->getLanguagesPath()) + strlen($locale) + 2);

            $files[] = array_pad(explode(".", $completeFileName), 2, '.ext')[0];
        }

        return $files;
    }
1006693
public function getAvailableLanguages()
    {
        $translationSiteAccesses = $this->configResolver->getParameter('translation_siteaccesses');
        $relatedSiteAccesses = $translationSiteAccesses ?: $this->configResolver->getParameter('related_siteaccesses');
        $availableLanguages = array();
        $currentLanguages = $this->configResolver->getParameter('languages');
        $availableLanguages[] = array_shift($currentLanguages);

        foreach ($relatedSiteAccesses as $sa) {
            $languages = $this->configResolver->getParameter('languages', null, $sa);
            $availableLanguages[] = array_shift($languages);
        }

        sort($availableLanguages);

        return array_unique($availableLanguages);
    }
466168
public function unpublishArticles(ArticleUnpublishMessage $message): array
    {
        $path = sprintf('sites/%d/articles/unpublish', $message->getSiteId());
        $data = ['api_unpublish_articles_global' => $message->build()];

        $response = $this->getClient()->sendRequest(RequestStatus::POST, $path, $data);

        /** @var Article[] $models */
        $models = $this->getModelFactory()->createMany(Article::class, $response);

        return $models;
    }
45881
public function hasTranslation($language_id = null, $checkIsPublished = true)
    {
        /** @var \DevGroup\Multilingual\Multilingual $multilingual */
        $multilingual = Yii::$app->multilingual;
        if ($language_id === null) {
            $language_id = $multilingual->language_id;
        }
        /** @var ActiveRecord $owner */
        $owner = $this->owner;

        if ($language_id === $multilingual->language_id) {
            // we were asked for default language
            /** @var ActiveRecord $translation */
            $translation = $owner->{$this->defaultTranslationRelation};
            if ($translation === null) {
                return false;
            }

            if ($checkIsPublished === true) {
                return $this->checkIsPublished($translation);
            }
        }

        /* @var ActiveRecord $translation */
        foreach ($owner->{$this->translationRelation} as $translation) {
            if ($translation->getAttribute('language_id') === $language_id) {
                if ($checkIsPublished === true) {
                    return $this->checkIsPublished($translation);
                } else {
                    return true;
                }
            }
        }
        return false;
    }
1263096
function translationList( $language = false, $asObject = true )
    {
        $db = eZDB::instance();

        $languageSQL = '';
        if ( $language !== false )
        {
            $language = $db->escapeString( $language );
            $languageSQL = "AND language_code!='$language'";
        }

        $query = "SELECT DISTINCT language_code
                  FROM ezcontentobject_attribute
                  WHERE contentobject_id='$this->ContentObjectID' AND version='$this->Version'
                  $languageSQL
                  ORDER BY language_code";

        $languageCodes = $db->arrayQuery( $query );

        $translations = array();
        if ( $asObject )
        {
            foreach ( $languageCodes as $languageCode )
            {
                $translations[] = new eZContentObjectTranslation( $this->ContentObjectID, $this->Version, $languageCode["language_code"] );
            }
        }
        else
        {
            foreach ( $languageCodes as $languageCode )
            {
                $translations[] = $languageCode["language_code"];
            }
        }

        return $translations;
    }
792460
function getSupportedLanguages() {
		return [
			'grc' => __( 'Ancient Greek', 'pressbooks' ),
			'ar' => __( 'Arabic', 'pressbooks' ),
			'bn' => __( 'Bengali', 'pressbooks' ),
			'he' => __( 'Biblical Hebrew', 'pressbooks' ),
			'cans' => __( 'Canadian Indigenous Syllabics', 'pressbooks' ),
			'hi' => __( 'Devanagari (Hindi and Sanskrit)', 'pressbooks' ),
			'zh_HANS' => __( 'Chinese (Simplified)', 'pressbooks' ),
			'zh_HANT' => __( 'Chinese (Traditional)', 'pressbooks' ),
			'cop' => __( 'Coptic', 'pressbooks' ),
			'gu' => __( 'Gujarati', 'pressbooks' ),
			'pan' => __( 'Punjabi (Gurmukhi)', 'pressbooks' ),
			'ja' => __( 'Japanese', 'pressbooks' ),
			'kn' => __( 'Kannada', 'pressbooks' ),
			'ko' => __( 'Korean', 'pressbooks' ),
			'ml' => __( 'Malayalam', 'pressbooks' ),
			'or' => __( 'Odia', 'pressbooks' ),
			'syr' => __( 'Syriac', 'pressbooks' ),
			'ta' => __( 'Tamil', 'pressbooks' ),
			'te' => __( 'Telugu', 'pressbooks' ),
			'bo' => __( 'Tibetan', 'pressbooks' ),
			'tr' => __( 'Turkish', 'pressbooks' ),
		];
	}
694937
public function getUsedLocales()
    {
        $queryBuilder = $this->createQueryBuilder('blog')
            ->select('DISTINCT(b_translation.locale) AS locale')
            ->join('blog.translations', 'b_translation');

        $locales = [];
        foreach ($queryBuilder->getQuery()->getResult() as $locale) {
            $locales[] = $locale['locale'];
        }

        return $locales;
    }