Android Question How to determine language file to use

rkmoray

Active Member
Licensed User
Longtime User
MY app is about to be translated to French. I have 2 string files (stringEN.xml and stringFR.xml)
I want the system to automatically know which file to use for my labels based on the language used by the user. How do I do that?
 

DonManfred

Expert
Licensed User
Longtime User
Upvote 0

asales

Expert
Licensed User
Longtime User
I use this function to check the language of the device:
B4X:
Sub CheckLanguage As String
    Dim language As String
    Dim r As Reflector

    Try
        r.Target = r.RunStaticMethod("java.util.Locale", "getDefault", Null, Null)
        language = r.RunMethod("getLanguage")
    Catch
        Log(LastException)
    End Try

    Return language.ToLowerCase
End Sub
 
Upvote 0
Top