问题描述
我正在使用Facebook C#SDK。如何获取用户的语言,所以我可以相应地显示所有消息,而不会强迫用户手动选择他的首选语言。 p>如果您正在开发网络应用程序,则可以使用 Accept-Language
Http标头来检测语言
编辑1
对于winforms应用程序,您可以使用系统.Globalization.CultureInfo.CurrentCulture.Name
。
EDIT2
使用FB REST API获取 locale
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);
您可以找到有关我的扩展方法的信息 GetDynamicJsonObject
I'm using the Facebook C# SDK. How can I get language of the user, so I can display all messages accordingly without forcing the user to choose his preferred language manually?
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
这篇关于Facebook C#SDK获取用户语言/区域的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!