homepage Welcome to WebmasterWorld Guest from 54.211.34.105
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Hardware and OS Related Technologies / Website Technology Issues
Forum Library, Charter, Moderators: phranque

Website Technology Issues Forum

    
Website in 2 languages. Use SSI?
terrybarnes

5+ Year Member



 
Msg#: 3806732 posted 10:46 am on Dec 13, 2008 (gmt 0)

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.

 

terrybarnes

5+ Year Member



 
Msg#: 3806732 posted 11:24 am on Dec 13, 2008 (gmt 0)

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?

txbakers

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



 
Msg#: 3806732 posted 7:16 pm on Jan 11, 2009 (gmt 0)

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.

terrybarnes

5+ Year Member



 
Msg#: 3806732 posted 1:02 pm on Jan 12, 2009 (gmt 0)

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.

coopster

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



 
Msg#: 3806732 posted 8:51 pm on Jan 14, 2009 (gmt 0)

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.

terrybarnes

5+ Year Member



 
Msg#: 3806732 posted 9:02 pm on Jan 14, 2009 (gmt 0)

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

beggo

5+ Year Member



 
Msg#: 3806732 posted 4:00 am on Mar 24, 2009 (gmt 0)

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

terrybarnes

5+ Year Member



 
Msg#: 3806732 posted 6:51 am on Mar 24, 2009 (gmt 0)

Sorry "beggo" what do you mean?

beggo

5+ Year Member



 
Msg#: 3806732 posted 5:17 pm on Mar 24, 2009 (gmt 0)

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]

LifeinAsia

WebmasterWorld Administrator lifeinasia us a WebmasterWorld Top Contributor of All Time 5+ Year Member



 
Msg#: 3806732 posted 6:00 pm on Mar 24, 2009 (gmt 0)

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. :)

terrybarnes

5+ Year Member



 
Msg#: 3806732 posted 6:26 pm on Mar 24, 2009 (gmt 0)

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.

idfer

5+ Year Member



 
Msg#: 3806732 posted 11:03 pm on Mar 24, 2009 (gmt 0)

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-->
<!--#else-->
<!--#include english_version-->
<!--#endif-->

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"-->
<!--#else-->
<!--#set var="lang" value="en"-->
<!--#endif-->

Then in the rest you simply do:

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

Hope this helps

beggo

5+ Year Member



 
Msg#: 3806732 posted 5:59 pm on Mar 25, 2009 (gmt 0)

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=$_SERVER['REQUEST_URI'];-->
<!--$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!

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Hardware and OS Related Technologies / Website Technology Issues
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved