2017-10-13 3 views
0

私は英語のサイトを持っており、すべてのコンテンツをフランス語に変換する必要があります google translate select value from page load できます助けて。Google翻訳するjavascriptを使用して英語を表示すると、ページの読み込み時に値が選択されずに

私はそのための一つのファイルを作成してくれ

<div id="google_translate_element"></div> 
<script type="text/javascript"> 
function googleTranslateElementInit() { 
    new google.translate.TranslateElement({pageLanguage: 'en', layout: 
    google.translate.TranslateElement.FloatPosition.TOP_LEFT}, 'google_translate_element'); 
    } 
</script> 
<script type="text/javascript" src="//translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"></script> 

Why do we use it? 

It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters, as opposed to using 'Content here, content here', making it look like readable English. Many desktop publishing packages and web page editors now use Lorem Ipsum as their default model text, and a search for 'lorem ipsum' will uncover many web sites still in their infancy. Various versions have evolved over the years, sometimes by accident, sometimes on purpose (injected humour and the like). 
+0

テスト配置 'ます。 ' – GGO

答えて

0

を助けてください、私はフランス語のデフォルトに

<script src="https://code.jquery.com/jquery-2.1.4.js"></script> 

<style> 
#google_translate_element{width:300px;float:right;text-align:right;display:block} 
.goog-te-banner-frame.skiptranslate { display: none !important;} 
body { top: 0px !important; } 
#goog-gt-tt{display: none !important; top: 0px !important; } 
.goog-tooltip skiptranslate{display: none !important; top: 0px !important; } 
.activity-root { display: hide !important;} 
.status-message { display: hide !important;} 
.started-activity-container { display: hide !important;} 
#google_translate_element{ display: none !important;} 
</style> 
<div id="google_translate_element"></div> 
<script type="text/javascript" src="//translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"></script> 

<script type="text/javascript"> 
    function googleTranslateElementInit() { 
    new google.translate.TranslateElement({ 

     includedLanguages: 'fr', 
     layout: google.translate.TranslateElement.InlineLayout.SIMPLE 
    }, 'google_translate_element'); 

    var lang = 'French'; 
    var $frame = $('.goog-te-menu-frame:first'); 
console.log($frame.contents().find('.goog-te-menu2-item span.text:contains('+lang+')').click()); 

    } 
</script> 








Why do we use it? 

It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters, as opposed to using 'Content here, content here', making it look like readable English. Many desktop publishing packages and web page editors now use Lorem Ipsum as their default model text, and a search for 'lorem ipsum' will uncover many web sites still in their infancy. Various versions have evolved over the years, sometimes by accident, sometimes on purpose (injected humour and the like). 
関連する問題