Get user locale
Endpoint
gethttps://<REGION>.cloud.appwrite.io/v1/locale
Description
Get the current user location based on IP. Returns an object with user country code, country name, continent name, continent code, ip address and suggested currency. You can use the locale header to get the data in a supported language.
Required scopes
Authentication
setProject(). No signed-in user or server API key is required.Locale
User IP address.
Country code in ISO 3166-1 two-character format
Country name. This field support localization.
Continent code. A two character continent code "AF" for Africa, "AN" for Antarctica, "AS" for Asia, "EU" for Europe, "NA" for North America, "OC" for Oceania, and "SA" for South America.
Continent name. This field support localization.
True if country is part of the European Union.
Currency code in ISO 4217-1 three-character format
City
Name of timezone
Postal code
Latitude
Longitude
Autonomous System Number (ASN) of the IP
Organization that owns the ASN
Internet service provider of the IP
Connection type of the IP (e.g. cable, cellular, corporate)
User type classification of the IP (e.g. residential, business, hosting)
Registered organization of the IP
import { Client, Locale } from 'appwrite';
const client = new Client() .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint .setProject('<YOUR_PROJECT_ID>'); // Your project ID
const locale = new Locale(client);
const result = await locale.get();
console.log(result);Localization
Get user locale
Endpoint
gethttps://<REGION>.cloud.appwrite.io/v1/locale
Description
Get the current user location based on IP. Returns an object with user country code, country name, continent name, continent code, ip address and suggested currency. You can use the locale header to get the data in a supported language.
Required scopes
Authentication
setProject(). No signed-in user or server API key is required.Locale
User IP address.
Country code in ISO 3166-1 two-character format
Country name. This field support localization.
Continent code. A two character continent code "AF" for Africa, "AN" for Antarctica, "AS" for Asia, "EU" for Europe, "NA" for North America, "OC" for Oceania, and "SA" for South America.
Continent name. This field support localization.
True if country is part of the European Union.
Currency code in ISO 4217-1 three-character format
City
Name of timezone
Postal code
Latitude
Longitude
Autonomous System Number (ASN) of the IP
Organization that owns the ASN
Internet service provider of the IP
Connection type of the IP (e.g. cable, cellular, corporate)
User type classification of the IP (e.g. residential, business, hosting)
Registered organization of the IP
import { Client, Locale } from 'appwrite';
const client = new Client() .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') // Your API Endpoint .setProject('<YOUR_PROJECT_ID>'); // Your project ID
const locale = new Locale(client);
const result = await locale.get();
console.log(result);