Facebook C# SDK get user language/region

安稳与你 提交于 2019-12-06 02:04:00
L.B

If you are developing a web app, then you can use Accept-Language Http header to detect the language


EDIT 1

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


EDIT2

To get the locale using 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 info about my extension method GetDynamicJsonObject here

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!