Login

Display the same language in a translate Web control and a page

Versions: n/a, FAQ number: 216, Old FAQ number: 14944

Question

How do I display the same language in a translate Web control and a page using Replacement languages?


Answer

Using Replacement language and a translate Web control will result in the Web control displaying the language from which the site is being visited from. If you want to show the translate Web control in the same language as the replaced page, there are two ways of achieving this.

  1. By adding the following code in the OnPreInit. This will result in all the translate Web controls on the page behaving this way.
    EPiServer.Globalization.UserInterfaceLanguage.Instance.SetCulture(CurrentPage.LanguageID);
  2. If you only want to change the language displayed on a certain translate Web control, add the following value on the controller.
    Language='<%# CurrentPage.LanguageID %>'
EPiTrace logger