This topic is locked

translate database value and custom words

1/11/2011 2:18:30 AM
PHPRunner General questions
A
aclhkaclhk author

I know label editor can translate table and field name into another language.

How to translate database values to another language ?

When I add some words like "Welcome" on the login page via visual editor, I want to translate "Welcome" to another language. How can I do ?

Sergey Kornilov admin 1/11/2011

Store messages in the databases as separate columns or rows. Depending on the current language pull required phrase from the database and display it. To do so you can use 'Insert PHP code snippet' function and the following code:

$rs = CustomQuery("Select message from tblMessages where id='welcome' and language='" . $_SESSION["language"] . "'");

$data = db_fetch_array($rs);

echo $data["Message"];


Typical tblMessages table structure

id language message

------------------------

welcome English Welcome

welcome French Bienvenue

welcome Spanish Bienvenido