I can't find an example of using Localizator in B4XPages so I tried to make it work in B4XPages with a simple example.
Main module:
Sub Process_Globals
Private fx As JFX
Private MainForm As Form
Public Loc As Localizator
End Sub
B4XMainPage:
Private Sub B4XPage_Created (Root1 As B4XView)
Root = Root1
Root.LoadLayout("MainPage")
Main.Loc.Initialize(File.DirAssets, "strings.db")
LocalizePage ' apply Localization
B4XPage2.Initialize
B4XPages.AddPage("Page2", B4XPage2)
End Sub
Sub LocalizePage
Log("Localizing MainPage...")
Main.Loc.ForceLocale("zh")
Main.Loc.LocalizeLayout(Root)
End Sub
Page2 class:
Private Sub B4XPage_Created (Root1 As B4XView)
Root = Root1
Root.LoadLayout("Page2")
Log("Localizing Page2...")
Main.Loc.LocalizeLayout(Root)
Label1.Text = Main.Loc.LocalizeParams(Label1.Text, Array(2))
B4XPages.SetTitle(Me, Label1.Text)
End Sub
Attachments
Last edited: