[TYPO3-english] Dynamic multilanguage

Xavier Perseguers xavier at typo3.org
Mon Aug 15 22:41:59 CEST 2011


Hi Ernesto,

> I would like to know if there's a way to create the language menu by
> querying the sys_language table of typo3 instead of using the value
> property of the special.language selector from HMENU cObjext and also
> to generate dynamically the TS setup so I can configure the
> appropriate language using the L variable with the lg_iso_2 value of
> the static languages table.
>
> All this is because I'm generating dynamically the languages to use on
> the site through a RPC extension that do modifications on typo3 from
> another application.
>
> I don't know if my explanation is bad, that's because English is not
> my native language and sometimes is hard for me to explain certain
> technicals things :-) so let me know if you need more information
> about what I want to do.

Don't really know if I understand your question but I did this once to 
let me generate the menu in an arbitrary language:

# Create a translated TMENU
lib.menu.intranet.1 = TMENU
lib.menu.intranet.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

	...
}

with:

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();
	}
	
}

Perhaps this helps...

-- 
Xavier Perseguers
Release Manager TYPO3 4.6

TYPO3 .... inspiring people to share!
Get involved: http://typo3.org



More information about the TYPO3-english mailing list