Page 1 of 1

PHP and creating a new (spoken) language translation?

Posted: Thu Jul 01, 2004 4:58 am
by chocky
I'm not terribly optimistic about this, but...

I've just starting fiddling with the setlocale() function for a web site I'm making- and I've made it work fine. My problem is that the site needs to be in English and Welsh- and surprisingly my set up doesn't have the info needed for Welsh!

Now, I could just make a function and custom date function that'd sort this for me, but I'd rather try and do it as "properly" as possible. Is there any way I can create a language file or something to add to the current set up to allow me to set the locale to Welsh?

Posted: Thu Jul 01, 2004 10:35 am
by kettle_drum
You can just ste up some language files that hold any words you use in variables like:

Code: Select all

<?php
      $lang['hello'] = "hello";
      $lang['thank you'] = "thank you";
   ?>

Code: Select all

<?php
      $lang['hello'] = "bonjour";
      $lang['thank you'] = "merci";
   ?>
And then at the start of your page check to see what language your using, and then you can replace all the words in your site with the ones in the language file.