Skip to content

Internationalization

captcha-pro ships built-in Chinese (zh-CN) and English (en-US) translations and auto-detects the browser language by default.

Global Locale

javascript
import { SliderCaptcha, setLocale, getLocale, t } from '@captcha-pro/core'

// Set language globally
setLocale('en-US')

// Get current locale
console.log(getLocale()) // 'en-US'

// Get translated text
console.log(t('slider.success')) // 'Verification passed'

Per-Component Locale

Override the global locale on a single instance:

javascript
const captcha = new SliderCaptcha({
  el: '#captcha',
  locale: 'en-US' // Component-level locale
})

Auto-Detection

By default, captcha-pro auto-detects the browser language. Chinese browsers show Chinese text; all others show English. Set an explicit locale to override detection.

Released under the MIT License.