[TYPO3-english] Menu of pages having mix of default languages

Xavier Perseguers typo3 at perseguers.ch
Sat Nov 14 09:06:12 CET 2009


Hi,

> Question: How may I generate a menu for another sys_language_uid? I 
> would like my menu to be generated with sys_language_uid = 2 in this case.

I found that it was actually not possible. I had to XCLASS tslib_tmenu:

class ux_tslib_tmenu extends tslib_tmenu {

	/**
	 * Forces the localization of the menu according to $this->mconf['sys_language_uid] (if present).
	 *
	 * @see typo3/sysext/cms/tslib/tslib_tmenu#writeMenu()
	 */
	public function writeMenu() {
		if (isset($this->mconf['sys_language_uid'])) {
			foreach ($this->menuArr as $key => $val) {
				$this->menuArr[$key] = $this->sys_page->getPageOverlay($this->menuArr[$key], $this->mconf['sys_language_uid']);
			}
		}
		return parent::writeMenu();
	}
	
}

Now I may force the language to be used for a TMENU like this:

lib.menu.shared.1 = TMENU
lib.menu.shared.1 {
		# Forcing the sys_language_uid is handled by class ux_tslib_menu$
		# This value will be overriden for each language configuration
	sys_language_uid = -1

	// Standard TMENU configuration skipped
}

and according to the default language of my website, I just have to override lib.menu.shared.1.sys_language_uid with the appropriate value.

-- 
Xavier Perseguers
http://xavier.perseguers.ch/en

One contribution a day keeps the fork away


More information about the TYPO3-english mailing list