Localize an application that has grown over the years is a challenging task, especially if you wasn't aware of the localization needs from the beginning on.
After reviewing some ways to accomplish the language part I selected Erel's ingenious Localizator as it has the most advantages regarding productivity and maintainability. Together with @corwin42 's hint to the "Easy translation plugin" for Google Doc SpreadSheets it is now just a matter of a "few" well coordinated copy/paste actions.
However, even after implementing all neccessary starter.loc.Localize(...) there is sometimes an unhandled phrase found during testing all function points.
Inspired by @FrenchDeveloper 's snippet I now let the machine collect the missing phrases in a kvs for the next update cycle.
In the Starter module:
In the Main module:
In the Localizator module:
The dump of the kvsMissingKeys can than be used for the next copy/paste round:
After reviewing some ways to accomplish the language part I selected Erel's ingenious Localizator as it has the most advantages regarding productivity and maintainability. Together with @corwin42 's hint to the "Easy translation plugin" for Google Doc SpreadSheets it is now just a matter of a "few" well coordinated copy/paste actions.
However, even after implementing all neccessary starter.loc.Localize(...) there is sometimes an unhandled phrase found during testing all function points.
Inspired by @FrenchDeveloper 's snippet I now let the machine collect the missing phrases in a kvs for the next update cycle.
In the Starter module:
B4X:
Public kvsMissingKeys As KeyValueStore
In the Main module:
B4X:
Starter.kvsMissingKeys.Initialize(File.DirInternal, "MissingKeys")
In the Localizator module:
B4X:
'Localizes the given key.
'If the key does not match then the key itself is returned.
'Note that the key matching is case insensitive.
Public Sub Localize(Key As String) As String
'###fredo
If Not(strings.ContainsKey(Key)) Then
' Temporarily collect all strings that have to be added later to the strings.db during testing
If Starter.kvsMissingKeys.IsInitialized Then
Starter.kvsMissingKeys.PutSimple(Key, True)
End If
End If
'/###fredo
Return strings.GetDefault(Key.ToLowerCase, Key)
End Sub
The dump of the kvsMissingKeys can than be used for the next copy/paste round:
B4X:
Log("#-Starter.kvsMissingKeys-->")
For Each k In Starter.kvsMissingKeys.ListKeys
Log(k)
Next
Last edited: