Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,150,047 members, 7,807,140 topics. Date: Wednesday, 24 April 2024 at 10:11 AM

Translate Automatically Some Pages From English To Other Languages Like German - Programming - Nairaland

Nairaland Forum / Science/Technology / Programming / Translate Automatically Some Pages From English To Other Languages Like German (2722 Views)

Android App: English To Yoruba & Pidgin-English to English / Visual Basic Help Pls. Other Languages Can Try Too / PHP Editor: also supports other languages (2) (3) (4)

(1) (Reply) (Go Down)

Translate Automatically Some Pages From English To Other Languages Like German by musiktext: 8:27am On Oct 31, 2007
Hello,
I need a script to translate automatically some pages from English to other languages like Germany.
I have some pages from my site (for example see - diana-ross, george michael or gary numan). All lyrics from here i want to translate in German.

Many thanks for any suggestions.
Re: Translate Automatically Some Pages From English To Other Languages Like German by my2cents(m): 10:29am On Oct 31, 2007
I think your best bet is to take advantage of what (at least in JAVA) is called Resource Bundles. There are 2 approaches to this:

1) You create the properties file for each language (in JAVA, named, for example, english_US.properties, or something like that). In the file you have something like this: copy.hello_text:What is that?. In your german properties file, you could then have: copy.hello_text:Vas is Das?. When you define your bundle, one of the parameters is the locale. The server automatically detects this parameter and substitutes the appropriate language.

2) The crude way. You define various files (german.php, yoruba.php, etc). In it, you assign text to variables
(example: hello = hello (in english.php), hello = hola (in spanish.php), etc. Of course you make sure you define the variable, for strongly-typed languages once. Then, you have icons somewhere on your page for each language. You would then link back to the page you are on, tacking on a language name-value pair.

So, let's say you are on the english home page and the user clicks on the german icon. The URL could look like so: http://www.site.com/?lang=german. Then in your code, you could have code like so (I will use pseudo code here):
if(lang == "german"wink {
include german.php
}

Let's further say on your home page, you have the following snippet: <h1><% print hello %></h1>

Irrespective of language selected, the word(s) get changed out automatically.

There may be other (and better) ways to do this, but the above 2 are the ways I have typically done it. #1 is more optimal although (detection is done automatically). I generally prefer #2 as not all people who live in say, Germany, understand german. In other words, I would like to be able to select another language if I wanted to.

I hope this helps.
Re: Translate Automatically Some Pages From English To Other Languages Like German by allonym: 7:57am On Nov 12, 2007
If you only need to translate under 100 words EVER, then that approach may work. However, I get the impression that you have a lot more that needs to be translated.

Google and Alta Vista have free translation tools for certain languages. They can translate text or whole web pages. If your goal is to give people the ability to view your website in another language and don't mind showing it through google or altavista, then you can use their utility. Just provide a link. I'm making up this example:

http://www.google.com/translate=?From-English?To-German?http://www.mypage.com

If you could post more details about what you're trying to do, we could give you better ideas on how to do it.
Re: Translate Automatically Some Pages From English To Other Languages Like German by my2cents(m): 10:38am On Nov 12, 2007
allonym,

From experience, your approach may not always be the best: machines don't always do the best job at translation. A human is best when it comes to translation. Secondly, you may be faced with a situation where you want to translate to a language which is not provided for by such services. Again, I say this from experience.

On a project at work, we decided to go with such a program, which we ended up paying for. The goal was to translate from english to chinese and russian. It just so happened that we had a chinese and a russian employee, so we gave the text to them to see if it was okay. As it turns out, they said the translations were riddled with errors. In fact, the chinese guy said the chinese translation had some derogatory words in it.

So, in conclusion, am I saying not to use the google/altavista? Nope. All I am saying is it is not always best. Caution must be observed. If you are in a situation where you know anyone who speaks the language you are translating to, it wouldn't hurt to run it by them, just to make sure.

As always, my 2 cents

(1) (Reply)

Help With Biometric Identification System / I Want To Build An App That Can Translate Igbo Languages Into English Language / Top 15 Websites To Learn Programming/coding - Best Sources To Learn Quickly.!

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 17
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.