supabase icon indicating copy to clipboard operation
supabase copied to clipboard

Option i18n for redirection

Open IgorKha opened this issue 1 month ago • 0 comments

Good afternoon everyone! I am using a multilingual module (@nuxtjs/i18n and I use prefix_and_default strategy) and I have encountered the problem of multiple routes repeating in the config for each language

Here is an example of nuxt.config.ts configuration for supabase

supabase: {
    url: process.env.SUPABASE_URL,
    key: process.env.SUPABASE_KEY,
    redirect: true,
    redirectOptions: {
      login: 'login',
      callback: 'confirm',
      include: ['/bg/app(/.*)?', '/fr/app(/.*)?', '/app(/.*)?'],
      exclude: ['/login'],
      cookieRedirect: true
    },
}

Here is an example of nuxt.config.ts configuration i18n

i18n: {
    vueI18n: './i18n.config.ts',
    types: 'composition',
    strategy: 'prefix_and_default',
    defaultLocale: 'en',
    lazy: true,
    langDir: 'locales',
    locales: [
      {
        code: 'en',
        iso: 'en-US',
        name: 'English',
        nameEn: 'English',
        file: 'en-US.ts'
      },
      {
        code: 'bg',
        iso: 'bg-BG',
        name: 'Български',
        nameEn: 'Bulgarian',
        file: 'bg-BG.ts'
      },
      {
        code: 'ru',
        iso: 'ru-RU',
        name: 'Русский',
        nameEn: 'Russian',
        file: 'ru-RU.ts'
      },
      {
        code: 'fr',
        iso: 'fr-FR',
        name: 'Français',
        nameEn: 'French',
        file: 'fr-FR.ts'
      }
    ],
    detectBrowserLanguage: {
      useCookie: true,
      cookieKey: 'i18n_redirected',
      redirectOn: 'root'
    }
  }

Is it possible to add an option in the supabase setup that would avoid this problem?

Thank you!

IgorKha avatar May 12 '24 20:05 IgorKha