Docs

Locale

Get User Locale

GET/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 supported language.

Example Request
  • let sdk = new Appwrite();
    
    sdk
        setProject('')
        setKey('')
    ;
    
    let promise = sdk.locale.get();
    
    promise.then(function (response) {
        console.log(response);
    }, function (error) {
        console.log(error);
    });
  • <?php
    
    use Appwrite\Client;
    use Appwrite\Services\Locale;
    
    $client = new Client();
    
    $client
        setProject('')
        setKey('')
    ;
    
    $locale = new Locale($client);
    
    $result = $locale->get();

List Countries

GET/locale/countries

List of all countries. You can use the locale header to get the data in supported language.

Example Request
  • let sdk = new Appwrite();
    
    sdk
        setProject('')
        setKey('')
    ;
    
    let promise = sdk.locale.getCountries();
    
    promise.then(function (response) {
        console.log(response);
    }, function (error) {
        console.log(error);
    });
  • <?php
    
    use Appwrite\Client;
    use Appwrite\Services\Locale;
    
    $client = new Client();
    
    $client
        setProject('')
        setKey('')
    ;
    
    $locale = new Locale($client);
    
    $result = $locale->getCountries();

List EU Countries

GET/locale/countries/eu

List of all countries that are currently members of the EU. You can use the locale header to get the data in supported language.

Example Request

List Countries Phone Codes

GET/locale/countries/phones

List of all countries phone codes. You can use the locale header to get the data in supported language.

Example Request
  • let sdk = new Appwrite();
    
    sdk
        setProject('')
        setKey('')
    ;
    
    let promise = sdk.locale.getCountriesPhones();
    
    promise.then(function (response) {
        console.log(response);
    }, function (error) {
        console.log(error);
    });
  • <?php
    
    use Appwrite\Client;
    use Appwrite\Services\Locale;
    
    $client = new Client();
    
    $client
        setProject('')
        setKey('')
    ;
    
    $locale = new Locale($client);
    
    $result = $locale->getCountriesPhones();