0.0.9 • Published 28 days ago

@tanosugi/better-auth-utils v0.0.9

Weekly downloads
-
License
MIT
Repository
-
Last release
28 days 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

28 days ago

0.0.8

1 month ago

0.0.7

1 month ago

0.0.5

1 month ago

0.0.4

1 month ago

0.0.3

1 month ago

0.0.2

1 month ago

0.0.1

1 month ago