Written by
torleik
For umbraco versions:
umbraco3.0How-to
How to create multilingual sites with only a single navigation-tree,
> using 'tabbed translation' and the dictionary.
Now we need to alter the XSLT files to look for the correct field from the displayed document.
First make sure to include the lang_lib.xslt (from step 3) in the beginning of all XSLT files that need translations. You should add it between the Stylesheet element and the first template element.
<xsl:include href="../xslt/lang_lib.xslt" />
You need to substitute each reference to a field with the X-path concat function, adding the languagecode defined in lang_lib.xslt. Example: Say, the alias name of a field is: “ALIASNAME”, we might have this code:
<xsl:value-of select="$currentPage/data[@alias = 'ALIASNAME']" />
- we need to change it to this:
<xsl:value-of select="$currentPage/data[@alias = concat('ALIASNAME',$flang)]" />
The concat function combines the fieldname with the language postfix, exactly as we have created the localized field-alias names in the document type in step 2. Thus the <xsl:value-of ... selects the correct translation and uses that. If we use an initial language, the value of $flang is the empty string and the concat method will have no effect, returning the field name without the language postfix, and thus referring to the field value from the “default” content tab - the "initial language".