Language menu
See also
The LanguageMenuProcessor can be used to create a language menu styled by Fluid.
Creates a language selector menu.
The special = language
type will create menu items based on
the current page record but with the language record for each language
overlaid if available.
Properties
Name | Type |
---|---|
comma separated list of language UIDs /stdWrap or auto
|
|
boolean |
special.value
-
- Type
- comma separated list of language UIDs /stdWrap or
auto
The number of elements in this list determines the number of menu items. Setting to
auto
will include all available languages from the current site.
special.normalWhenNoLanguage
-
- Type
- boolean
If set, the button for a language will be rendered as a non- disabled button even if no translation is found for the language.
Example: Create a language menu with pure TypoScript
lib.langMenu = HMENU
lib.langMenu {
special = language
special.value = 0,1,2
wrap = <ul class="langugageMenu">|</ul>
1 = TMENU
1 {
NO = 1
NO {
linkWrap = <li>|</li>
doNotLinkIt = 1
stdWrap.override = en || de || fr
stdWrap.typolink {
parameter.data = page:uid
additionalParams = &L=0 || &L=1 || &L=2
addQueryString = 1
addQueryString.exclude = L,id
}
}
// We are in the current language
ACT < .NO
ACT {
linkWrap = <li class="active">|</li>
}
// No translation available
USERDEF1 < .NO
USERDEF1 {
linkWrap = <li class="disabled">|</li>
stdWrap.typolink >
}
}
}
See also
For a language menu styled by Fluid see LanguageMenuProcessor.
Note on item states
When the language of the menu element matches the current language of the page
displayed, the state is set to ACT
, otherwise NO
. However, if a page
is not available due to the pages "Localization settings" (which can
disable translations) or if no Alternative Page Language record was
found (can be disabled with .normal
, see below) the
state is set to USERDEF1
for non-active items and USERDEF2
for
active items. So in total there are four states to create designs for.
It is recommended to disable the link on menu items rendered with
USERDEF1
and USERDEF2
in this case since they are disabled exactly
because a page in that language does not exist and might even issue an
error if tried accessed (depending on site configuration).