Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions src/routes/docs/Sidebar.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@
href: '/docs/sdks',
icon: 'icon-cog'
},
{
label: 'Blog',
href: '/blog',
icon: 'icon-document-text',
openInNewTab: true
},
{
label: 'Changelog',
href: '/changelog',
Expand Down Expand Up @@ -98,6 +104,13 @@
icon: 'icon-user-circle',
isParent: true,
new: isNewUntil('1 Jan 2026')
},
{
label: 'Locale',
href: '/docs/products/locale',
icon: 'icon-location-marker',
isParent: true,
new: isNewUntil('1 Jan 2026')
}
]
},
Expand Down
70 changes: 70 additions & 0 deletions src/routes/docs/products/locale/+layout.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
<script lang="ts">
import Docs from '$lib/layouts/Docs.svelte';
import Sidebar, { type NavParent, type NavTree } from '$lib/layouts/Sidebar.svelte';

const parent: NavParent = {
href: '/docs',
label: 'Locale'
};

const navigation: NavTree = [
{
label: 'Getting started',
items: [
{
label: 'Overview',
href: '/docs/products/locale'
},
{
label: 'Quick start',
href: '/docs/products/locale/quick-start'
}
]
},
{
label: 'Concepts',
items: [
{
label: 'User locale',
href: '/docs/products/locale/user-locale'
},
{
label: 'Countries',
href: '/docs/products/locale/countries'
},
{
label: 'Continents',
href: '/docs/products/locale/continents'
},
{
label: 'Currencies',
href: '/docs/products/locale/currencies'
},
{
label: 'Phone codes',
href: '/docs/products/locale/phone-codes'
},
{
label: 'Languages',
href: '/docs/products/locale/languages'
}
]
},
{
label: 'References',
items: [
{
label: 'Locale API',
href: '/docs/references/cloud/client-web/locale'
}
]
}
];
</script>

<Docs variant="two-side-navs">
<Sidebar {navigation} {parent} />
<slot />
</Docs>


49 changes: 49 additions & 0 deletions src/routes/docs/products/locale/+page.markdoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
---
layout: article
title: Locale
description: Customize your app based on user location. Get user location, countries, continents, currencies, phone codes, and more with Appwrite Locale.
back: /docs
---

Appwrite **Locale** provides comprehensive location and localization data to help you customize your application based on your users' location. The Locale service allows you to get user location information, IP addresses, country and continent names, phone codes, currencies, and language data.

All Locale endpoints support multiple locales, allowing you to fetch information in your app's language. Country codes follow the [ISO 3166-1](https://en.wikipedia.org/wiki/ISO_3166-1) standard, ensuring consistency and compatibility with international standards.

{% arrow_link href="/docs/products/locale/quick-start" %}
Get started with Locale in minutes
{% /arrow_link %}

# Capabilities {% #capabilities %}

Appwrite Locale supports multiple features to help you build location-aware and localized applications.

{% cards %}
{% cards_item href="/docs/products/locale/user-locale" title="User locale" %}
Get the current user's location based on IP address, including country, continent, and currency information.
{% /cards_item %}
{% cards_item href="/docs/products/locale/countries" title="Countries" %}
Retrieve comprehensive country data including names, codes, and EU membership status.
{% /cards_item %}
{% cards_item href="/docs/products/locale/continents" title="Continents" %}
Access continent information with names and codes for geographic organization.
{% /cards_item %}
{% cards_item href="/docs/products/locale/currencies" title="Currencies" %}
Get currency data including symbols, names, plural forms, and decimal precision.
{% /cards_item %}
{% cards_item href="/docs/products/locale/phone-codes" title="Phone codes" %}
Retrieve international phone codes for all countries to build phone number inputs.
{% /cards_item %}
{% cards_item href="/docs/products/locale/languages" title="Languages" %}
Access language data classified by ISO 639-1 with codes and native names.
{% /cards_item %}
{% /cards %}

# Multi-locale support {% #multi-locale %}

The Locale service supports multiple locales, allowing you to fetch country and continent information in your app's language. To switch locales, pass the `X-Appwrite-Locale` header or use the `setLocale` method in any of our available SDKs. [View the list of available locales](https://github.com/appwrite/appwrite/blob/master/app/config/locale/codes.php).

