[Gambas-user] Translations
    Martin 
    mbelmonte at belmotek.net
       
    Tue Jan 17 10:36:39 CET 2023
    
    
  
Currently I use this code to read information from .pot and .po files.
Public Function PoRead(sFile As String) As JSONCollection
   Dim aTmp As String[]
   Dim r As Integer
   Dim jVar As New JSONCollection
   Dim sOutput As String
   Dim sInput As String
   Dim bIgnore As Boolean
   aTmp = File.Load2(sFile)
   For r = 0 To aTmp.Max
     If Left(aTmp[r], 3) = "#: " Then
       If Left(aTmp[r + 1], 3) = "msg" And Left(aTmp[r + 2], 3) = "msg" Then
         sInput = Replace(String.Mid(aTmp[r + 1], 7), "\"", "")
         sOutput = Replace(String.Mid(aTmp[r + 2], 8), "\"", "")
         If File.BaseName(sFile) <> "" Then
           bIgnore = False
           If aTmp[r - 1] = "# gb-ignore" Then
             bIgnore = True
           Endif
           jVar.Add([sOutput, bIgnore], sInput)
         Else
           jVar.Add(sOutput, sInput)
         Endif
       Endif
     Endif
   Next
   Return jVar
End
Best regards
    
    
More information about the User
mailing list