Welcome to WebmasterWorld Guest from

Forum Moderators: phranque

Message Too Old, No Replies

Website in 2 languages. Use SSI?



10:46 am on Dec 13, 2008 (gmt 0)

5+ Year Member

I have a client that would like a French and English version of the site - this would simply be changed using a flag icon. The default site would be English, then when they click on the Frech flag they would be directed to the French translated site.

My question is this. Would it be easy to have pages that call in the relevant language pages using SSI. For example I have the page and then two sections on that with the Menu and Content - both of these sections would link to external pages to bring in the relevant language content for each of those sections.

Firstly is that possible? Secondly I'm very, very new to SSI so how would I call the French content if I was in the French site and the English content if I was in the Default site?

Any help would be very, very much appreciated.


11:24 am on Dec 13, 2008 (gmt 0)

5+ Year Member

Okay, after a little bit of looking around I'm presuming I can do this with conditional SSI i.e. If #*$! then display this, if YYY then display the other.

I'm still not sure though how to do it where the website will know what flag has been clicked on to display the relevant content?


7:16 pm on Jan 11, 2009 (gmt 0)

WebmasterWorld Senior Member txbakers is a WebmasterWorld Top Contributor of All Time 10+ Year Member

If you are doing a dynamic site (ASP, PHP, etc.) you could store the text in a database and display what they want based on the session.

Or you could do includes like you proposed.


1:02 pm on Jan 12, 2009 (gmt 0)

5+ Year Member

I'm not really up on using databases to store the content so I think I might just stick with the Includes method - it's only a very small site anyway.


8:51 pm on Jan 14, 2009 (gmt 0)

WebmasterWorld Administrator coopster is a WebmasterWorld Top Contributor of All Time 10+ Year Member

You may also want to consider Content Negotiation. The Apache HTTP Server has a very good example of delivering multi-lingual content in it's documentation. The manual pages show how it can be done.


9:02 pm on Jan 14, 2009 (gmt 0)

5+ Year Member

Interesting stuff - thanks for this - I'll take a look into this method as well.


4:00 am on Mar 24, 2009 (gmt 0)

5+ Year Member

There is else more idle time method - a translator google even to tighten with code no need!


6:51 am on Mar 24, 2009 (gmt 0)

5+ Year Member

Sorry "beggo" what do you mean?


5:17 pm on Mar 24, 2009 (gmt 0)

5+ Year Member

Excuse me possible I not before the end has understood set the problem.
On its put I used the translator google.

[edited by: coopster at 9:23 pm (utc) on Mar. 24, 2009]
[edit reason] no personals please TOS [webmasterworld.com] [/edit]


6:00 pm on Mar 24, 2009 (gmt 0)

WebmasterWorld Administrator lifeinasia is a WebmasterWorld Top Contributor of All Time 5+ Year Member Top Contributors Of The Month

Sorry "beggo" what do you mean?

I think beggo was trying to point out the possibility of using Google (or some other machine translation) on the fly.

Ironically, as it looked like beggo used machine translation for the post, it shows exactly why this option should NEVER be used. :)


6:26 pm on Mar 24, 2009 (gmt 0)

5+ Year Member

Oh thanks for this - yes, without a doubt - on a professional website these kind of simple translators should never ever be used. They are truly terrible.


11:03 pm on Mar 24, 2009 (gmt 0)

5+ Year Member

I haven't tested this, but off the top of my head this may work:

Make all URLs to the English version look like example.com/en/example.html and all URLs to the French version look like example.com/fr/example.html

Use mod_rewrite or equivalent to redirect the server to the file without the starting /en or /fr.

In each file, as you mentioned use <!--#if --> to figure out what language to use:

<!--#if expr="\"$DOCUMENT_URI\" != /^\/en/" --> 
<!--#include french_version-->
<!--#include english_version-->

I can't remember if you can use variables inside include statements, if you can, then you can just do this at the top of each page:

<!--#if expr="\"$DOCUMENT_URI\" != /^\/en/" --> 
<!--#set var="lang" value="fr"-->
<!--#set var="lang" value="en"-->

Then in the rest you simply do:

<!--#include virtual="/{$lang}/htmlchunk" -->

Hope this helps


5:59 pm on Mar 25, 2009 (gmt 0)

5+ Year Member

If you do not like machine translation that possible else do what wrote idfer, for instance -

.htaccess ::

<!--RewriteEngine on-->
<!--RewriteRule ^.htaccess$ - [F]-->
<!--RewriteRule ^goto/$ goto/index.php-->
<!--RewriteRule ^(.*).htm$ index.php-->
<!--RewriteRule ^(.*)/$ index.php-->

index.php ::
<!--$url= explode("/",$url);-->

if it is necessary that splits further
<!--$url[2]= explode(".",$url[2]);-->

well and below that has described idfer

<!--if $uri=="/indexen.html"> header("Location: en/index.html");-->
<!--if $uri=="/indexfr.html"> header("Location: fr/index.html");-->

well or something in this spirit
want good luck!


Featured Threads

Hot Threads This Week

Hot Threads This Month