# No authentication required {% #no-authentication %}

The Locale service is publicly accessible and does not require user authentication or API keys. All endpoints can be called directly from client applications, making it easy to integrate location and localization data into any part of your application.


170 changes: 170 additions & 0 deletions src/routes/docs/products/locale/continents/+page.markdoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,170 @@
---
layout: article
title: Continents
description: Access continent information with names and codes for geographic organization and regional features.
---

The continents endpoint provides access to continent information for geographic organization. This is useful for grouping countries by region, building regional features, and organizing location-based data.

# List continents {% #list-continents %}

Retrieve a list of all continents with their names and codes.

{% multicode %}
```client-web
import { Client, Locale } from "appwrite";

const client = new Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1')
.setProject('<PROJECT_ID>');

const locale = new Locale(client);

const continents = await locale.listContinents();

console.log(continents);
// {
// total: 7,
// continents: [
// { name: 'Africa', code: 'AF' },
// { name: 'Antarctica', code: 'AN' },
// { name: 'Asia', code: 'AS' },
// { name: 'Europe', code: 'EU' },
// { name: 'North America', code: 'NA' },
// { name: 'Oceania', code: 'OC' },
// { name: 'South America', code: 'SA' }
// ]
// }
```
```client-flutter
import 'package:appwrite/appwrite.dart';

final client = Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1')
.setProject('<PROJECT_ID>');

final locale = Locale(client);

Future result = locale.listContinents().then((response) {
print(response.total);
response.continents.forEach((continent) {
print('${continent.name} (${continent.code})');
});
return response;
}).catchError((error) {
print(error.response);
});
```
```client-apple
import Appwrite

let client = Client()
.setEndpoint("https://<REGION>.cloud.appwrite.io/v1")
.setProject("<PROJECT_ID>")

let locale = Locale(client)

let continents = try await locale.listContinents()

print(continents.total)
for continent in continents.continents {
print("\(continent.name) (\(continent.code))")
}
```
```client-android-kotlin
import io.appwrite.Client
import io.appwrite.services.Locale

val client = Client()
.setEndpoint("https://<REGION>.cloud.appwrite.io/v1")
.setProject("<PROJECT_ID>")

val locale = Locale(client)

val continents = locale.listContinents()

println(continents.total)
continents.continents.forEach { continent ->
println("${continent.name} (${continent.code})")
}
```
```client-react-native
import { Client, Locale } from 'react-native-appwrite';

const client = new Client()
.setEndpoint('https://<REGION>.cloud.appwrite.io/v1')
.setProject('<PROJECT_ID>');

const locale = new Locale(client);

const continents = await locale.listContinents();

console.log(continents);
```
{% /multicode %}

# Response structure {% #response-structure %}

The `listContinents` method returns a continents list with the following structure:

| Property | Type | Description |
| -------- | ---- | ----------- |
| total | integer | Total number of continents (typically 7) |
| continents | array | Array of continent objects, each containing `name` and `code` |

# Continent codes {% #continent-codes %}

Continent codes use standard two-letter abbreviations:
- `AF` - Africa
- `AN` - Antarctica
- `AS` - Asia
- `EU` - Europe
- `NA` - North America
- `OC` - Oceania
- `SA` - South America

# Use cases {% #use-cases %}

Continent lists are commonly used for:

- **Regional organization**: Group countries by continent for navigation and filtering
- **Geographic analytics**: Analyze user distribution and engagement by continent
- **Regional features**: Enable continent-specific features or content
- **Data visualization**: Create maps and charts organized by continent
- **Content delivery**: Optimize content delivery based on regional preferences

# Multi-locale support {% #multi-locale %}

Continent names can be retrieved in different languages by setting the locale:

{% multicode %}
```client-web
// Set locale to French
client.setLocale('fr');

const continents = await locale.listContinents();
// Continent names will be in French
```
```client-flutter
client.setLocale('fr');

final continents = await locale.listContinents();
```
```client-apple
client.setLocale("fr")

let continents = try await locale.listContinents()
```
```client-android-kotlin
client.setLocale("fr")

val continents = locale.listContinents()
```
```client-react-native
client.setLocale('fr');

const continents = await locale.listContinents();
```
{% /multicode %}


Loading
Loading