MBS Xojo Conference
6/7th September 2018, Munich

« Omege Bundle for REAL… | Home | MBS REALbasic Plugins… »

Localized Web Apps

You can localize a web app. To do so you have two possibilities:

First is to duplicate code. We create a web page for English and for German: WebPageGerman and WebPageEnglish. In the session CreatePage event, we get have pagename being empty for the default page and there we can decide which page should show. For that we look into the session headers and if the accepted language includes German (de), we show the German page. Else the english page:
Function CreatePage(PageName As String) As WebPage
if PageName = "" then // start page
dim Lang as string = Session.Header("Accept-Language")
if instr(lang, "de")>0 then
Return WebPageGerman
Return WebPageEnglish
end if
end if
End Function
The second and maybe better way is to change the language in the WebPage open event and switch the labels to show the right texts:
Sub Open()
dim Lang as string = Session.Header("Accept-Language")
if instr(lang, "de")>0 then
label1.text = "Hallo Leute"
end if
End Sub
This way you avoid duplicate code.

Example projects: multilanguageexamples.zip
13 01 11 - 16:33
No comments

Remember personal info?

Emoticons / Textile

Hide email:

Small print: All html tags except <b> and <i> will be removed from your comment. You can make links by just typing the url or mail-address.