LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 08-10-2011, 12:50 PM   #16
david1941
Member
 
Registered: May 2005
Location: St. Louis, MO
Distribution: CentOS7
Posts: 267

Rep: Reputation: 58

corp769:

Thanks for the script. I had to drop the +f2 out of line 55 to make it work on a F11 distro but that was easy.
 
Old 08-10-2011, 12:55 PM   #17
corp769
LQ Guru
 
Registered: Apr 2005
Location: /dev/null
Posts: 5,818

Rep: Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007
Quote:
Originally Posted by david1941 View Post
corp769:

Thanks for the script. I had to drop the +f2 out of line 55 to make it work on a F11 distro but that was easy.
Why did you have to? Look at the man page of espeak..... It should work, as I have Fedora 13 currently for the time being....
 
Old 08-10-2011, 01:07 PM   #18
david1941
Member
 
Registered: May 2005
Location: St. Louis, MO
Distribution: CentOS7
Posts: 267

Rep: Reputation: 58
corp769 I don't know why. I'm just kind of pragmatic and adjusted it out and it worked. F11 is EOL anyway.

Here's the error I got:
Code:
Downloading Packages:
espeak-1.40.02-2.fc11.x86_64.rpm                                                                                                                                                                | 695 kB     00:11     
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing     : espeak-1.40.02-2.fc11.x86_64                                                                                                                                                                    1/1 

Installed:
  espeak.x86_64 0:1.40.02-2.fc11                                                                                                                                                                                       

Complete!
[root@maplepark ~]# translate tomorrow EN ES

Original text: tomorrow
Converted text: maņana

Would you like the converted text spoken to you? [Yy/Nn]y
Failed to read voice 'ES+f2'
Wasn't a problem. the man said -f <text> so the code seemed OK. But just deleting it worked fine
Thanks again for the script.
 
Old 08-10-2011, 01:14 PM   #19
corp769
LQ Guru
 
Registered: Apr 2005
Location: /dev/null
Posts: 5,818

Rep: Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007
I know why it didn't work.... Because you entered ES, instead of es. For espeak, the parameters and options are case sensitive, whereas google don't care. Try using "es" and "en" instead, and the code I posted will work just fine.
 
Old 08-10-2011, 02:40 PM   #20
david1941
Member
 
Registered: May 2005
Location: St. Louis, MO
Distribution: CentOS7
Posts: 267

Rep: Reputation: 58
corp769

Sorry, I ran your script --languages first and entered the language codes as it said. It does work fine using lower case.

It might have helped better if it had shown lower case. I tried to insert a tr $3 unsuccessfully to insure lc but finally just changed the supported language section.

Thanks again,
 
Old 08-10-2011, 02:52 PM   #21
MrCode
Member
 
Registered: Aug 2009
Location: Oregon, USA
Distribution: Arch
Posts: 864
Blog Entries: 31

Rep: Reputation: 148Reputation: 148
I'd like to note that some of the languages don't work for me: Armenian ("hy"), Georgian ("ka"), Azerbaijani ("az"), and Kannada ("kn") (and probably a few others; don't feel like going through all of them ) all return the "invalid language pair" error on Google's end.

I'd also like to note that espeak only has voices for probably about half-60% of the languages Google can translate to/from, so IMO it's a bad idea to build in the espeak call in the script. I think it would be more practical to just leave the script as a standalone translator and let the user pipe the output to espeak if it has an appropriate voice*.

(* - IOW, my original script is better )

Last edited by MrCode; 08-10-2011 at 02:56 PM.
 
Old 08-10-2011, 03:32 PM   #22
MTK358
LQ 5k Club
 
Registered: Sep 2009
Posts: 6,443
Blog Entries: 3

Rep: Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723
How about specifying the input and output languages using options?

If you don't specify the input language, Google Translate can automatically detect it. If you don't specify the output language, it could check the environment variables to see the system's default language.
 
Old 08-10-2011, 08:33 PM   #23
corp769
LQ Guru
 
Registered: Apr 2005
Location: /dev/null
Posts: 5,818

Rep: Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007
Quote:
Originally Posted by MTK358 View Post
How about specifying the input and output languages using options?

If you don't specify the input language, Google Translate can automatically detect it. If you don't specify the output language, it could check the environment variables to see the system's default language.
I actually thought of something like that. I just wanted to do something simple though for now....
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Please translate this PHP script to BASH protorox Programming 8 03-28-2014 12:09 PM
bash shell script read file word by word part 2 justina Programming 7 01-25-2011 01:19 PM
[SOLVED] bash shell script read file word by word. justina Programming 15 01-22-2011 10:12 AM
BASH/No X: Using google translate to convert TXT files (translate) frenchn00b Programming 10 09-13-2009 10:55 PM
translate from word list in a file Critcho Linux - Newbie 1 03-20-2007 07:30 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 06:14 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration