Andrey Shitov
Multilanguage websites 17 March 2006 |
|
Task: | Prove myself right in saying that there are many approaches to creating multilanguage sites. | ||
Art. Lebedev Studio Online Store works in two languagesRussian and Englishusing one script and common XSLT templates. We use four techniques to create pages in different languages. Three of them involve XSLT. Technique 1 Strings for each language are saved into separate XSLT filesone file per language (for example, ru.xml and en.xml):
Access to strings in these files is enabled through
To display a certain string, you need to select the appropriate node in this tree:
Technique 2 All web form XML scripts look similar to this (and there is no way different languages can be used here):
In order to display required text, the form XSLT code calls function (a named template)
Function
Technique 3 Any text element in the page XML code, such as
|
Also see Localization |
So, if there is such an attribute, XSLT will select the proper text fragment. And if the attribute is absent, all versions will display the same text.
|
Comment: Some might prefer to use XPath function lang()
|
Related articles Internationalization / localization of XSLT output An XSLT style sheet and an XML dictionary approach to internationalization Tip: Localization within a document format Localizing XML documents through XSLT (pdf) Language support Simple (external XML) internationalization with XSLT? |
|