0

我正在尝试在谷歌翻译 API 中获得建议,但是当我按下语言时,这工作正常,但建议没有出现。可以帮忙吗?

<textarea id="storyContent_ifr" name="storyContent" aria-hidden="true" ><?php if( count($getStoryContent) > 0){ echo html_entity_decode($getStoryContent->story_content); }?></textarea>

Javascript

 var lang = "en";
    $(document).on('change','#myLanguage', function(){
        if($(this).val() == "2"){
            lang = "gu";
        }
        else if($(this).val() == "3"){
            lang = "hi";
        }
        else if($(this).val() == "4"){
            lang = "mr";
        }
        else if($(this).val() == "6"){
            lang = "en";
        }
        onLoad();
    });


      function onLoad() {
        google.load("elements", "1", {
            packages: "transliteration"
        });
        var options = {
          sourceLanguage: 'en',
          destinationLanguage: [lang],
          shortcutKey: 'ctrl+m',
          transliterationEnabled: true
        };
        var control = new google.elements.transliteration.TransliterationControl(options);
        var ids = [ "storyContent_ifr" ];
        control.makeTransliteratable(ids);
        // control.showControl('translControl');
      }
      google.setOnLoadCallback(onLoad);
4

0 回答 0