Name

translate — convert an RSP page name into a page name in the target language

Synopsis

string translate(pathname);
string pathname;

Description

translate is used when creating HTML for hyperlinks. When you write an RSP page you don't know what target the page will be compiled to, so hyperlinks to other RSP pages are written with .rsp extensions. The translate function is used to convert such a filename or URL into the appropriate filename or URL for the target, returing the converted path name.

Usually this involves translating the .rsp extension (if present) to the appropriate target extension (.php, .asp, .jsp etc...). However if the file name is index.rsp then it will be translated to the name of the default document for the target (e.g. on ASP this is default.asp).

Example 53. translate Example

print("<a href=\"" + translate("index.rsp") + "?action=logout\">Home</a>");

On an ASP platform this will output the HTML:

<a href="default.asp?action=logout">Home</a>

See Also

See also: the section called “Dynamic Hyperlink Translation”.