You are here: Re: suggestion needed « All PHP « IT news, forums, messages
Re: suggestion needed

Posted by ClickToWalk on 07/18/06 15:11

"Rik" <luiheidsgoeroe@hotmail.com> wrote in message
news:b7304$44bbb6de$8259c69c$25110@news1.tudelft.nl...
> Kentor wrote:
>> Hello, I have a website which is in english at the moment. I want to
>> translate it to another language but i'm not sure what would be the
>> best way to approach this problem. The website is still in
>> development, therefore the actual code of each page may be modified.
>> I could simply duplicate all the files and move them into a new
>> folder and translate all the content but then if I decide to modify
>> anything, i would have to modify 2 files everytime making sure that
>> each modification is exactly the same in both files. This may become
>> quite confusing if the modifications are large. The development of
>> the website will continue for quite a while which is the reason why i
>> dont want to wait untill im done everything to translate the pages to
>> another language. Any suggestions will be appreciated.
>> -Simon
>
> If you want to seriously build this, keep it dynamic and make it possible
> to
> add other languages along the way, check out gettext:
> http://nl2.php.net/manual/en/ref.gettext.php
> http://www.gnu.org/software/gettext/manual/gettext.html
>
> It will certainly help in keeping track of translations, and depending on
> your setup you translators will have an easy job translating required
> text.
>
> Maybe you could also check out this:
> http://savannah.nongnu.org/projects/php-gettext/
>
> Grtz,
> --
> Rik Wasmus
>
>

Hi Simon,

I've been working on a similar project using dynamic .php pages and a MySQL
database. The way I worked it is to make each bit of text that I would need
to translate a dynamic variable, and a field in the database.

e.g.

<h1> News </h1>
<h1> Contact Us <h1>

becomes

<?php
echo "<h1>$news</h1>;
echo "<h1>$contact<1>;
?>

The table "titles" or tbl_title then has a field for each bit of text or
element that needs translating.

ID language title_news title_contact.........etc
1 en News Contact Us
2 es Noticias Contacto

The language is passed through the URL to each page and in then used to
query the "titles" table for all relevant text content.
I only used a very limited amount of text i..e. headers rather than
multi-line paragraphs, but I don't see why the principle shouldn't work for
larger amounts of text.

This way you only need change the text in one place, you can provide admin
forms to your translators, and it wouldn't require any action from yourself
once the initial coding is done.

Not sure what demands this would put on server, I have a conditional
argument that makes sure that query is only called if the language has
changed.

Mine is WIP, but online at clicktowalk.com


Hope this helps

Regards
Matt

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация