ObjectGears Help

           
Forum   ObjectGears (Version: 1.6.0.0)

Page localization

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.

Example:

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">'+
'<tbody>'+
'<tr>'+
'<td><a href="/DataDetail.aspx?Id=16-3337">EN reference1</a></td>'+
'<td><a href="/DataDetail.aspx?Id=16-3337">EN reference2</a></td>'+
'</tr>'+
'<tr>'+
'<td>EN tex1</td>'+
'<td>EN text2</td>'+
'</tr>'+
'</tbody>'+
'</table>'+
'<p> </p>'+
'<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:

This website is using cookies files to provide services and analyse visits. You agree with that by using this website.     Further information