0

hi everyone..!

i am working on a web site which is in two languages.. so i need a help

i am inserting values in database and i need to retrive it and showing in another language which i use

thanks in advance

2
Contributors
3
Replies
27
Views
4 Years
Discussion Span
Last Post by broj1
1

Many solutions to that. Basically you have to have two columns for each value in different languages. The field names can have language in their names (such as comment_en, comment_fr for english and french languages). The language is stored somewhere (like in a cookie, in a session or as user preference). So if using a session variable you would select a comment in selected language like this:

if(isset($_SESSION['lang'])) {
    // read the language abbreviation if set
    $lang = $_SESSION['lang'];
} else {
// otherwise set to default (english)
    $lang = 'en';
}
$query = "SELECT comment_$lang FROM comments";

If you would like to provide interactive change of language, you can put language in querystring (or use ajax in specific cases).

Edited by broj1

0

Has this solved your problem? If yes, please mark the question as solved. Happy coding.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.