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.
The idea of the system, is to have each document in the Umbraco website contain all localized versions of the document text-fields, and have the code determine which fields to show on the page, depending on the selected language. Thus, there will exist only one copy of each document, each translatable by its own. The site will therefore also have exactly the same information architecture across all languages, hence the label: ”1:1 site system”.
The method described here is equally well-suited for creating new multilingual sites and for adding multi-lingual support to sites that are already created in a single language.
The implementation below assumes that there is an “initial language” – a default as you may. This is typically the language that is chosen when a visitor first enters the site, and also signifies the “master-language” for the web-manager.
The 7 steps for creating the multilingual 1:1 site system are these:
- The needed languages are first created. Dictionary items can now be added.
- Each document type will be added a new tab for each language, and new fields for each localizable field needed, one for each language. The localized fields alias-names are added a postfix consisting of an underscore and the language code.
- An XSLT library file is created and included in each XSLT file. This file handles language selection, session-storing and retrieval.
- In every XSLT file, when referring to localizable fields, you will add a concatenation method with the language as parameter.
- You will now add an XSLT extension that can do lookup in the dictionary using a key and a language id.
- Replace all that “hardcoded” text, that are not contained in document fields, with dictionary entries and a call to the XSLT extension just added.
- Finally, you should probably add a language selector, so that visitors may choose their preferred language.
The 7 steps are explained in more detail with examples below.
If you don’t need the dictionary functions, you can skip item 5-7, and in that case, you don’t need to write any code in Visual Studio – only XSLT and HTML code.