Get language name using API

Is there a way to get the language name for a user using the Graph API?

+3


source to share


2 answers


I find the answer to this question. And finally I got a solution for this.

Step 1. First request below api

/v2.4/me?fields=id,name,locale

then you got your local user info.

Step 2.Now request below api



/v2.4/me?fields=id,name?locale= "language obtained in step 1"

If you are using android facebook sdk like me write the code as below.

Bundle bundle = new Bundle();
bundle.putString("fields", "id,name,locale");
//bundle.putString("locale", "ko_KR");
new GraphRequest(
        AccessToken.getCurrentAccessToken(),
        "/me",
        bundle,
        HttpMethod.GET,
        new GraphRequest.Callback() {
            public void onCompleted(GraphResponse response) {
                Log.d(TAG, "response -> " + response.getRawResponse());
            }
        }
).executeAsync();

      

"me" can be converted to "". I have tested on graph api (v2.4). Thank!

+1


source


Not sure if this is what you mean, but there is a field called "format_name" in the FQL user table field:

name_format: string: Username formatted to properly process orders in Chinese, Japanese, and Korean.



Edit: No, sorry, I just understand that this gives you something like "name_format": "{first} {last}" so that the first and last name can be printed in the correct order.

0


source







All Articles