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
Locale
type is used by theCustomer
object through thelanguage
field, 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
Thelanguage
field on theCustomer
object returns aLocale
object representing the customer’s preferred locale.
Best Practices
- Always check for nullability on optional fields such as
endonymName
,isoCode
, androotUrl
as they may not be present for all locales. - Use the
primary
field 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
language
field to tailor content and communications according to the customer’s locale preferences.
Notes
- The
Locale
type fields are optional and may returnnull
if the data is not set or applicable. - This API currently requires no authentication, but this may change in future versions.
- Since
Locale
is 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
Locale
type fields.
Last updated on