Queries Library
Queries LibraryFetch users by locale

Fetch users by locale

This query retrieves all users with a certain locale, providing a regex to identify them.

For instance, provide variable $localeRegex with value "es_[A-Z]+" to fetch users with the Spanish locale (es_AR for Argentina, es_ES for Spain, etc).

query FetchUsersByLocale(
  $localeRegex: String!
) {
  usersByLocale: users(
    filter: { metaQuery: {
      key: "locale",
      compareBy: {
        stringValue: {
          value: $localeRegex
          operator: REGEXP
        }
      }
    }},
    pagination: { limit: -1 }
  ) {
    id
    name
    locale: metaValue(key: "locale")
  }
}