Search code examples
androidlocalefacebook-loginfacebook-sdk-3.14.x

How to change the language of com.facebook.widget.LoginButton on Android


How can I change the language which the com.facebook.widget's use for display the labels? I am using the com.facebook.widget.LoginButton and the system language of my Android device is set to german but however the LoginButton displays the text "Log in with Facebook" instead of "Mit Facebook anmelden". I also checked the Localize settings of my app on the Facebook developer page which is default german.


Solution

  • It does not include German language localization.

    In your layout, set the custom login_text attribute...

        <com.facebook.widget.LoginButton
            (usual attributes removed)
            loginView:login_text="Whatever text you want" />
    

    Assuming you set the loginView namespace on your root element...

    <LinearLayout
        xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:loginView="http://schemas.android.com/apk/res-auto"
        (usual attributes removed)... >
    

    Following the same example to include logout text it will be:

    <com.facebook.widget.LoginButton
            (usual attributes removed)
            loginView:login_text="Whatever text you want"
            loginView:logout_text="Your logout text" />