Neos
how can i check which language is actually selected? TypoScript
? Flow
?
If English then output tabelle_EN
. If German then output table_DE
.
Asked
Active
Viewed 494 times
1

marian0
- 3,336
- 3
- 27
- 37

Dennis2323
- 11
- 2
1 Answers
0
First you edit setting.yaml of site package(If the site name is 'example',Then package\Sites\TYPO3.ExampleDemoTypo3Org\Configuration\Settings.yaml).
TYPO3:
TYPO3CR:
contentDimensions:
'language':
label: 'TYPO3.ExampleDemoTypo3Org:Main:contentDimensions.language'
icon: 'icon-language'
default: 'de'
defaultPreset: 'de'
presets:
'all': ~
'de':
label: 'German'
values: ['de', 'en', 'it']
uriSegment: 'de'
'en':
label: 'English'
values: ['en', 'de', 'it']
uriSegment: 'en'
'it':
label: 'Italiano'
values: ['it', 'fr','de']
uriSegment: 'it'
The above mentioned code is the normal typo3 Neos language settings. The content in the language selector menu will appear based on the above selector. If you want to get currently selected (used) language identifier (locale), then you can get it in a fluid template using the below mentioned code.
{node.context.targetDimensions.language}
If you select german language using language selector, the above code gives the answer 'de'. It is my humble suggestion that, please avoid locale value like 'tabelle_EN', and table_DE etc.. This locale identifier is mainly used for translation purpose in Multilanguage sites.

joson george
- 56
- 6
-
`{node.context.dimensions.language.0}` is actually "more correct", since the target dimension value (one per dimension) is only intended for editing / updating. In `dimensions.language` you will have an array of dimension values (see Settings.yaml per preset).In more complex scenarios you might want to use `\TYPO3\TYPO3CR\Domain\Service\ConfigurationContentDimensionPresetSource::findPresetByDimensionValues` to get the actual preset identifier from the dimension values. – Christopher Jun 30 '17 at 09:55