문제

I know that it may sound weird but please solve this.

I have a textbox and an autocomplete extender, I just need that when I type something in textbox then the auto fill options shall appear in hindi(other language) .

I know that I need to use some API, but I don't know How to achieve my goal . Please help.

string Text = txtbox1.Text;
        Text = Google.API.Translate.Translator.Translate(Text, Google.API.Translate.Language.English,
        Google.API.Translate.Language.Hindi);
        label1.Text = Text;

This is how I translate in Hindi and show in a label on click event but I need autofill options same as google provides. I've used google api translate for this

Thank You

올바른 솔루션이 없습니다

다른 팁

You need to send the request for translation from javascript, and get the results back as JSON (this should help: https://developers.google.com/translate/v2/using_rest). After that you need to assign the result to the autocomplete function, the code should be something like:

$('#textbox1').autocomplete({
    source: function (request, response) {
        $.getJSON("https://www.googleapis.com/language/translate/v2/languages?key" + request.term, function (data) {
            response($.map(data, function (value, key) {
                return { label: value, value: key
                };
            }));
        });
    },
    minLength: 3,
    delay: 25
});
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top