Search code examples
iphoneiosspeech-to-text

Setting the target language


How can i set the target language from english to lets suppose french? i am using google translate api.

 NSString *urlString = [NSString stringWithFormat:@"http://www.translate.google.com/translate_tts?tl=en&q=%@",sentenceToSpeeh];

Solution

  • you already tried to change from

    NSString *urlString = [NSString stringWithFormat:@"http://www.translate.google.com/translate_tts?tl=en&q=%@",sentenceToSpeeh];
    

    to

    NSString *urlString = [NSString stringWithFormat:@"http://www.translate.google.com/translate_tts?tl=fr&q=%@",sentenceToSpeeh];
    

    ? :) so you can say

    NSString *urlString = [NSString stringWithFormat:@"http://www.translate.google.com/translate_tts?tl=%@&q=%@",myLanguage, sentenceToSpeeh];
    

    a gave it a try in the browser and it worked fine :)