Multilingual translation js v1.1, adding debugging to enable the website to support multilingual capabilities within 10 seconds

 Software Description

Automatically translate html web pages into multiple languages, introduce a js, and implement it with one line of code! The effect is the same as Chrome's automatic translation. Applicable to the scene of quickly adding multiple language switching to the website

Upgrade focus: Add multi-language switching capability in a few seconds on the web page:

  1. open any webpage
  2. Right click - inspect element
  3. Paste in the following code:   
    var head= document.getElementsByTagName('head')[0];  var script= document.createElement('script');  script.type= 'text/javascript';  script.src= 'https://res.zvo.cn/translate/inspector.js';  head.appendChild(script); 
  4. Enter Enter key, execute
  5. In the upper left corner of the current web page, there is a big switch language, try switching.

Upgrade Instructions

  1. Add a debugging method that can quickly use the translation function on any webpage to determine whether the website perfectly supports this translation component.
  2. Add translate.currentLanguage() to get what language the page is currently using
  3. Add translate.changeLanguage('en') Add the trigger method of switching language, switch languages, such as switching to English, French. Switching languages ​​can be actively triggered on the page. like: 
    <a href="javascript:translate.changeLanguage('en');">切换为英语</a>
  4. Increase the setting of translate.selectLanguageTag.show to control whether to display the selection box for selecting the language selected, true to display; false to not display. Defaults to true
  5. Add translate.selectLanguageTag.languages ​​= 'zh-CN,zh-TW,en'; Set which language switching is supported by select. Specific sixty or seventy language reference documents.
  6. Increase the protocol judgment when using. The file: protocol is not supported. When this protocol is used, the console will print a friendly prompt to prevent users from stepping on pits.
  7. Optimize the current local language translate.localLanguage defaults to Simplified Chinese zh-CN
  8. Optimize the problem of automatic creation of id in init initialization after loading

Supongo que te gusta

Origin www.oschina.net/news/203688
Recomendado
Clasificación