Skip to main content

updateClerkOptions()

The updateClerkOptions() function is used to update Clerk's options at runtime. It can be called at any time after Clerk has been initializedNuxt.js Icon. The @clerk/nuxt module auto-imports updateClerkOptions(), so you don't need to import it yourself.

Usage

The following example changes the language of Clerk's components when the user selects a different language. It uses @clerk/localizations to pass the selected language to the localization option.

app/components/LanguageSwitcher.vue
<script setup lang="ts">
import { enUS, esES, frFR } from '@clerk/localizations'

const localizations = {
  'en-US': enUS,
  'es-ES': esES,
  'fr-FR': frFR,
}

const locale = ref<keyof typeof localizations>('en-US')

watch(locale, (newLocale) => {
  updateClerkOptions({
    localization: localizations[newLocale],
  })
})
</script>

<template>
  <select v-model="locale">
    <option value="en-US">English</option>
    <option value="es-ES">Español</option>
    <option value="fr-FR">Français</option>
  </select>
</template>

Feedback

What did you think of this content?

Last updated on