Skip to main content

ip-to-lang

Documentation / interface/ip-to-lang

countryToLanguage​

const countryToLanguage: object[];

Defined in: interface/ip-to-lang.js:36

Type declaration​

NameTypeDefault valueDefined in

code

string

"ad"

interface/ip-to-lang.js:37

country

string

"Andorra"

interface/ip-to-lang.js:37

lang

string

"es"

interface/ip-to-lang.js:37


getLanguageFromIP()​

function getLanguageFromIP(ip: string): Promise<any>;

Defined in: interface/ip-to-lang.js:19

Retrieves language information for a given IP address using a remote API. Rate limit 45 req/min

You should first use Accept-Language header or navigator.language in front-end for user-set language https://stackoverflow.com/questions/673905/how-can-i-determine-a-users-locale-within-the-browser/31135571#31135571

Parameters​

ParameterTypeDescription

ip

string

The IP address to look up.

Returns​

Promise<any>

A promise that resolves to an object containing country and language information, or undefined if not found.

Author​

ai-research-agent (2024)