Airplane_Mode_Core::available_translations PHP Method

available_translations() public method

Filter for languages list transient. Returns locally available translations to avoid request into wp.org translation API.
public available_translations ( mixed $translations ) : array
$translations mixed Translation data returned from transient API.
return array List of available languages.
        public function available_translations($translations)
        {
            // Bail if disabled.
            if (!$this->enabled()) {
                return $translations;
            }
            /**
             * If transient still contains list of languages just use those.
             * Otherwise fallback to mimicked data which we create here.
             */
            if ($translations && !empty($translations)) {
                return $translations;
            } else {
                $installed_languages = get_available_languages();
                return $this->get_offline_languages($installed_languages);
            }
        }