Using the translation file to learn drupal in a new language

Posted by: 
Dominique De Cooman

Since I m currently based in France Bordeaux for a six month mission and the entreprise I m working for (MBS Orange/France Télécom) is a french speaking one it was time to learn some french vocabulary. The french in particular have their own word for practicaly each word in the computer/drupa/web/... vocab.

At school we used to get lists of words. The one language in the left collumn and the other one in the right one and you'd cover the one side to guess the word on the other side. Sadly as much as I hated those borring lists I have to announce that this is still the fastest way to gain extra vocabulary so I've made a little script you can use to put drupal language files in html tables.

In the attachment you can find the french english translation "collumised".

<?php
//Put it somewhere on localhost and execute
//Print or save the browser output
$file file('drupal-6.17.txt');
   
$count 0;

print 
'<table>';
foreach (
$file as $line) {
 if (
$count 13  ) {
   
$line utf8_decode($line);
               
   if (
substr($line0,5) == 'msgid') {
     
prepare($line);
     print 
'<tr>';
     print 
'<td>'.$line.'</td>';
   }
   if (
substr($line0,6) == 'msgstr') {
     
prepare($line);
     print 
'<td>'.$line.'</td>';
     print 
'</tr>';
   }
   
 }
 
 
$count++;
}

print 
'</table>';

function 
prepare(&$line) {
  
$line str_replace('"'''$line);
  
$line str_replace('msgid'''$line);
  
$line str_replace('msgstr'''$line);
}
?>

Add new comment