[TYPO3] strange problem with languages

Xavier Perseguers typo3 at perseguers.ch
Mon Jul 14 16:19:05 CEST 2008


Hello Guido,

> in your post I read, that you use an extension or hook to change the 
> default language for subtrees.

That's right!

> I have a setup using multitree page concept with templavoila like this:
> 
> 0 - ROOT
> 1 - - SWISS (4 languages eng/ger/fr/it)
> 1.1 - - - menu 1
> 1.2 - - - menu 2
> 1.3 - - - menu 3
> 2 - - SOUTH AMERICA (3 languages eng/br/pt)
> 2.1 - - - menu 1
> 2.2 - - - menu 2
> 2.3 - - - menu 3
> 3 ..........
> 
  > do I understood right, you have a solution to use e.g.
> 
> 1 - SWISS -> default language german (translate to eng/fr/it)
> 2 - SOUTH AMERICA -> default language brasilian (translate to eng/pt)

This idea is following:

- let user write in their native language using sys_language_uid = 0, 
then let them translate content to another language using standard 
mechanism. This means that you will need to add to TYPO3 root the 
default language itself (in the following English) although normally you 
don't need to because it's just the default language.

- I XCLASSed TemplaVoila to remove from the list of languages not yet 
translated the language that is defined as "default" one for a subtree. 
This step is not needed but prevents the default language from appearing 
twice in the list, once as "default" and once as language taken from the 
list of possible languages to be translated to.

Here are the steps (I assume that you need German, French, Italian and 
English and I made choice about order creation of the languages but you 
may adapt as you wish):

1) Create the German language (id=1), then French (id=2), then Italian 
(id=3) and finally English (id=4). sys_language_uid = 4 overlay will be 
used when the default language is not English.

2) Describe for each subtree the name and flag of the default language 
using page TS:

mod.SHARED {
	defaultLanguageFlag = fr.gif
	defaultLanguageLabel = French
	disableLanguages = 2
}

3) Create the menu

lib.languages = HMENU
lib.languages {
	special = language

	special.value = 1,0,2,3

	1 = TMENU
	1 {
		NO = 1
		NO {
			stdWrap.setCurrent = DE || EN || FR || IT
		}
	}
}

4) Create the template:

# sys_language_uid = 0: English
# sys_language_uid = 1: German
# sys_language_uid = 2: French
# sys_language_uid = 3: Italian
# sys_language_uid = 4: English (non English default language)
config {
	linkVars = L
	sys_language_uid = 0
	language = en
	locale_all = en_GB
}

page {
	config.htmlTag_langKey = en_GB
	meta.language = en_GB
}

// *************************************************************
// German
// *************************************************************
[globalVar = GP:L=1]
	config {
		sys_language_uid = 1
		language = de
		locale_all = de
	}
	page {
		config.htmlTag_langKey = de
		meta.language = de
	}

// *************************************************************
// French
// *************************************************************
[globalVar = GP:L=2]
	config {
		sys_language_uid = 2
		language = fr
		locale_all = fr
	}
	page {
		config.htmlTag_langKey = fr
		meta.language = fr
	}
	

// *************************************************************
// Italian
// *************************************************************
[globalVar = GP:L=3]
	config {
		sys_language_uid = 3
		language = it
		locale_all = it
	}
	page {
		config.htmlTag_langKey = it
		meta.language = it
	}
	

// *************************************************************
// English
// *************************************************************
[globalVar = GP:L=4]
	config {
		sys_language_uid = 4
		language = en
		locale_all = en
	}
	page {
		config.htmlTag_langKey = en
		meta.language = en
	}
	

[global]

5) Create an extension template for each subtree that should have a 
default language that is not English. E.g. French default language:

	# French (Default)
config.sys_language_uid = 0

	# German
[globalVar = GP:L=1]
	config.sys_language_uid = 1

	# Italian
[globalVar = GP:L=3]
	config.sys_language_uid = 3

	# English
[globalVar = GP:L=4]
	config.sys_language_uid = 4

[global]

lib.languages {
	special.value = 1,4,0,3
}

Beware: overriding ilb.languages.special.value is really needed to use 
sys_language_uid = 0 instead of 2 when default language is French. The 
same applies for other languages

Cheers

-- 
Xavier Perseguers
http://xavier.perseguers.ch/en/tutorials/typo3.html


More information about the TYPO3-english mailing list