For the time, i use the ATHtranslator - Lib, which works fine, but its not possible (at least i don't know how) to use the generated files with GeoLocalization .. so I'd like tu use the standard-android translationfeature
(as Described here) which is, in my opinion, quite nice
Is there any possibility to do this with B4A?
Yes. You can use this code to get string resources (requires Reflection library):
B4X:
Sub Activity_Create(FirstTime As Boolean)
Log(GetResourceString("app_name"))
End Sub
Sub GetResourceString(Key As String) As String
Dim r As Reflector
Dim package As String
Dim id As Int
package = r.GetStaticField("anywheresoftware.b4a.BA", "packageName")
id = r.GetStaticField(package & ".R$string", Key)
r.Target = r.GetContext
r.Target = r.RunMethod("getResources")
Return r.RunMethod2("getText", id, "java.lang.int")
End Sub
1. Make sure to set the xml files to be read-only. Otherwise they will be deleted during compilation.
2. Click on Tools - Clean project, after you add or remove xml files.
Are there Plans to make that easyer?
F.i. If you type in the Text - Property of an Label in the Designer something like "@string/thisismystring" that the right string it will be automaticly used? As far as I know (may be wrong!) it should work in an xml - file that way: