Android Question How to determine language file to use

rkmoray

Active Member
Licensed 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?
 

asales

Well-Known Member
Licensed 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
 
Top