简体   繁体   English

Autocompleteplus如何检测用户语言(真实语言而不是浏览器)?

[英]Autocompleteplus how to detect user language(Real language not browser)?

I'm looking for a way to get a user default language by the country. 我正在寻找一种按国家/地区获取用户默认语言的方法。 For example I have windows in english but still I would like to get my country 2 letter language ("cs") 例如,我有英语的窗户,但仍然希望获得我的国家2字母语言(“ cs”)

You can see an example of what I want, In the source code of http://search.conduit.com/ using (Autocompleteplus) as well. 您也可以在( http://search.conduit.com/ )的源代码中使用(Autocompleteplus)看到我想要的示例。 This is what I see: 这是我看到的:

  window.language = "en-us";
         window.countryCode = "cz";
         window.suggestBaseUrl = "http://api.autocompleteplus.com/?q=UCM_SEARCH_TERM&l=cs&c=cz&callback=acp_new";

You can see the api url has inside "l=cs&c=cz" how did they get this information? 您可以看到api网址中包含“ l = cs&c = cz”,他们是如何获得此信息的? I would like to have the same thing I use the same autocompleteplus method just need a way to generate the l=(user true langague)&c=(country code) and performance is important as well. 我想拥有与使用相同的autocompleteplus方法相同的东西,只需要一种生成l =(用户真实语言)&c =(国家代码)的方法,性能也很重要。 It's autosuggestions for my website search. 这是我的网站搜索的自动建议。

This is Ed from AutoComplete+. 这是来自AutoComplete +的Ed。 Getting the user country is typically done when using our API through server side implementations. 通过服务器端实现使用我们的API时,通常可以获取用户所在的国家/地区。 There are however some open APIs that can assist you. 但是,有些开放的API可以为您提供帮助。 Regardless, you can use our autocomplete feed without the user country. 无论如何,您可以在没有用户所在国家的情况下使用我们的自动填充Feed。 Feel free to contact us directly for further info at http://www.autocompleteplus.com 欢迎随时直接与我们联系以获取更多信息, 网址http://www.autocompleteplus.com

Thanks, --ed 谢谢,--ed

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM