How to Use Google Input Tools in Website

后端 未结 2 1535
面向向阳花
面向向阳花 2020-12-24 15:16

Can you please let me know if it is possible to use Google Input Tools in a website using client side scripting like jquery or pure javascript? Is there any API available fo

2条回答
  •  眼角桃花
    2020-12-24 15:56

    If you want to add google input tools you can use below code to add it

        
          // Load the Google Transliteration API
          google.load("elements", "1", {
            packages: "transliteration"
          });
        
          function onLoad() {
            var options = {
              sourceLanguage: 'en',
              destinationLanguage: ['gu', 'ml', 'hi', 'kn', 'ta', 'te'],
              shortcutKey: 'ctrl+m',
              transliterationEnabled: true
            }
        
            // Create an instance on TransliterationControl with the required options.
            var control = new google.elements.transliteration.TransliterationControl(options);
        
            // Enable transliteration in the textfields with the given ids.
            var ids = ["language"];
            control.makeTransliteratable(ids);
        
            // Show the transliteration control which can be used to toggle between English and Hindi and also choose other destination language.
            control.showControl('translControl');
          }
        
          google.setOnLoadCallback(onLoad);
        
    
     
        
    
    
      
    
    
    

提交回复
热议问题