Source: site.view [edit]
Function name: translateToEnglish
Arguments: webpage,language
Description: A command to translate a webpage from a language to English -> Example input: webpage='http://www.google.it' language='Italian'
Page type: webl
Render function:   tlidRender
Module: global

Page source:

var P;
var context;

context = NLUtil_InitContext();

//|| go to http://www.appliedlanguage.com/free_translation.shtml
context = NLUtil_GetUrl(context, "http://www.appliedlanguage.com/free_translation.shtml", nil, nil);
P = NLUtil_GetContext(context, `P`);

//|| find all forms that contain "Free Website Translation"
P = NLUtil_GetContext(context,`P`);
context = NLUtil_SetContext(context,`form`, Elem(P, `form`)  contain Pat(P, `(?i)` + `Free Website Translation`));

//|| fill in transurl with the webpage
context = NLUtil_SetField(context, "transurl", webpage);

//|| fill in lpair_UiMultiSource_web with the language + " To English"
context = NLUtil_SetField(context, "lpair_UiMultiSource_web", language + ` To English`);

//|| submit the form
context = NLUtil_submitForm(context);
P = NLUtil_GetContext(context, `P`);

//|| return the page

if Size(OPTIONALARGS) == 0 then
   NLUtil_LastValue(context);
else
   context;
end;