Typo3默认语言标签和标志

Ant*_*kiy 1 multilingual typo3 typoscript typo3-6.1.x

我正在使用Typo3 v6.1,并尝试设置多语言站点。问题是我无法更改默认语言标签。我究竟做错了什么?

根据这个这个,这是我的TypoScript配置

###################################################
# language handling
###################################################

mod.SHARED {
    defaultLanguageFlag = de
    defaultLanguageLabel = Deutsch
}

config {
    sys_language_uid = 0
    language = de
    locale_all = de_DE.UTF-8
    htmlTag_langKey = de_DE
}

[globalVar = GP:L = 1]
    config {
        sys_language_uid = 1
        language = en
        locale_all = en_GB.UTF-8
        htmlTag_langKey = en_GB
    }
[end]
Run Code Online (Sandbox Code Playgroud)

因此语言设置可以正常工作,并且我可以本地化页面,但是默认语言(uid = 0)仍显示为“ Default”而不是“ Deutsch”。我以为也许我正在使用旧设置,并尝试通过Typo3内核进行调试,但看起来这些设置仍在多个地方使用,这是其中之一:

#/typo3/sysext/backend/Classes/Configuration/TranslationConfigurationProvider.php
$languageIconTitles[0] = array(
    'uid' => 0,
    'title' => strlen($modSharedTSconfig['properties']['defaultLanguageLabel']) ? $modSharedTSconfig['properties']['defaultLanguageLabel'] . ' (' . $GLOBALS['LANG']->sl('LLL:EXT:lang/locallang_mod_web_list.xlf:defaultLanguage') . ')' : $GLOBALS['LANG']->sl('LLL:EXT:lang/locallang_mod_web_list.xlf:defaultLanguage'),
    'ISOcode' => 'DEF',
    'flagIcon' => strlen($modSharedTSconfig['properties']['defaultLanguageFlag']) ? 'flags-' . $modSharedTSconfig['properties']['defaultLanguageFlag'] : 'empty-empty'
);
Run Code Online (Sandbox Code Playgroud)

问题是Typo3似乎跳过了我的设置(尽管我确实在对象浏览器中看到了它们)。之后,我还尝试了Typo3的较早版本-4.7.12,但也无法解决((((


更新:根据biesior的回答,我需要将该代码添加到PageTS config中。这对于Typo3版本(4. *和6. *)都适用,但是了解这一概念也很重要。并且可以代表扩展名更改默认(即全局)PageTS配置:

# /ext_localconf.php of your typo3 v6.* extension:
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPageTSConfig(
    'mod.SHARED {
        defaultLanguageFlag = de.gif
        defaultLanguageLabel = Deutsch
    }'
);
Run Code Online (Sandbox Code Playgroud)

要么

# /ext_localconf.php of your typo3 v4.* extension:
t3lib_extMgm::addPageTSConfig(
    ...
);
Run Code Online (Sandbox Code Playgroud)

bie*_*ior 5

此代码需要放置在PageTS(根页面的)TypoScript模板中

mod.SHARED {
    defaultLanguageFlag = de
    defaultLanguageLabel = Deutsch
}
Run Code Online (Sandbox Code Playgroud)

只需编辑根页面的属性,转到Resources选项卡,然后将其粘贴到Page TSConfig字段即可。保存后不要忘记清除配置缓存。