All Products
Search
Document Center

Captcha:Configure custom text and multi-language settings

Last Updated:May 22, 2024

CAPTCHA 2.0 supports 17 languages. You can configure custom text and multi-language settings for CAPTCHAs based on your business requirements when you integrate CAPTCHA 2.0 into a business client.

Note

The following list describes the supported languages. You can specify the languages that you need by using 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 parameter to cn, tw, en, ja, or ko, the spatial reasoning CAPTCHAs for the specified language are used. If you set the language parameter to a value other than the preceding five values, the spatial reasoning CAPTCHAs for Chinese are used by default.

Sample code

The following sample code shows how to configure custom text in various languages for CAPTCHAs:

Note

CAPTCHA 2.0 allows you to specify custom text in 10 components of CAPTCHAs. To achieve this, you can define a myLang object that stores the custom text for the components and pass the myLang object as a parameter.

/**
 * Specify cn, tw, or en as the language of the custom text. You can also specify other languages. 
 * Specify the custom text in key-value pairs. 
 */
var myLang = {
  	"cn": {
      // The text that appears if a CAPTCHA is loading.
      "LOADING": "Loading...",
      // The heading of a pop-up CAPTCHA.
      "POPUP_TITLE": "Complete Security Verification",
      // The text that prompts a user to complete security verification if the user has not solved an embedded CAPTCHA.
      "FINISH_CAPTCHA": "Complete security verification.",
       // The text that appears if an embedded slider or puzzle CAPTCHA is complete.
      "CAPTCHA_COMPLETED": "Complete.",
       // The text that appears if a user is being verified.
      "VERIFYING": "Verifying...",
      // The text that appears if a user passes the verification.
      "SUCCESS": "Verified.",
     // The text that appears if a user fails to complete a slider CAPTCHA.
      "SLIDE_FAIL": "Verify failed. Refresh and try again.",
      // The text that instructs a user to complete a slider CAPTCHA.
      "SLIDE_TIP": "Drag the slider all the way to the right.",
      // The text that appears if a user fails to complete a spatial reasoning CAPTCHA or a CAPTCHA in another form.
      "CAPTCHA_FAIL": "Verify failed. Try again.",
      // The text that instructs a user to complete a puzzle CAPTCHA.
      "PUZZLE_TIP": "Drag the slider to replace the puzzle piece.",
    },
    "en": {
      // The same text keys.
      "POPUP_TITLE": "Please complete captcha",
      // ...
    }
  };

initAliyunCaptcha({
  ...
  upLang: myLang
  language: 'cn', // The language of CAPTCHAs, such as cn. 
  ...
});

Important
  1. If you require languages that are not supported by CAPTCHA 2.0, you can set the language parameter of the initAliyunCaptcha function to the required language, prepare custom text in that language, and then specify the custom text as the values of the text keys in the myLang object. Example: language: 'xx', "xx": { "POPUP_TITLE": "Custom text in the xx language"}.

  2. If you specify a language that is not supported by CAPTCHA 2.0, the system returns the default text in Chinese by default. If you specify a language that is supported by CAPTCHA 2.0, the system returns the default text in that language.

Positions of text

The following table describes how the custom text stored in the myLang object is displayed in the components of CAPTCHAs, such as the display of the text that prompts a user to complete security verification, the text that appears if a CAPTCHA is loading, and the text that appears if the verification fails.

Text key

Position

Remarks

LOADING

image.png

General-purpose

POPUP_TITLE

image.png

General-purpose

FINISH_CAPTCHA

image.png

General-purpose

CAPTCHA_COMPLETED

image.png

General-purpose

VERIFYING

image.png

General-purpose

SUCCESS

image.png

General-purpose

SLIDE_FAIL

image.png

Applicable to slider CAPTCHAs

SLIDE_TIP

image.png

Applicable to slider CAPTCHAs

CAPTCHA_FAIL

image.png

Applicable to slider and puzzle CAPTCHAs

PUZZLE_TIP

image.png

Applicable to puzzle CAPTCHAs