本文整理汇总了PHP中TYPO3\CMS\Core\Page\PageRenderer::setLanguage方法的典型用法代码示例。如果您正苦于以下问题:PHP PageRenderer::setLanguage方法的具体用法?PHP PageRenderer::setLanguage怎么用?PHP PageRenderer::setLanguage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TYPO3\CMS\Core\Page\PageRenderer
的用法示例。
在下文中一共展示了PageRenderer::setLanguage方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setupPage
/**
* Sets mandatory parameters for the view (pageRenderer)
*
* @return void
*/
protected function setupPage()
{
// Yes, hardcoded on purpose
$this->pageRenderer->setXmlPrologAndDocType('<!DOCTYPE html>');
$this->pageRenderer->setCharSet('utf-8');
$this->pageRenderer->setLanguage('default');
$this->pageRenderer->addMetaTag('<meta name="viewport" content="width=device-width, initial-scale=1">');
}
示例2: areInlineLanguageLabelsSelectedAndStripped
/**
* Tests the addInlineLanguageLabelFile() method.
*
* @test
*/
public function areInlineLanguageLabelsSelectedAndStripped()
{
$this->fixture->setLanguage($GLOBALS['LANG']->lang);
$this->fixture->addInlineLanguageLabelFile('EXT:lang/locallang_core.xml', 'labels.', 'lock');
$out = $this->fixture->render();
$this->assertContains('edRecord', $out);
$this->assertContains('edRecord_content', $out);
$this->assertContains('edRecordUser', $out);
}
示例3: initLLvars
/**
* Initializing the getLL variables needed.
*
* @return void
*/
public function initLLvars()
{
// Init languageDependencies list
$this->languageDependencies = array();
// Setting language key and split index:
$this->lang = $this->config['config']['language'] ?: 'default';
$this->pageRenderer->setLanguage($this->lang);
// Finding the requested language in this list based
// on the $lang key being inputted to this function.
/** @var $locales Locales */
$locales = GeneralUtility::makeInstance(Locales::class);
$locales->initialize();
// Language is found. Configure it:
if (in_array($this->lang, $locales->getLocales())) {
$this->languageDependencies[] = $this->lang;
foreach ($locales->getLocaleDependencies($this->lang) as $language) {
$this->languageDependencies[] = $language;
}
}
// Setting charsets:
$this->renderCharset = $this->csConvObj->parse_charset($this->config['config']['renderCharset'] ? $this->config['config']['renderCharset'] : 'utf-8');
// Rendering charset of HTML page.
$this->metaCharset = $this->csConvObj->parse_charset($this->config['config']['metaCharset'] ? $this->config['config']['metaCharset'] : $this->renderCharset);
}
示例4: initPageRenderer
/**
* Initializes the page renderer object
*/
protected function initPageRenderer()
{
if ($this->pageRenderer !== null) {
return;
}
$this->pageRenderer = GeneralUtility::makeInstance(PageRenderer::class);
$this->pageRenderer->setLanguage($GLOBALS['LANG']->lang);
$this->pageRenderer->enableConcatenateFiles();
$this->pageRenderer->enableCompressCss();
$this->pageRenderer->enableCompressJavascript();
// Add all JavaScript files defined in $this->jsFiles to the PageRenderer
foreach ($this->jsFilesNoConcatenation as $file) {
$this->pageRenderer->addJsFile($GLOBALS['BACK_PATH'] . $file, 'text/javascript', true, false, '', true);
}
// Add all JavaScript files defined in $this->jsFiles to the PageRenderer
foreach ($this->jsFiles as $file) {
$this->pageRenderer->addJsFile($GLOBALS['BACK_PATH'] . $file);
}
if ((int) $GLOBALS['TYPO3_CONF_VARS']['BE']['debug'] === 1) {
$this->pageRenderer->enableDebugMode();
}
}
示例5: getPageRenderer
/**
* Gets instance of PageRenderer configured with the current language, file references and debug settings
*
* @return \TYPO3\CMS\Core\Page\PageRenderer
*/
public function getPageRenderer()
{
if (!isset($this->pageRenderer)) {
$this->pageRenderer = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Page\\PageRenderer');
$this->pageRenderer->setLanguage($GLOBALS['LANG']->lang);
$this->pageRenderer->addCssLibrary($GLOBALS['BACK_PATH'] . 'contrib/normalize/normalize.css', 'stylesheet', 'all', '', TRUE, TRUE);
$this->pageRenderer->enableConcatenateFiles();
$this->pageRenderer->enableCompressCss();
$this->pageRenderer->enableCompressJavascript();
// Add all JavaScript files defined in $this->jsFiles to the PageRenderer
foreach ($this->jsFilesNoConcatenation as $file) {
$this->pageRenderer->addJsFile($GLOBALS['BACK_PATH'] . $file, 'text/javascript', TRUE, FALSE, '', TRUE);
}
// Add all JavaScript files defined in $this->jsFiles to the PageRenderer
foreach ($this->jsFiles as $file) {
$this->pageRenderer->addJsFile($GLOBALS['BACK_PATH'] . $file);
}
}
if ((int) $GLOBALS['TYPO3_CONF_VARS']['BE']['debug'] === 1) {
$this->pageRenderer->enableDebugMode();
}
return $this->pageRenderer;
}
示例6: getPageRenderer
/**
* Gets instance of PageRenderer configured with the current language, file references and debug settings
*
* @return \TYPO3\CMS\Core\Page\PageRenderer
*/
public function getPageRenderer()
{
if (!isset($this->pageRenderer)) {
$this->pageRenderer = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Page\\PageRenderer');
$this->pageRenderer->setTemplateFile(TYPO3_mainDir . 'templates/template_page_backend.html');
$this->pageRenderer->setLanguage($GLOBALS['LANG']->lang);
$this->pageRenderer->enableConcatenateFiles();
$this->pageRenderer->enableCompressCss();
$this->pageRenderer->enableCompressJavascript();
// Add all JavaScript files defined in $this->jsFiles to the PageRenderer
foreach ($this->jsFiles as $file) {
$this->pageRenderer->addJsFile($GLOBALS['BACK_PATH'] . $file);
}
}
if (intval($GLOBALS['TYPO3_CONF_VARS']['BE']['debug']) === 1) {
$this->pageRenderer->enableDebugMode();
}
return $this->pageRenderer;
}