Melody AuthMelody Auth
  • Auth Server Setup
  • Admin Panel Setup
  • Email Provider Setup
  • SMS Provider Setup
  • External Identity Providers

    • Social Sign-In Provider Setup
    • OIDC SSO Setup
    • SAML SSO Setup
  • Main Features

    • Authentication
    • JWT & JWKS
    • Multi-Factor Authentication
    • Role-Based Access Control
    • Policies
    • Organizations
  • Additional Features

    • User Attributes
    • App Banners
    • Organization Groups
    • Impersonation
    • Log Management
  • Customization

    • Auth Server Configuration
    • Branding
    • Localization
  • Frontend SDKs

    • React SDK
    • Angular SDK
    • Vue SDK
    • Web SDK
  • Backend APIs

    • S2S API Setup
    • S2S API Swagger
    • Embedded Auth API Setup
    • Embedded Auth API Swagger
  • Deployment Pipelines
  • Rotate JWT Secret
  • English
  • zh-CN
  • Auth Server Setup
  • Admin Panel Setup
  • Email Provider Setup
  • SMS Provider Setup
  • External Identity Providers

    • Social Sign-In Provider Setup
    • OIDC SSO Setup
    • SAML SSO Setup
  • Main Features

    • Authentication
    • JWT & JWKS
    • Multi-Factor Authentication
    • Role-Based Access Control
    • Policies
    • Organizations
  • Additional Features

    • User Attributes
    • App Banners
    • Organization Groups
    • Impersonation
    • Log Management
  • Customization

    • Auth Server Configuration
    • Branding
    • Localization
  • Frontend SDKs

    • React SDK
    • Angular SDK
    • Vue SDK
    • Web SDK
  • Backend APIs

    • S2S API Setup
    • S2S API Swagger
    • Embedded Auth API Setup
    • Embedded Auth API Swagger
  • Deployment Pipelines
  • Rotate JWT Secret
  • English
  • zh-CN
  • Localization

Localization

This guide explains how to add and use a new locale in Melody Auth for identity pages and email templates.

Overview

  • Default locales: en and fr
  • Additionally supported: zh
  • You can add more locales by providing translations and updating configuration

Add translations for email templates

Provide translations for your new locale in server/src/configs/locale.ts.

Add translations for identity pages

You can add translations for identity pages in server/src/pages/tools/locale.ts.

Allow the locale in server config

Update SUPPORTED_LOCALES in server/wrangler.toml under [vars] so the identity pages and emails can use it.

[vars]
SUPPORTED_LOCALES = ["en", "fr", "de"]
# Optional: show a language switcher on identity pages
ENABLE_LOCALE_SELECTOR = true

Notes:

  • Supported locales mentioned in docs: ['en', 'fr', 'zh']
  • If you include only one locale in SUPPORTED_LOCALES, the selector is hidden even if ENABLE_LOCALE_SELECTOR is true.
  • You can remove any locale from SUPPORTED_LOCALES to disable it.

Specify a locale for the authentication flow

You can pass a locale when starting the authentication flow via the SDKs. Example:

import { useAuth } from '@melody-auth/react'

function LoginButton() {
  const { loginRedirect } = useAuth()
  return (
    <button onClick={() => loginRedirect({ locale: 'de' })}>
      Login (DE)
    </button>
  )
}
Last Updated: 8/11/25, 11:27 PM
Contributors: Baozier