tags:

views:

120

answers:

2

Hello.

I have a language file like this:

<?php
$lng_imagepath      = "images/";
$lng_imageext       = "gif";
$lng_characset      = "iso-8859-1";
$lng_prefix     = "en_";
$lng_tabhome        = "Home";
$lng_tabmyavenue    = "My Profile";
$lng_tabregister    = "Register";
$lng_tabhelp        = "Help";
$lng_tabbuybids     = "Buy Bids";
?>

When I convert into a .html file and run Google translate it looks like this:

Glemt brugernavn eller adgangskode? "; $ lng_invaliddata =" Ugyldig brugernavn og password. "$ lng_accountsuspend =" Din konto er suspenderet af vindetbud.dk. "$ lng_accountdelete =" Din konto er blevet slettet af vindetbud.dk. "$ lng_enterdata = "Angiv brugernavn og adgangskode." $ lng_enterpassword = "Angiv adgangskoden." / / slut login side variabel / / Language variabler for registrering side $ lng_frregistration = "Gratis registrering"; $ lng_vouchermessage = "voucher, indløses mod første auktion du vinder "; $ lng_amazingproducts =" Chancen for at vinde fantastiske produkter til fantastiske priser "; $ lng_registrationdata =" Du kan tilmelde med vindetbud.dk, bedes du udfylde følgende "; $ lng_personalinfo =" Personlige oplysninger "; $ lng_firstname =" Første Name "; $ lng_lastname =" Efternavn "; $ lng_birthdate =" Fødselsdato ";

Do you have any clever ideas how to translate the file?

P.S. I know that grammar won't be perfect, but it would help alot to use google translate.

+1  A: 

What I'd do would be to use the Google Translate API. Of course, as you have already noticed, you cannot simply send the full content of your file so you will have to first recognize which areas you want to translate. You can do so by using regular expresions. Some links you may be interested in:

Cristian
A: 

You can have some fun with awk and sed:

cat file.php | awk '{print $3}' | sed -e 's/[";]//g'

This extracts the strings you want to have translated. The trick will be how to put the translated parts back into your code again... I'm sure awk can do this, but it's up to you to google out how.

Rodin