Android Question strings.xml ?

tufanv

Expert
Licensed User
Longtime User
Hello

Google play developer page sells translation for apk files but as i understand we need a string.xml to send so that they can translate those. is it automaticly created while we compile our proejct or how do we create it that consists all the strings of designer and code etC?

TY
 

DonManfred

Expert
Licensed User
Longtime User
B4X:
Sub Globals
    'These global variables will be redeclared each time the activity is created.
    'These variables can only be accessed from this module.
    Dim res As ResourceHelper
End Sub

#AdditionalRes: ..\res

Sub Activity_Create(FirstTime As Boolean)
    'Do not forget to load the layout file created with the visual designer. For example:
    'Activity.LoadLayout("Layout1")
    res.Initialize
    Activity.Title =  res.getString("HelloWorld")

/res/values/strings.xml
<resources>
<string name="HelloWorld">Hello world!</string>
</resources>

and german /res/values-de/strings.xml

<resources>
<string name="HelloWorld">Hallo Welt!</string>
</resources>

Attached the library and an example with a string resource in english and german

Please note the use of "HelloWorld" is casesensitive
 

Attachments

  • ResourceHelperEx.zip
    7.5 KB · Views: 393
  • ResourceHelperV1.0.zip
    1.6 KB · Views: 409
Last edited:
Upvote 0
Top