Customize text and language settings

Updated at:
Copy as MD

CAPTCHA provides 17 languages by default. You can customize the CAPTCHA's text and language on the client to suit your business needs.

Supported languages

Note

The following languages are supported. You can set the desired language with the language parameter.

  • cn: Simplified Chinese

  • tw: Traditional Chinese

  • en: English

  • ar: Arabic

  • de: German

  • es: Spanish

  • fr: French

  • in: Indonesian

  • it: Italian

  • ja: Japanese

  • ko: Korean

  • pt: Portuguese

  • ru: Russian

  • ms: Malay

  • th: Thai

  • tr: Turkish

  • vi: Vietnamese

Important

If you set the language to Simplified Chinese (cn), Traditional Chinese (tw), English (en), Japanese (ja), or Korean (ko), the question library for the spatial reasoning CAPTCHA automatically matches the selected language. For all other languages, the Simplified Chinese (cn) question library is used by default.

The spatial reasoning CAPTCHA is no longer available. For more information, see [Announcement] Discontinuation of the spatial reasoning CAPTCHA.

Sample code

The following sample code shows how to customize CAPTCHA text prompts in different languages.

Note

CAPTCHA lets you customize text for 13 UI components. To do so, pass the upLang: myLang parameter and define the myLang object.

/**
 * The name of the language. Valid values: cn, tw, and en. You can also add custom languages.
 * The language details in key/value format.
 */
var myLang = {
  cn: {
    // The text of the trigger button for the embedded V3 architecture.
    START_VERIFY: "Click to start verification",
    // The title text of the CAPTCHA prompt. This applies to all CAPTCHA types.
    POPUP_TITLE: "Please complete the security verification",
    // The interaction prompt text for different CAPTCHA types.
    SLIDE_TIP: "Drag the slider to the right",
    CHECK_BOX_TIP: "Confirm that you are not a robot",
    PUZZLE_TIP: "Drag the slider to complete the puzzle",
    INPAINTING_TIP: "Drag the slider to restore the complete image",
    // The prompt text displayed during a verification request. This applies to slider and one-click CAPTCHA types.
    VERIFYING: "Verifying...",
    // The prompt text for successful verification. This applies to all CAPTCHA types.
    SUCCESS: "Verification passed!",
    // The prompt text for a failed verification. This applies to slider and one-click CAPTCHA types.
    SLIDE_FAIL: "Verification failed. Please refresh and try again!",
    // The prompt text for a failed verification. This applies to puzzle and image inpainting CAPTCHA types.
    CAPTCHA_FAIL: "Verification failed. Please try again!",
    // The prompt text for poor network conditions.
    CONGESTION: "Poor network connection. Please refresh and try again!",
    // The prompt text displayed after the interaction is complete but before the verification is submitted. This is specific to the embedded V2 architecture, where verification is triggered by your service's submission button.
    CAPTCHA_COMPLETED: "Slide complete",
    // The prompt text displayed if you submit the verification without completing the interaction. This is specific to the embedded V2 architecture, where verification is triggered by your service's submission button.
    FINISH_CAPTCHA: "Please complete the verification first!",
    // The prompt text for a verification timeout. The embedded type does not have a Close button.
    OVERTIME_TIP: "Verification timed out. Please close the CAPTCHA and try again.",
    OVERTIME_TIP_BOX: "Verification timed out. Please click the CAPTCHA box to try again.",
  },
  en: {
    // The fields are the same as those described above.
    POPUP_TITLE: "Please complete captcha",
    // ...
  },
};

initAliyunCaptcha({
  ...
  upLang: "myLang",
  language: "cn", // The language of the CAPTCHA. For example, "cn".
  ...
});
Important
  1. To add a new language, specify a new language code in the language parameter of the initAliyunCaptcha function. Then, provide translations for the 13 text prompts (text keys) in the myLang object. For example: (language: 'xx', "xx": { "POPUP_TITLE": "Custom text in the xx language" }).

  2. If you specify an unsupported language, CAPTCHA defaults to Chinese. If you specify a supported language but omit custom text, CAPTCHA uses its default text for that language.

  3. The following text string cannot be customized: "Page has been idle for too long. Please refresh and try again."

Text keys and UI display

The myLang object stores the text displayed by the CAPTCHA component, such as prompts for security verification, loading status, and verification failures.

Text key

Default

Slider CAPTCHA

One-click verification

Puzzle CAPTCHA

Image restoration CAPTCHA

Description

START_VERIFY

"Click to start verification"

/

/

image

image

Text for the trigger button in the embedded V3 architecture.

POPUP_TITLE

"Complete security verification"

image

image

image

image

The title text for the CAPTCHA prompt. This applies to all CAPTCHA types.

  • SLIDE_TIP

  • CHECK_BOX_TIP

  • PUZZLE_TIP

  • INPAINTING_TIP

  • "Drag the slider all the way to the right."

  • "Confirm that you are not a robot."

  • "Drag the slider to complete the puzzle."

  • "Drag the slider to complete the image."

image

image

image

image

Interactive prompt text for different CAPTCHA types.

VERIFYING

"Verifying..."

image

image

/

/

The prompt text for the verification process. This applies to slider CAPTCHA and one-click verification.

SUCCESS

"Verified!"

image

image

image

image

The prompt text for successful verification. This applies to all CAPTCHA types.

SLIDE_FAIL

"Verification failed. Please refresh and try again."

image

image

/

/

The prompt text for a failed verification. This applies to slider CAPTCHA and one-click verification.

CAPTCHA_FAIL

"Verification failed. Please try again!"

/

/

image

image

The prompt text for a failed verification. This applies to puzzle CAPTCHA and image restoration CAPTCHA.

CONGESTION

"Network error. Please refresh and try again."

image

image

image

image

The prompt text for network exceptions.

CAPTCHA_COMPLETED

"Complete."

image

/

image

image

Text displayed after the interaction is complete but before submission. This is specific to the embedded V2 architecture, where a button in your application triggers the submission.

Note
  • This provides a suboptimal user experience. We recommend using the embedded UI of the V3 architecture.

  • To submit the verification immediately after the interaction is complete, set the immediate parameter to true in the V2 architecture initialization.

FINISH_CAPTCHA

"Please complete the verification first!"

image

image

image

image

Text displayed if verification is submitted without any interaction. This is specific to the embedded V2 architecture, where a button in your application triggers the submission.

Note

Changing the position of this prompt is not supported. We recommend using the embedded UI of the V3 architecture.

OVERTIME_TIP

OVERTIME_TIP_BOX

  • "Verification timed out. Please close the CAPTCHA and try again."

  • "Verification timed out. Please click the CAPTCHA box to try again."

image.png

image.png

image.png

image.png

image.png

image.png

image.png

image.png

The prompt text for a verification timeout. The embedded type does not have a close button.