Facebook C # SDK get custom language / region

I am using the Facebook SDK C #. How can I get the user's language, so I can display all the messages without forcing the user to choose their preferred language manually?

+3
source share
1 answer

If you are developing a web application, you can use the Accept-Language Http header to define the language


EDIT 1

For a winforms application, you can use System.Globalization.CultureInfo.CurrentCulture.Name .


EDIT2

To get locale using the FB REST API:

 dynamic fbResult = new Uri("https://graph.facebook.com/AngelaMerkel?access_token=AAABkECTD......").GetDynamicJsonObject(); Console.WriteLine( fbResult.locale ?? "-" + " > " + //<---- fbResult.location.country + " " + //<---- fbResult.location.city + " " + //<---- fbResult.name + " " + fbResult.gender + " " + fbResult.link + " " + fbResult.updated_time); 

You can find information about my GetDynamicJsonObject extension method here

+4
source

Source: https://habr.com/ru/post/1382779/


All Articles