0.0.9 • Published 11 months ago

@tanosugi/better-auth-utils v0.0.9

Weekly downloads
-
License
MIT
Repository
-
Last release
11 months ago

@tanosugi/better-auth-utils

Installation

npm install @tanosugi/better-auth-utils
# or
yarn add @tanosugi/better-auth-utils
# or
bun add @tanosugi/better-auth-utils

Usage

You can obtain localized ui words dictionary for better-auth-ui by following codes.

// src/app/auth/view.tsx
const { data: uiLocaleDict, isLoading: isUiLocaleDictLoading } = useUILocaleDict(locale);

if (!uiLocaleDict || isUiLocaleDictLoading) {
    return 
      <div>Loading...</div>
    );
<AuthCard
  pathname={pathname}
  redirectTo={redirectTo}
  localization={{
    ...uiLocaleDict,
    passwordInvalid: "Password must contain at least one number, one uppercase letter, one lowercase letter, and one special character",
  }}
/>

To obtain localized dictionary for better-auth-ui, please set up following

// src/app/api/locale-ue/route.ts
import { createUiLocaleHandler } from "@tanosugi/better-auth-utils/api";
export const GET = createUiLocaleHandler();

You can enable localization for error codes from api in better auth by adding the localization plugin.

// src/lib/auth.ts
export const auth = betterAuth({ plugins: [localization()] });

Supported Languages

LanguageLanguage Code
Arabicar
Chinesezh-CN
Czechcs
Dutchnl
Englishen
Frenchfr
Germande
Hindihi
Indonesianid
Italianit
Japaneseja
Koreanko
Polishpl
Portuguesept
Russianru
Spanishes
Thaith
Turkishtr
Ukrainianuk
Vietnamesevi

0.0.9

11 months ago

0.0.8

11 months ago

0.0.7

11 months ago

0.0.5

11 months ago

0.0.4

11 months ago

0.0.3

11 months ago

0.0.2

11 months ago

0.0.1

11 months ago