The Locale service allows you to customize your app based on your users' location. Using this service, you can get your users' location, IP address, list of countries and continents names, phone codes, currencies, and more. Country codes returned follow the ISO 3166-1 standard.
The user service supports multiple locales. This feature allows you to fetch countries and continents information in your app language. To switch locales, all you need to do is pass the 'X-Appwrite-Locale' header or set the 'setLocale' method using any of our available SDKs. View here the list of available locales.
https://cloud.appwrite.io/v1
Get user locale
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.
Response
200
GET /locale
using Appwrite;
using Appwrite.Models;
using Appwrite.Services;
Client client = new Client()
.SetEndPoint("https://cloud.appwrite.io/v1") // Your API Endpoint
.SetProject("5df5acd0d48c2") // Your project ID
.SetSession(""); // The user session to authenticate with
Locale locale = new Locale(client);
Locale result = await locale.Get();
GET /locale/codes
using Appwrite;
using Appwrite.Models;
using Appwrite.Services;
Client client = new Client()
.SetEndPoint("https://cloud.appwrite.io/v1") // Your API Endpoint
.SetProject("5df5acd0d48c2") // Your project ID
.SetSession(""); // The user session to authenticate with
Locale locale = new Locale(client);
LocaleCodeList result = await locale.ListCodes();
List continents
List of all continents. You can use the locale header to get the data in a supported language.
Response
200
GET /locale/continents
using Appwrite;
using Appwrite.Models;
using Appwrite.Services;
Client client = new Client()
.SetEndPoint("https://cloud.appwrite.io/v1") // Your API Endpoint
.SetProject("5df5acd0d48c2") // Your project ID
.SetSession(""); // The user session to authenticate with
Locale locale = new Locale(client);
ContinentList result = await locale.ListContinents();
List countries
List of all countries. You can use the locale header to get the data in a supported language.
Response
200
GET /locale/countries
using Appwrite;
using Appwrite.Models;
using Appwrite.Services;
Client client = new Client()
.SetEndPoint("https://cloud.appwrite.io/v1") // Your API Endpoint
.SetProject("5df5acd0d48c2") // Your project ID
.SetSession(""); // The user session to authenticate with
Locale locale = new Locale(client);
CountryList result = await locale.ListCountries();
List EU countries
List of all countries that are currently members of the EU. You can use the locale header to get the data in a supported language.
Response
200
GET /locale/countries/eu
using Appwrite;
using Appwrite.Models;
using Appwrite.Services;
Client client = new Client()
.SetEndPoint("https://cloud.appwrite.io/v1") // Your API Endpoint
.SetProject("5df5acd0d48c2") // Your project ID
.SetSession(""); // The user session to authenticate with
Locale locale = new Locale(client);
CountryList result = await locale.ListCountriesEU();
List countries phone codes
List of all countries phone codes. You can use the locale header to get the data in a supported language.
Response
200
GET /locale/countries/phones
using Appwrite;
using Appwrite.Models;
using Appwrite.Services;
Client client = new Client()
.SetEndPoint("https://cloud.appwrite.io/v1") // Your API Endpoint
.SetProject("5df5acd0d48c2") // Your project ID
.SetSession(""); // The user session to authenticate with
Locale locale = new Locale(client);
PhoneList result = await locale.ListCountriesPhones();
List currencies
List of all currencies, including currency symbol, name, plural, and decimal digits for all major and minor currencies. You can use the locale header to get the data in a supported language.
Response
200
GET /locale/currencies
using Appwrite;
using Appwrite.Models;
using Appwrite.Services;
Client client = new Client()
.SetEndPoint("https://cloud.appwrite.io/v1") // Your API Endpoint
.SetProject("5df5acd0d48c2") // Your project ID
.SetSession(""); // The user session to authenticate with
Locale locale = new Locale(client);
CurrencyList result = await locale.ListCurrencies();
List languages
List of all languages classified by ISO 639-1 including 2-letter code, name in English, and name in the respective language.
Response
200
GET /locale/languages
using Appwrite;
using Appwrite.Models;
using Appwrite.Services;
Client client = new Client()
.SetEndPoint("https://cloud.appwrite.io/v1") // Your API Endpoint
.SetProject("5df5acd0d48c2") // Your project ID
.SetSession(""); // The user session to authenticate with
Locale locale = new Locale(client);
LanguageList result = await locale.ListLanguages();