Multi-Language Support
Creating Web Pages that Support Several Languages
When thinking about setting up your Web site to support content in multiple languages, consider these three actions.
Action For more information, see Create language-specific content blocks, menus, collections
- Translating a Content Block
- Working with Collections in a Multi-Language System
- Working with Menus in a Multi-Language System
After you create these items, have the page invoke that item dynamically using an appropriate function (such as ecmContentBlock). When Ektron CMS400.NET receives a request to display an item that includes a language and item id number, it returns the language-specific edition. To learn about letting the user select a language from a Web page, see Viewing Your Site in Another Language. Adjust template content to user language Translate text in imagesModifying Page Content Based on Language Selection
If a template's text should change according to a user's language selection, use a case statement to provide the language-specific content. A good example of this is the template used on the RC international sample site (Illustrated below).
Assume you want to create editions of the menu that runs across the header (Home, Products, etc.) in three languages:
NoteThis procedure uses the header.asp file delivered with the RC international sample site as an example.
Dim t_search, t_products, t_support, t_news, t_careers, t_calendar, t_home, t_login, t_site_lang, t_contact, t_copyright, calendar_id
- Enter case statements that provide the value of each variable in each language. (1031 is the decimal code for German, 1036 for French.) The following illustrates how to do this for the search menu option.
Select Case ContentLanguage Case "1031" t_search = "Suche" Case "1036" t_search = "Recherche" Case else t_search = "Search" End SelectNow, when a user visits a page controlled by this template and selects French or German as the site language, the page is refreshed and the translated values appear on the template.
Modifying Images Based on Language Selection
Many Web page templates also include images that require translation. You can set up templates to invoke images in the user-selected language by following these steps.
- For each supported language, create a folder within your Web site's images folder. Name each folder according to the language's decimal id value (for example, German is 1031). See Also: Appendix A: List of Supported Languages
If your site supports English, don't forget to create a folder named 1033.
- Copy all images to each language-specific folder.
- Within each folder, translate the text on each image but do not change its name.
Warning!If you change an image's name, this procedure will not work.
- Wherever the image is referenced in your template or Web page, replace the current reference with this:
img src="images/<%= Contentlanguage %>/image name"
img src="images/<%= Contentlanguage %>/companylogo.jpg"
When a visitor to your Web site selects a language then navigates to the page with the image, the Contentlanguage variable comes into play. It uses the visitor's language selection value to identify the folder that contains images in that language. That image then appears on the page.
To continue the above example, if a user views the site in German, the code that invokes the image translates to this:
img src="images/1031/companylogo.jpg"