返回客户端程序期望服务器返回哪个国家的语言文档

Accept-Language: en-us,zh-cn
@return string
553463
public function getAcceptLanguage() 
    {
        if (!$this->language) {
            $language = explode(',', $this->getServer('HTTP_ACCEPT_LANGUAGE', ''));
            $this->language = $language[0] ? $language[0] : 'zh-cn';
        }
        
        return $this->language;
    }
214524
public function getTranslationsAttribute()
    {
        if (!settings('is_multilanguage') || !ContentType::find($this->type_id)->translatable)
            return null;

        $parent = $this->translation_id !== null ? Content::where('id', $this->translation_id)->first() : Content::where('id', $this->id)->first();
        $translations = Content::where('translation_id', $parent->id)->get();

        return $translations->merge([$parent]);
    }
155725
public function getLanguageList() {
		$files = glob($this->getPath().'messages_*.php');
		
		$startAt = strlen('messages_');
		$languages = array();
		foreach ($files as $file) {
			$base = basename($file);
			$languages[] = substr($base, $startAt, strrpos($base, '.php') - $startAt);
		}
		return $languages;
	}
37797
protected function _getContentTransferEncoding()
    {
        if ($this->transferEncoding) {
            return $this->transferEncoding;
        }

        $charset = strtoupper($this->charset);
        if (in_array($charset, $this->_charset8bit)) {
            return '8bit';
        }

        return '7bit';
    }
225398
public function getOptionsForm(): string
    {
        $descriptions = [
            'exact'     => I18N::translate('Match the exact text, even if it occurs in the middle of a word.'),
            'words'     => I18N::translate('Match the exact text, unless it occurs in the middle of a word.'),
            'wildcards' => I18N::translate('Use a “?” to match a single character, use “*” to match zero or more characters.'),
            /* I18N: http://en.wikipedia.org/wiki/Regular_expression */
            'regex'     => I18N::translate('Regular expressions are an advanced pattern matching technique.') . '<br>' . I18N::translate('See %s for more information.', '<a href="http://php.net/manual/regexp.reference.php">php.net/manual/regexp.reference.php</a>'),
        ];

        return
            '<div class="row form-group">' .
            '<label class="col-sm-3 col-form-label">' . I18N::translate('Search text/pattern') . '</label>' .
            '<div class="col-sm-9">' .
            '<input class="form-control" name="search" size="40" value="' . e($this->search) . '">' .
            '</div></div>' .
            '<div class="row form-group">' .
            '<label class="col-sm-3 col-form-label">' . I18N::translate('Replacement text') . '</label>' .
            '<div class="col-sm-9">' .
            '<input class="form-control" name="replace" size="40" value="' . e($this->replace) . '"></td></tr>' .
            '</div></div>' .
            '<div class="row form-group">' .
            '<label class="col-sm-3 col-form-label">' . I18N::translate('Search method') . '</label>' .
            '<div class="col-sm-9">' .
            '<select class="form-control" name="method">' .
            '<option value="exact" ' . ($this->method === 'exact' ? 'selected' : '') . '>' . I18N::translate('Exact text') . '</option>' .
            '<option value="words" ' . ($this->method === 'words' ? 'selected' : '') . '>' . I18N::translate('Whole words only') . '</option>' .
            '<option value="wildcards" ' . ($this->method === 'wildcards' ? 'selected' : '') . '>' . I18N::translate('Wildcards') . '</option>' .
            '<option value="regex" ' . ($this->method === 'regex' ? 'selected' : '') . '>' . I18N::translate('Regular expression') . '</option>' .
            '</select>' .
            '<p class="small text-muted">' . $descriptions[$this->method] . '</p>' . $this->error .
            '</div></div>' .
            '<div class="row form-group">' .
            '<label class="col-sm-3 col-form-label">' . I18N::translate('Case insensitive') . '</label>' .
            '<div class="col-sm-9">' .
            view('components/radios-inline', ['name' => 'case', 'selected' => $this->case, 'options' => [
                ''  => I18N::translate('no'),
                'i' => I18N::translate('yes'),
            ]]) .
            '<p class="small text-muted">' .
            /* I18N: Help text for "Case insensitive" searches */
            I18N::translate('Match both upper and lower case letters.') . '</p>' .
            '</div></div>' .
            parent::getOptionsForm();
    }
246449
private function getI18nStats()
	{
		$selected_instance   = $this->filter_post->getString( 'instance' );
		$selected_raw_locale = $this->filter_post->getString( 'locale' );

		list( $file_type, $language_code, $country_code_and_extension ) = explode( '_', $selected_raw_locale );
		$this->assign( 'language', $language_code );
		$locale = $language_code . '_' . $country_code_and_extension[0] . $country_code_and_extension[1];

		$literals = $this->getLiterals( $selected_instance );
		$this->assign( 'literals', $literals );

		try
		{
			\Sifo\I18N::setDomain( $file_type, $locale, $selected_instance );
			$translations_i18 = \Sifo\I18N::$translations;

			$missing_messages  = array_diff_key( $literals, $translations_i18[$file_type . '_' . $locale] );
			$leftover_messages = array_diff_key( $translations_i18[$file_type . '_' . $locale], $literals );

			$this->assign( 'selected_instance', $selected_instance );
			$this->assign( 'missing_messages', $missing_messages );
			$this->assign( 'leftover_messages', $leftover_messages );
			$this->assign( 'selected_locale', $selected_raw_locale );
			$this->assign( 'selected_charset', $this->filter_post->getString( 'charset' ) );
		}
		catch ( \Sifo\Exception_500 $exception )
		{
			$this->assign( 'error', $exception->getMessage() );
		}
	}
