Anton Boritskiy
Anton Boritskiy

Reputation: 1569

Typo3 Default language label and flag

I'm working with Typo3 v6.1 and trying to set up multi-language site. The problem is that I can not change the default language label. What am I doing wrong?

According to this and this, here is my TypoScript config

###################################################
# 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]

So language settings work and I can localize pages, but default language (uid = 0) is still displayed as Default and not Deutsch. I thought that maybe I'm using old settings and I tried debugging through Typo3 core, looks like these settings still in use in several places, here is one of them:

#/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'
);

The problem is that Typo3 seems skipping load of my setting (though I do see them in Object browser). After that I tried also on older version of Typo3 - 4.7.12 and it didn't work out too (((


UPDATE: According to biesior's answer I need to add that code to PageTS config. That works for both Typo3 versions (4.* and 6.*) but also important to know this concepts. And there is a possibility to change the default (i.e. global) PageTS config on behalf of extension:

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

or

# /ext_localconf.php of your typo3 v4.* extension:
t3lib_extMgm::addPageTSConfig(
    ...
);

Upvotes: 1

Views: 4802

Answers (2)

user1708687
user1708687

Reputation: 67

You should put the mod.shared stuff in page ts (edit root page properties) not setup ts.

/Brian

Upvotes: 1

biesior
biesior

Reputation: 55798

This code need to be placed in PageTS (of the root page) not in the TypoScript template

mod.SHARED {
    defaultLanguageFlag = de
    defaultLanguageLabel = Deutsch
}

Just edit properties of the root page, go to the Resources tab, and paste it to Page TSConfig field. Don't forget to clear configuration cache after saving.

Upvotes: 5

Related Questions