Locale
Describes a locale.
Type Definition
type Locale {
endonymName: String
isoCode: String
name: String
primary: Boolean
rootUrl: String
}Fields
| Field | Type | Nullable | Description | Related Types |
|---|---|---|---|---|
| endonymName | String | Yes | Returns the endonym name for this locale. | None |
| isoCode | String | Yes | Returns the ISO code for this locale. | None |
| name | String | Yes | Returns the name of the locale. | None |
| primary | Boolean | Yes | Returns true if this locale is the shop’s primary locale. | None |
| rootUrl | String | Yes | Returns the root URL for this locale. | None |
Relationships
- The
Localetype is used by theCustomerobject through thelanguagefield, indicating the preferred language or locale of a customer.
Usage Examples
Basic Query
query {
locale {
endonymName
isoCode
name
primary
rootUrl
}
}Field Selection
query {
locale {
name
isoCode
}
}Nested Queries
query {
customer(id: 12345) {
id
language {
name
isoCode
primary
}
}
}Filtering and Sorting
The Locale object itself does not support filtering or sorting directly as it is typically returned as part of other queries (e.g., customer language). Filtering and sorting should be applied on the parent objects that reference Locale.
Implements
This type does not implement any interfaces.
Connections
No connection fields are defined on the Locale type.
Related Types
- Customer
Thelanguagefield on theCustomerobject returns aLocaleobject representing the customer’s preferred locale.
Best Practices
- Always check for nullability on optional fields such as
endonymName,isoCode, androotUrlas they may not be present for all locales. - Use the
primaryfield to determine if the locale is the shop’s default locale, which can help in fallback logic for localization. - When querying customer data, include the
languagefield to tailor content and communications according to the customer’s locale preferences.
Notes
- The
Localetype fields are optional and may returnnullif the data is not set or applicable. - This API currently requires no authentication, but this may change in future versions.
- Since
Localeis a lightweight object, querying it has minimal performance impact. - There are no computed or derived fields on this type.
- No field arguments are defined for the
Localetype fields.
Last updated on