iOS Question How to use FormBuilder tool when need to Localize text

janderkan

Well-Known Member
Licensed User
Longtime User
I cannot find an easy way to Localize my App when I use FormBuilder tool to create PreferenceDialogs.

Maybee if I could Localize JSon before passing it to .LoadJson
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
There are all kinds of ways to do it.

Example of modifying the json string:
B4X:
Dim parser As JSONParser
parser.Initialize(File.ReadString(File.DirAssets, "1.json"))
Dim Data As Map = parser.NextObject
Dim ser As B4XSerializator
Dim b() As Byte = ser.ConvertObjectToBytes(Data)
Data = ser.ConvertBytesToObject(b) 'this is required to make all the maps non-readonly.
Dim items As List = Data.Get("Items")
For Each m As Map In items
    Dim OrigTitle As String = m.Get("title")
    m.Put("title", OrigTitle & "1") '<--- change code to localize the string.
Next
Dim jg As JSONGenerator
jg.Initialize(Data)
Dim s As String = jg.ToPrettyString(4)
Log(s)
 
Upvote 0
Top