I have a simple question. At what point the missing translations are added to the MissingTranslations map? I've translated some 10 activities and have gone through all of them in my application but nothing is being added to the Map before I write it to a file with WriteTranslations(). What is the mechanism, aren't the values persistently stored as soon as process globals is alive?
I save the items to the file on Activity_Resume of my menu activity. Okay, first time, there should be no info how much the items are. I then make a big walk around all activities and get back to the menu with the hope that everything has been added to the missing translations. But it is not. Only the "dummy line" I call before WriteTranslation is added.
This behaviour is pretty strange - because on my activities, all labels get the text properly(Instead of using English directly, I am using keys). Example:
USEREDIT_FIELDS_USERNAME
USEREDIT_FIELDS_PASSWORD
I have this:
I save the items to the file on Activity_Resume of my menu activity. Okay, first time, there should be no info how much the items are. I then make a big walk around all activities and get back to the menu with the hope that everything has been added to the missing translations. But it is not. Only the "dummy line" I call before WriteTranslation is added.
This behaviour is pretty strange - because on my activities, all labels get the text properly(Instead of using English directly, I am using keys). Example:
USEREDIT_FIELDS_USERNAME
USEREDIT_FIELDS_PASSWORD
I have this:
B4X:
Sub initializeTrans()
Try
trans.Initialize2(File.DirAssets, "lang", locale.Language)
Catch
End Try
End Sub
Sub initializeLocale()
Dim isInitialized As Boolean : isInitialized = locale.initialized
zCommon.LogT("initializeLocale() isInitialized = " & isInitialized, "")
If(isInitialized = False) Then
locale.Initialize
End If
End Sub
Sub tr(KEY As String) ' I am using this method to isolate the AHTranslator translator logic from being used directly.
'zCommon.LogT("tr() KEY = " & KEY, "")
Dim result As String
Try
result = trans.GetText(KEY)
Catch
zCommon.LogT("tr() LastException = " & LastException, "")
initializeLocale
initializeTrans
result = trans.GetText(KEY)
End Try
Return result
End Sub
Sub WriteLanguageFile()
If(zAppSettings.debug_mode = False) Then
Return 0
End If
Try
initializeLocale
initializeTrans
Catch
End Try
Try
zCommon.LogT("locale = " & locale.AvailableLocales, "")
trans.GetText("THIS DUMMY LINE WILL BE ADDED TO THE TRANSLATIONS MAP BUT MY OTHER 100 ITEMS IN THE OTHER ACTIVITIES WONT)
trans.WriteTranslation(File.DirDefaultExternal, "lang")
zCommon.LogT("WriteLanguageFile -- it was written", "")
Catch
zCommon.LogT("WriteLanguageFile - exception = " & LastException, "")
End Try
zCommon.LogT("WriteLanguageFile() trans = " & trans.MissingTranslationMap, "")
End Sub