I have added an HMENU of type language, and some translations, and I can click the menu buttons to see the translations. However, there are a few things which are broken, and I'd like to get a more fundamental understanding.
The first thing which is strange: in the language menu the HREF for untranslated pages looks like e.g. /en/my-page, whereas the HREF for translated pages looks like /my-page?L=1. Wbat's going on here? I've put in the preVars section described in https://github.com/dmitryd/typo3-realurl/wiki/Notes-for-Integrators#configuring-languages. I would prefer it if the user never had to see the ?L=x query string parameter.
Edit: I have fixed this first issue by correcting my domain record from https://www.my.domain.com to www.my.domain.com, then clearing out the realurl database tables.
My second problem is my other normal HMENUs. The text in these is getting translated correctly, but the links are not - you end up going back to the default language every time you navigate.
Any help much appreciated.
I have tried all of the following:
'Clear all cache' button
'Clear PHP opcode cache' button
rm -rf /var/www/typo3temp/*
Delete contents of all the tx_realurl tables in the database
My TypoScript:
config.doctype = html5
config.absRefPrefix = /
config.tx_realurl_enable = 1
## config.sys_language_overlay = 1 # I don't actually know what this does!
config.linkVars = L(0-9) # Make the language link variables work.
## Defaults
config.language = en
config.locale_all = en_GB.utf8
config.htmlTag_langKey = en-GB.utf8
config.sys_language_uid = 0
[globalVar = GP:L = 1]
config.language = da
config.locale_all = da_DA.utf8
config.htmlTag_langKey = da-DA.utf8
config.sys_language_uid = 1
[globalVar = GP:L = 2]
config.language = de
config.locale_all = de_DE.utf8
config.htmlTag_langKey = de-DE.utf8
config.sys_language_uid = 2
## There's no 3
[globalVar = GP:L = 4]
config.language = es
config.locale_all = es_ES.utf8
config.htmlTag_langKey = es-ES.utf8
config.sys_language_uid = 4
## There's no 5
[globalVar = GP:L = 6]
config.language = lv
config.locale_all = lv_LV.utf8
config.htmlTag_langKey = lv-LV.utf8
config.sys_language_uid = 6
[globalVar = GP:L = 7]
config.language = ro
config.locale_all = ro_RO.utf8
config.htmlTag_langKey = ro-RO.utf8
config.sys_language_uid = 7
[globalVar = GP:L = 8]
config.language = pl
config.locale_all = pl_PL.utf8
config.htmlTag_langKey = pl-PL.utf8
config.sys_language_uid = 8
[globalVar = GP:L = 9]
config.language = pt
config.locale_all = pt_PT.utf8
config.htmlTag_langKey = pt-PT.utf8
config.sys_language_uid = 9
[END]
## Language Menu
lib.language_menu = HMENU
lib.language_menu {
special = language
special.value = 0,1,2,4,6,7,8,9
1 = TMENU
1 {
wrap = <ul class="language-menu">|</ul>
noBlur = 1
NO = 1
NO {
linkWrap = <li>|</li>
stdWrap.override = En || Da || De || Es || Lv || Ro || Pl || Pt
}
ACT < .NO
ACT {
linkWrap = <li class="active">|</li>
}
# NO + Translation doesn't exist
USERDEF1 < .NO
# USERDEF1.doNotLinkIt = 1
# ACT + Translation doesn't exist
USERDEF2 < .ACT
# USERDEF2.doNotLinkIt = 1
}
}
You need to set config.linkVars to keep the language GET parameter in all links: https://docs.typo3.org/typo3cms/TyposcriptReference/Setup/Config/Index.html#linkvars
Example (if you only have two languages):
config.linkVars = L(0-1)
if realUrl does not render links like
/<lng>/mypage.html and only mypage.html?L=<2>
check the path to your realurl config file, /see extension manager -> real Url -> setings where realurl is looking for it
check settings in extension manager realurl : is autoconfig enabled ?
check the domain settings records (sometimes rearl needs a domain
record set)
check if the page with documentroot has the setting is document Root (helps realurl to generate a working realUrl autoconfig.
if you start from scratch with realurl, removing the autogenerated realurl config file, disable the extension and enablerealurl again sometimes helps after fixing bugs.
Related
I've got a TYPO3 page which is only in german. Now I want to set up the page in english as well. How can I realise this? I've read about webpage language and so on but, can't find a whole tutorial.
I'm using TYPO3 6.2.9
Thanks a lot
Update
## Localization menu:
lib.langMenu = HMENU
lib.langMenu {
special = language
special.value = 0,1,2
special.normalWhenNoLanguage = 0
1 = GMENU
1.NO {
XY = [5.w]+4, [5.h]+4
backColor = white
5 = IMAGE
5.file = EXT:cms/tslib/media/flags/flag_uk.gif || EXT:cms/tslib/media/flags/flag_de.gif
5.offset = 2,2
}
1.ACT < lib.langMenu.1.NO
1.ACT=1
1.ACT.backColor = black
1.USERDEF1 < lib.langMenu.1.NO
1.USERDEF1=1
1.USERDEF1.5.file = EXT:cms/tslib/media/flags/flag_uk.gif || EXT:cms/tslib/media/flags/flag_de.gif
1.USERDEF1.noLink = 0
1.USERDEF2 < lib.langMenu.1.USERDEF1
1.USERDEF2.backColor = green
}
Well,
in TYPO3 it is really easy to set up an other Language
All you need to do ist:
Create on your rootpage (the world) a new lanuguage
Then add in your Setup on the rootpage the following (for example french)
[globalVar = GP:L = 1]
config.sys_language_uid = 1
config.language = fr
config.locale_all = fr_FR
[global]
Then translate your first page.
You can access the page with this link.
Hope it helps.
Hi i have 4 languages in my typo. Here is my main configuration for them:
#LANGS
config.linkVars=L
config.defaultGetVars.L = 0
config.sys_language_overlay = hideNonTranslated
[globalVar = GP:L = 3]
config.sys_language_uid = 3
config.language = en
config.locale_all = en_EN
config.htmlTag_langKey = en
plugin.tx_indexedsearch._DEFAULT_PI_VARS.lang = 3
[globalVar = GP:L = 2]
config.sys_language_uid = 2
config.language = ro
config.locale_all = ro_RO
config.htmlTag_langKey = ro
plugin.tx_indexedsearch._DEFAULT_PI_VARS.lang = 2
[globalVar = GP:L = 1]
config.sys_language_uid = 1
config.language = de
config.locale_all = de_DE
config.htmlTag_langKey = de
plugin.tx_indexedsearch._DEFAULT_PI_VARS.lang = 1
[global]
All works fine.
Im using templavoila and realurl.
In one of templates/modules/flexible content i have typoscript displays field only when its not empty:
10 = TEXT
10.field = field_test
10.wrap = info: |
10.if.isTrue.field = field_test
Now i'd like to display this field in diferent versions:
like:
10.wrap = informationen |
for DE language etc.
How may i check here what current language is?
Using translation labels in TypoScript
You can use a translation label in TypoScript. For example:
{LLL:typo3conf/customlabels.xlf:label.id}
{LLL:EXT:mytemplateext/Resources/Private/Language/locallang.xlf:label.id}
You may want to look at:
http://docs.typo3.org/typo3cms/FrontendLocalizationGuide/BasicSetupOfALocalizedWebsite/Llxml%28locallang-xml%29InPluginsAndTyposcript/Index.html
llXML files are XML files containing labels that the system can fetch in a localized version if a language pack is installed. If you want to retrieve values from llXML files in TypoScript you can do it like this:
page.20 = TEXT page.20.stdWrap.data =
LLL:EXT:indexed_search/pi/locallang.xml:submit_button_label
And see also:
http://docs.typo3.org/typo3cms/CoreApiReference/Internationalization/Introduction/Index.html
http://docs.typo3.org/typo3cms/InsideTypo3Reference/CoreArchitecture/Localization/Locallang-xml%28llxml%29Files/Index.html
TypoScript variables
You can extend your language configuration with your own settings. For example:
#LANGS
config.linkVars=L
config.defaultGetVars.L = 0
config.sys_language_overlay = hideNonTranslated
myLanguageLabels {
info = info
}
[globalVar = GP:L = 3]
config.sys_language_uid = 3
config.language = en
config.locale_all = en_EN
config.htmlTag_langKey = en
myLanguageLabels {
info = info 2
}
plugin.tx_indexedsearch._DEFAULT_PI_VARS.lang = 3
[globalVar = GP:L = 2]
config.sys_language_uid = 2
config.language = ro
config.locale_all = ro_RO
config.htmlTag_langKey = ro
myLanguageLabels {
info = info 3
}
plugin.tx_indexedsearch._DEFAULT_PI_VARS.lang = 2
[globalVar = GP:L = 1]
config.sys_language_uid = 1
config.language = de
config.locale_all = de_DE
config.htmlTag_langKey = de
plugin.tx_indexedsearch._DEFAULT_PI_VARS.lang = 1
myLanguageLabels {
info = info 3
}
[global]
And then just point out to the variable you want to use:
10.wrap = {$myLanguageLabels.info}: |
how can I set my 'second' language at my TYPO3 Website (4.5.x) to default?
I have ID0 = german, ID1 = english and ID2 = spanish
At the moment, if there's no translation TYPO3 will show the default language (0=german)
Here's my TS
# multilingual
##################
config.linkVars = L
config.uniqueLinkVars = 1
# no translation go to default
config.sys_language_mode = content_fallback
# not translated elements, show default
config.sys_language_overlay = 1
#config.sys_language_overlay = hideNonTranslated
# German / default :
config.sys_language_uid = 0
config.language = de
config.locale_all = de_DE.UTF8
# English :
[globalVar = GP:L = 1]
config.sys_language_uid = 1
config.language = en
config.locale_all = en_EN.UTF8
config.htmlTag_langKey = en
[global]
# Spanish :
[globalVar = GP:L = 2]
config.sys_language_uid = 2
config.language = es
config.locale_all = es_ES.UTF8
config.htmlTag_langKey = es
[global]
the solution for your problem is the attribute sys_language_mode
You can define the fallback for each language.
For example in your case
[globalVar = GP:L2]
config {
sys_language_uid = 2
language = es
locale_all = es_ES.UTF-8
htmlTag_langKey = es
sys_language_mode = content_fallback;1,0
}
[global]
This setup the content_fallback followed by the ordering of language_uid that should be used for fallback.
For detailed documentation read the TSREF
http://docs.typo3.org/typo3cms/TyposcriptReference/Setup/Config/Index.html#sys-language-mode
Cheers
Christian
In typoscript I have setup my website to support three languages. In the frontend it is working fine but in the backend i'm missing the dropdown selection for "languages"? Only "Columns" and "Quickedit" are visible. How can i enable the "languages" selection in the BE?
I used this typoscript to set it up:
page.config.linkVars = L
page.config.uniqueLinkVars = 1
page.config.sys_language_overlay = content_fallback
page.config.language = nl
page.config.locale_all = nl_NL
page.config.htmlTag_langKey = nl-NL
page.config.sys_language_uid = 0
[browser = msie]
page.config.htmlTag_setParams = xmlns="http://www.w3.org/1999/xhtml" xmlns:v=”urn:schemas-microsoft-com:vml” xml:lang="nl"
[globalVar = GP:L = 1]
page.config.language = en
page.config.locale_all = en_EN
page.config.htmlTag_langKey = en-EN
page.config.sys_language_uid = 1
[globalVar = GP:L = 1] && [browser = msie]
page.config.htmlTag_setParams = xmlns="http://www.w3.org/1999/xhtml" xmlns:v=”urn:schemas-microsoft-com:vml” xml:lang="en"
[globalVar = GP:L = 2]
page.config.language = de
page.config.locale_all = de_DE
page.config.htmlTag_langKey = de-DE
page.config.sys_language_uid = 2
[globalVar = GP:L = 2] && [browser = msie]
page.config.htmlTag_setParams = xmlns="http://www.w3.org/1999/xhtml" xmlns:v=”urn:schemas-microsoft-com:vml” xml:lang="de"
In Order to be able to translate content in the backend into e.g. english you need to
Go to your Root page (ID=0), select the list module and create a
'Website Language' Record 'english'.
Go to the page you want to translate and create a record called
'Alternative Page Language'. Choose 'english' as Language.
You should now see a translation option in the discribed dropdown.
Repeat for as many pages and languages as you need.
Edit: You can see how this is done in this (german) video: http://www.youtube.com/watch?v=62ZuTYRKq5U
I'm trying to create a language switch with personal images that makes possible to change the website language in the frontend (I already defined the languages and the alternative language pages). I'm using a snippet from TYPO3 Core Documentation, but it's not working for me, so I must be doing something wrong...I added a marker in my template called LANGUAGE, which corresponds to a DIV in the top right corner of the main container, where would appear some representative flags of the languages available for that page.
Here it is my TS code in the Template:
config.linkVars = L , type
config.sys_language_uid = 0
config.language = en
config.locale_all = en_EN
[globalVar = GP:L =0]
config.sys_language_uid = 0
config.language = en
config.locale_all = en_EN
config.htmlTag_langKey = en
[global]
[globalVar = GP:L =1]
config.sys_language_uid = 1
config.language = pt
config.locale_all = pt_PT
config.htmlTag_langKey = pt
[global]
[globalVar = GP:L =2]
config.sys_language_uid = 2
config.language = fr
config.locale_all = fr_FR
config.htmlTag_langKey = fr
[global]
[globalVar = GP:L =3]
config.sys_language_uid = 3
config.language = de
config.locale_all = de_DE
config.htmlTag_langKey = de
[global]
page.10.marks.LANGUAGE {
lib.langMenu = HMENU
lib.langMenu {
special = language
special.value = 0,1,2,3
special.normalWhenNoLanguage = 0
1 = GMENU
1.NO {
XY = [5.w]+4, [5.h]+4
backColor = white
5 = IMAGE
5.file = fileadmin/Template/images/english.png || fileadmin/Template/images/portuguese.png || fileadmin/Template/images/french.png || fileadmin/Template/images/german.png
5.offset = 2,2
}
}
}
Yes, this can't work because you're defining a lib element inside a mark. You must nest your code differently:
lib.langMenu = HMENU
lib.langMenu {
[all your stuff from the lang menu]
}
and then
page.10.marks.LANGUAGE < lib.langMenu
By the way, if you also define the states USERDEF1 and USERDEF2 and use doNotShowLink = 1, then the link to a language isn't rendered if the page is not available in this language. This can be very helpful when not all your content is translated and you don't want to use fallback:
USERDEF1 = 1
USERDEF1.doNotShowLink = 1
USERDEF2 < .USERDEF1