更改移动键盘中的语言或phonegap应用中的语言设置

时间:2014-04-17 05:49:09

标签: html5 jquery-mobile cordova

我正在开发Phonegap应用程序,该应用程序需要此应用程序中的语言设置。现在我动态更改语言 - 下面的代码工作正常。但我也需要更换移动键盘。怎么做?。请帮帮我。

<select name="Language" id="Language" data-mini="true">
    <option value="1">English</option>
    <option value="2">French</option>
    <option value="3">German</option>
</select>

$(document).ready(function() {
    $('#Language').change(function() {
        if ($('#Language').val() == "1")
        {              
            english();
            localStorage.english = "English";
            localStorage.french = '';
            localStorage.german = '';
        }
        else if ($('#Language').val() == "2")
        {
            french();
            localStorage.french = "French";
            localStorage.english = '';
            localStorage.german = '';
        }
        else if ($('#Language').val() == "3")
        {
            german();
            localStorage.german = "German";
            localStorage.french = '';
            localStorage.english = '';
        }
    });
});

document.addEventListener("deviceready", onDeviceReady, false);

function onDeviceReady()
{
    if (localStorage.english)
    {
        english();
        document.getElementById('Language').getElementsByTagName('option')[0].selected = 'selected';
    }
    if (localStorage.french)
    {
        french();
        document.getElementById('Language').getElementsByTagName('option')[1].selected = 'selected';
    }  
    if (localStorage.german)
    {
        german();
        document.getElementById('Language').getElementsByTagName('option')[2].selected = 'selected';
    }
}

function english()
{
    $('#listnames').html('<ul data-role="listview"><li>One</li><li>Two</li><li>Three</li></ul>');
    $('.reminderappend').html('Reminder');
    $('.partnersappend').html('Partners');
    $('.messageappend').html('Message');
    $('.settingsappend').html('Settings');
    $('.languagelabel').html('Languages');  
    $('.notificationmessages').html('Notification Messages');
    $('.nmcontent').html('1.Give your partner a loving touch.<hr />2.Share something new of interest with your partner.<hr />3.send a text connects you emotionally.<hr />');
    $('.custommessages').html('Custom Messages');
    $('.cmcontent').html('Adjust how often a new alert arrives');
    $('.frequency').html('Frequency'); 
}  

function french()
{
    $('#listnames').html('<ul data-role="listview"><li>un</li><li>deux</li><li>trois</li></ul>');
    $('.reminderappend').html('Rappel');
    $('.partnersappend').html('partenaires');
    $('.messageappend').html('Message');
    $('.settingsappend').html('Paramètres');
    $('.languagelabel').html('langues');
    $('.notificationmessages').html('Messages de notification');
    $('.nmcontent').html('1.Donnez à votre partenaire un contact affectueux.<hr />2.Partagez nouvelle somthing d intérêts avec votre partenaire.<hr />3.Envoyer un texte vous relie émotionnellement.<hr />');
    $('.custommessages').html('Messages personnalisés');
    $('.cmcontent').html('Ajuster la fréquence d une nouvelle alerte arrive');
    $('.frequency').html('Fréquence');
}

function german()
{
    $('#listnames').html('<ul data-role="listview"><li>ein</li><li>zwei</li><li>drei</li></ul>');
    $('.partnersappend').html('Partner');
    $('.reminderappend').html('Erinnerung'); 
    $('.messageappend').html('Nachricht');
    $('.settingsappend').html('Einstellungen');
    $('.languagelabel').html('Sprachen');
    $('.notificationmessages').html('Benachrichtigung Nachrichten');
    $('.nmcontent').html('1.Geben Sie Ihrem Partner eine liebevolle Berührung.<hr />2.Teilen Sie Somthing neue Interessen mit Ihrem Partner.<hr />3.Senden Text verbindet Sie emotional.<hr />');
    $('.custommessages').html('Benutzerdefinierte Meldungen');
    $('.cmcontent').html('Einstellen, wie oft eine neue Warnung kommt');
    $('.frequency').html('Frequenz');
} 

0 个答案:

没有答案