1. Page localization

    Article: AN0001871Updated: 04.12.2018

    HTML text in webparts can be modified by means of the object OGWebparts. We create a text in the webpart HTML text in a single language version by means of ObjectGears HTML editor. After that we modify the text in necessary language versions. We use function OnPreRender() in the page detail on tab Scripts and change the webpart content according to the user language settings.


    This script in the page detail creates HTML text in English. If the current user has set English, this text is displayed to them in the webpartu code_2.

    function OnPreRender()
      var wptext = '<p><span style="font-size:22px">Title</span></p>'+
      '<table border="1" cellpadding="20" cellspacing="2" style="width:500px">'+
      '<td><a href="/DataDetail.aspx?Id=16-3337">EN reference1</a></td>'+
      '<td><a href="/DataDetail.aspx?Id=16-3337">EN reference2</a></td>'+
      '<td>EN tex1</td>'+
      '<td>EN text2</td>'+
      '<p>Note: Localization from the page detail - tab Script.</p>';

      if (OG.Person.GetLoginPerson().AppLanguageId == 1)
        OGWebParts['code_2'].Text = wptext;

    The resulting HTML text in the webpart looks like this: