[Gambas-user] Translations - Webpage

gian bagoneo at libero.it
Mon Oct 17 16:56:15 CEST 2022


Hi Hans,

Re-reading your email I realized that I didn't understand what code you 
were referring to.

Perhaps if the link had been to an existing page I would have figured it 
out sooner, although this is not certain :-)

If, as I believe, you were referring to the code on this page:
http://gambaswiki.org/wiki/doc/webpage

then to get a translation on the master you need to write this in 
Main.webpage:

[code]
<% System.Language = Request.Language %>
<%
If Left(Request.Language, 2) = "it" Then
%>
   <<Page title="Pagina Web Scritta con Gambas3">>
<%
Else
%>
<<Page title="Gambas WebPage Example">>
<%
Endif
%>
   <h2><%Print ("Gambas WebPage are easy!")%></h2>
   <h2><%Print ("Time is ")%><%=Format(Now, "hh:nn:ss")%></h2>
<</Page>>
[/code]

Or this in Main.class:

[code]
' Public sTitle As String
'
' Public Sub _new()
'
'   If Left(Request.Language, 2) = "it" Then
'     sTitle = "Pagina Web Scritta con Gambas3"
'   Else
'     sTitle = "Web Page Written with Gambas3"
'   Endif
'
' End
[/code]

Unfortunately, this (still in Main.class):
[code]
Public sTitle As String = ("Web Page Written with Gambas3")
[/code]
seems to work only without a window.
That is, in the console it writes correct HTML code that then does not work:

[console]
Content-type: text/html;charset=utf-8

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" 
"http://www.w3.org/TR/html4/strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>
   <meta http-equiv="content-type" content="text/html; charset=utf-8">
   <link rel="stylesheet" href="/style.css">
   <link rel="icon" href="/img/icon.png" type="image/png">
   <title>Pagina Web Scritta con Gambas3</title>
</head>

<body>
   <h2>Gambas WebPage è facile!
</h2>
   <h2>Il tempo è
15:46:03</h2>
</body>

</html>
[/console]

I attach image of the master's browser

Regards

Gianluigi
-------------- next part --------------
A non-text attachment was scrubbed...
Name: master-internal-browser.png
Type: image/png
Size: 17538 bytes
Desc: not available
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20221017/1467d0c0/attachment.png>


More information about the User mailing list