1254425
public function getTranslationsList()
    {
        $data = "";
        $melisCmsAuth = $this->getServiceLocator()->get('MelisCoreAuth');
        $melisCmsRights = $this->getServiceLocator()->get('MelisCoreRights');

        return $data;

    }
260873
public function detectlocale()
    {
        if (isset($GLOBALS['lang'])) {
            return $GLOBALS['lang'];
        } elseif (getenv('LC_ALL')) {
            return getenv('LC_ALL');
        } elseif (getenv('LC_MESSAGES')) {
            return getenv('LC_MESSAGES');
        } elseif (getenv('LANG')) {
            return getenv('LANG');
        }

        return 'en';
    }
1194361
private function getFullName()
    {
        //替换日期事件
        $t = time();
        $d = explode('-', date("Y-y-m-d-H-i-s"));
        $format = $this->config["pathFormat"];
        $format = str_replace("{yyyy}", $d[0], $format);
        $format = str_replace("{yy}", $d[1], $format);
        $format = str_replace("{mm}", $d[2], $format);
        $format = str_replace("{dd}", $d[3], $format);
        $format = str_replace("{hh}", $d[4], $format);
        $format = str_replace("{ii}", $d[5], $format);
        $format = str_replace("{ss}", $d[6], $format);
        $format = str_replace("{time}", $t, $format);
        //过滤文件名的非法自负,并替换文件名
        $oriName = substr($this->oriName, 0, strrpos($this->oriName, '.'));
        $oriName = preg_replace("/[\|\?\"\<\>\/\*\\\\]+/", '', $oriName);
        $format = str_replace("{filename}", $oriName, $format);
        //替换随机字符串
        $randNum = rand(1, 99999999) . rand(1, 99999999);
        if (preg_match("/\{rand\:([\d]*)\}/i", $format, $matches)) {
            $format = preg_replace("/\{rand\:[\d]*\}/i", substr($randNum, 0, $matches[1]), $format);
        }
        $ext = $this->getFileExt();
        return $format . $ext;
    }
1077042
public function getAcceptedEncodings()
    {
        if (null === $this->encodings) {
            if (isset($_SERVER['HTTP_ACCEPT_ENCODING'])) {
                $this->encodings = strtolower(trim($_SERVER['HTTP_ACCEPT_ENCODING']));
            } else {
                $this->encodings = '';
            }
        }

        return $this->encodings;
    }
426051
public function getCharset()
    {
        return (isset(Yii::$app->charset) ? Yii::$app->charset : null) ?: mb_internal_encoding();
    }
885284
public function getAcceptEncoding()
    {
        if ($this->acceptEncoding === null) {
            $this->acceptEncoding = isset($_SERVER['HTTP_ACCEPT_ENCODING']) ? $_SERVER['HTTP_ACCEPT_ENCODING'] : '';
        }

        return $this->acceptEncoding;
    }
1037681
protected function getFilesToExport()
    {
        $locales = $this->input->getOption('locales') ? explode(',', $this->input->getOption('locales')) : array();
        $domains = $this->input->getOption('domains') ? explode(',', $this->input->getOption('domains')) : array();

        return $this->getContainer()
            ->get('lexik_translation.translation_storage')
            ->getFilesByLocalesAndDomains($locales, $domains);
    }
376895
public Locale getAcceptLanguage() {
		// See section 14.4 of RFC 2616 (HTTP/1.1) for more information about how the Accept-Language header
		// must interpreted to determine the preferred language of the client.
		Locale preferredLocale = null;
		float q = 0;
		Iterator<Header> it = (Iterator<Header>) this.message
			.getHeaders(AcceptLanguageHeader.NAME);
		while (it.hasNext()) {
			AcceptLanguageHeader alh = (AcceptLanguageHeader) it.next();
			if(preferredLocale == null) {
				preferredLocale = alh.getAcceptLanguage();
				q = alh.getQValue();
			} else {
				if(alh.getQValue() > q) {
					preferredLocale = alh.getAcceptLanguage();
					q = alh.getQValue();
				}
			}
		}
		return preferredLocale;
	}
877979
public function toSixFigureString()
	{
		$hundredkmE = floor($this->easting / 100000);
		$hundredkmN = floor($this->northing / 100000);

		if ($hundredkmN < 5) {
			$firstLetter = ($hundredkmE < 5) ? 'S' : 'T';
		} else if ($hundredkmN < 10) {
			$firstLetter = ($hundredkmE < 5) ? 'N' : 'O';
		} else {
			$firstLetter = 'H';
		}

		$index = 65 + ((4 - ($hundredkmN % 5)) * 5) + ($hundredkmE % 5);
		$ti = $index;
		if ($index >= 73) {
			$index++;
		}

		$secondLetter = chr($index);

		$e = round(($this->easting - (100000 * $hundredkmE)) / 100);
		$n = round(($this->northing - (100000 * $hundredkmN)) / 100);

		return sprintf('%s%s%03d%03d', $firstLetter, $secondLetter, $e, $n);
	}
584138
public function getCharset() {
		if (!isset($this->charset)) {
			$numOfMatches = preg_match('/charset\s*=([^;]*)/', $this->getHeader('Content-Type'), $matches);
			if ($numOfMatches) {
				$this->charset = trim($matches[1]);
			} else {
				$this->charset = '';
			}
		}
		return $this->charset;
	}
364028
public function getLanguage()
    {
        if (!is_array($this->languages)) {
            LanguageDetector::detect($this, $this->getAcceptLanguage());
        }

        return strtolower(substr(reset($this->languages), 0, 2));
    }