I want to construct a web page with language flags. The user clicks his flag and the web page is then displayed in his language. In VB6 I would achieve this with a resource file. Does HTML, PHP or CSS have something like that or must I create a web site for each language.
I would very much appreciate any advice on this. The Languages would be English, German, Dutch and Danish
Many thanks
Tony

i would use a mysql database and php to do it. have mysql store the different lanuages and display them based on the url ex. website.com/index.php?lang=en where en would be english and so on. the php script will do the rest. there are various ways of doing this but i have not tried the others.

just thought of a different way. what you could do is have a language directory. in that directory you have folders with the language name on it. ex (English, Spanish, ect.). in these directories you have the same files (header.html,footer.html,mainbody.html, ect.) and all you have to do is change the language of the text in each file that corresponds to the folder. if the file names are different in each folder it will not work. then php will read the url and change the include directory in the page using a session.

this might be a bit confusing. if it is i will go into more detail, maybe even some code. all you have to is let me know.

Would have got back to you quicker but I had to re-boot.
It is a bit confusing, it would be great if you could show how to do it with a bit of code. I am new to Web pages and am just learning PHP and CSS
Many thanks
Tony

I think I might have sent my reply as a general reply and not to you personally. So I have tried again
Would have got back to you quicker but I had to re-boot.
It is a bit confusing, it would be great if you could show how to do it with a bit of code. I am new to Web pages and am just learning PHP and CSS
Many thanks
Tony

to make it easier for both of us, please post your html code. I will make the necessary changes and then explain it all to you so you get it.

I don't have any HTML code as yet. I had not started because of the language question. I didn't want to put a lot of work into the pages only to find out I had to start again. But I will do a simple front page but that might take a couple of days if that is ok with you.
Sorry, but another silly question -How to I post you the HTML?
Regards
Tony

when you have finished the code just copy and paste it into the message box when you reply. make sure you wrap it in

tags though.

while you finish that page i will finsh the php code for you to use. it should be done by the end of today.

Member Avatar for fatihpiristine

it is quite simple..

index.php?lang=en

links to change lang.
?lang=hu
?lang=spa
?lang=deu

requesting,
$lang = $_request;
if ( $lang = "" || $lang = "en")
{
header('Location: /en/');
}
if ( $lang = "hu" );
{
header('Location: /hu/');
}

and so on....

if u wanna go further.. check explorer's default language.. that would be cool.

yes, that way would work but wouldn't you have to recreate the site four different times in different languages. i thought he was trying to avoid having to do that.

Member Avatar for fatihpiristine

Are you sure about it? It would be enough to identify it very well.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.