Aside from English, I speak Spanish fluently, Japanese conversationally, Tagalog passably, and I'm learning Portuguese and Italian. I know enough German to sing 99 Luftballons, and enough Latin to translate some of the classics. I wouldn't say any of these have been at all useful in my programming career. I've worked with offshore programming teams in Malaysia, the Philippines, India, Belarus, Mexico, and Pakistan, and they all spoke English better than I could ever hope to speak their native language (except Spanish, but even then the guys in Mexico I work with were schooled in the US).
You could try learning something really obscure. As far as I know I'm the only hacker within 1000 miles who speaks any Mongolian as well as fluent English. Someday, two buyers are gonna show up in that market and keep bidding against each other till my rates go to the moon! Dreaming about that day is much more fun than trying to compete with tens of thousands of (French|Chinese|Spanish|Russian)-English bilingual programmers. In the mean time, I try to hang out at a webforum from time to time and answer random tech questions in Mongolian, which makes me feel all warm and fuzzy. (Or less charitably: I can't sell my skills, so I give them away for free).<p>To be perfectly serious, the recommendation for what language is "useful" to learn really depends on your own language learning skill --- which is a combination of inborn talent, knowing what learning methodologies suit you, and experience with compensating for a bad environment (e.g. I assume you live in the U.S. and attend an Anglophone workplace everyday).<p>Spanish is a pretty typical answer to this question not because it's the "most useful" but because it's not that hard for English speakers to learn, it's more widespread in the U.S. than other foreign languages, and it even has some applicability in tech (a lot of people I've seen suggesting moving to Latin America to cut your cost of living while you bootstrap your startup). Chinese/Japanese is somewhat harder to speak, a lot harder to read, a lot harder to get a visa to the country as a one-man startup, etc.
My favourite quote from <i>Eat, Pray, Love</i> was (roughly) "Why would you learn Italian? So that if they ever successfully invade Ethiopia again, you'll know a language which is spoken in two countries?"<p>With that in mind, it makes sense to learn Spanish, which is spoken through much of Latin and South America. Chinese (Mandarin) has replaced Japanese as the 'next big economic language', so if you're looking to converse with a large new market, then perhaps Mandarin.<p>But for me, I dream of taking up French again. Limited global reach. No economic benefit. But I love the way it sounds coming out of my mouth. Does a form over function answer negate the 'useful for a programmer' part of your question?
Lots of important products are designed and developed in Japan and usually are translated into foreign languages quickly but you could get a jump on developing for whatever Sony or Nintendo is doing with Japanese. Japan has a big internal market you might want to do l10n for it sometime, also.<p>The products designed in Japan (or California) are likely to be manufactured in China. If you want to participate in the final production and delivery of products you program, you'll want to consider Chinese. China's internal market is a desert of failure for software sales, though.<p>So on a technical basis I'd suggest 汉语 (Chinese) or 日本語 (Japanese). Too bad they're among the hardest written languages in all human history to learn. Save yourself the trouble and pick Spanish, the Internet's third or fourth most popular language. It's not a hotbed of technology but if you're living in the USA, you'll need it soon enough if demographic trends continue.
I'd vote Spanish (lots of countries speak it, which makes it a good language). Or Chinese - more people speaking it than any other language, I think.<p>BTW, I started learning Spanish using the "Pimsleur method". It's an amazingly easy and <i>quick</i> way to learn a language, If you're looking for a way to learn a new language, I recommend looking it up.