Web Design Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsWeb DesignWeb Design Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old December 27th, 2003, 11:05 PM
MasterChief MasterChief is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2003
Location: Virginia
Posts: 491 MasterChief User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 4 h 47 m 47 sec
Reputation Power: 6
Send a message via AIM to MasterChief Send a message via MSN to MasterChief
Using multiple languages

How can I get my web site to work with multiple languages? Examples of web sites that use this are:

http://www.debian.org
http://www.gnu.org

Based on what language your browser is, it views the web site in that language. Also, you can choose what language you want to view the web site in, manually (Just click on the link for that language). I will be getting some people interested, to translate.

How can I accomplish this?

Reply With Quote
  #2  
Old December 28th, 2003, 10:55 PM
linuxChique's Avatar
linuxChique linuxChique is offline
watch for flying fingers
Dev Shed Novice (500 - 999 posts)
 
Join Date: Feb 2003
Location: Rocket City, USA
Posts: 739 linuxChique User rank is Captain (20000 - 30000 Reputation Level)linuxChique User rank is Captain (20000 - 30000 Reputation Level)linuxChique User rank is Captain (20000 - 30000 Reputation Level)linuxChique User rank is Captain (20000 - 30000 Reputation Level)linuxChique User rank is Captain (20000 - 30000 Reputation Level)linuxChique User rank is Captain (20000 - 30000 Reputation Level)linuxChique User rank is Captain (20000 - 30000 Reputation Level)linuxChique User rank is Captain (20000 - 30000 Reputation Level)linuxChique User rank is Captain (20000 - 30000 Reputation Level)  Folding Points: 33560 Folding Title: Starter FolderFolding Points: 33560 Folding Title: Starter Folder
Time spent in forums: 4 Days 8 h 44 m 35 sec
Reputation Power: 245
Send a message via ICQ to linuxChique Send a message via AIM to linuxChique Send a message via MSN to linuxChique Send a message via Yahoo to linuxChique Send a message via Google Talk to linuxChique
How does your page work? If its html or flash, then you will have to make a separate file for each language.

If you're using a language such as perl or php, you can set a cookie, and then depending on the value of the cookie, output different text.
__________________

Reply With Quote
  #3  
Old December 29th, 2003, 11:12 AM
MasterChief MasterChief is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2003
Location: Virginia
Posts: 491 MasterChief User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 4 h 47 m 47 sec
Reputation Power: 6
Send a message via AIM to MasterChief Send a message via MSN to MasterChief
I use XHTML 1.0 Strict, CSS, and PHP for everything.

How are they, debian.org and gnu.org, doing it? Are they using seperate files or using cookies?

Reply With Quote
  #4  
Old December 29th, 2003, 02:46 PM
jabba_29's Avatar
jabba_29 jabba_29 is offline
Back in HEL
Dev Shed God 8th Plane (8500 - 8999 posts)
 
Join Date: Feb 2002
Location: Finland
Posts: 8,613 jabba_29 User rank is General 9th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 9th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 9th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 9th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 9th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 9th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 9th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 9th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 9th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 9th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 9th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 9th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 9th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 9th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 9th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 9th Grade (Above 100000 Reputation Level)  Folding Points: 57777 Folding Title: Beginner FolderFolding Points: 57777 Folding Title: Beginner FolderFolding Points: 57777 Folding Title: Beginner Folder
Time spent in forums: 3 Months 3 Weeks 3 Days 5 h 32 m 57 sec
Reputation Power: 1550
Send a message via ICQ to jabba_29 Send a message via AIM to jabba_29 Send a message via MSN to jabba_29 Send a message via Yahoo to jabba_29 Send a message via Google Talk to jabba_29 Send a message via Skype to jabba_29
Facebook
At dembian, for example, they are probably reading the script name and / or location of the file that is being viewed, then selecting the alternative available languages.
I would disagree about the cookies though - I would have a pages in directories like there languages, eg:
  • en - english
  • fi - finnish
  • de - german
, all the pages would be identical in layout, but you would do queries to get the different data per language. That way your PHP script is reading what the URL is or what directory the file is in, then offer an altenative.
You could, (though not 100% affective) redirect the user initial depending on their accept-language of their browser too.

There are lots of ways of doing this. I am sort of (project has cooled down unfortunately) working on a mulit-lingual site at the moment. I have mad all page elements / messages translatable by storing information in INI files, and depending on what language is set, they get info from the ini from the relevant directory.

Hope that helps a bit. Need more info, just ask.
__________________
Cheers,

Jamie


# skiFFie | Home of the 'accessibility module' for Drupal
# Jamie Burns [me] Accessibility Module [drupal]
# guidelines | search | wap resources | not getting help | fold to cure

# Any form of employment is strictly prohibited ......


__________________

Let the might of your compassion arise to bring a quick end
to the flowing stream of the blood and tears .....
Please hear my anguished words of truth.

__________________

Reply With Quote
  #5  
Old December 30th, 2003, 12:48 PM
MasterChief MasterChief is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2003
Location: Virginia
Posts: 491 MasterChief User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 4 h 47 m 47 sec
Reputation Power: 6
Send a message via AIM to MasterChief Send a message via MSN to MasterChief
Hmmm... I think I'm following.

Do you speak another language? If so, could you go to http://www.debian.org with the browser that uses another language and see if it uses that language or if you have to choose it manually.

They use different file names for the languages. I like what they are doing.

Reply With Quote
  #6  
Old December 30th, 2003, 01:17 PM
jabba_29's Avatar
jabba_29 jabba_29 is offline
Back in HEL
Dev Shed God 8th Plane (8500 - 8999 posts)
 
Join Date: Feb 2002
Location: Finland
Posts: 8,613 jabba_29 User rank is General 9th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 9th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 9th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 9th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 9th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 9th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 9th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 9th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 9th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 9th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 9th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 9th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 9th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 9th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 9th Grade (Above 100000 Reputation Level)jabba_29 User rank is General 9th Grade (Above 100000 Reputation Level)  Folding Points: 57777 Folding Title: Beginner FolderFolding Points: 57777 Folding Title: Beginner FolderFolding Points: 57777 Folding Title: Beginner Folder
Time spent in forums: 3 Months 3 Weeks 3 Days 5 h 32 m 57 sec
Reputation Power: 1550
Send a message via ICQ to jabba_29 Send a message via AIM to jabba_29 Send a message via MSN to jabba_29 Send a message via Yahoo to jabba_29 Send a message via Google Talk to jabba_29 Send a message via Skype to jabba_29
Facebook
Can't do it here, as I only have English as a language set up, work has multiple.
They do have different file names however, but they just seem to be extensions -> for example index.html is index.ar.html in arabian.

Reply With Quote
  #7  
Old December 30th, 2003, 06:45 PM
MasterChief MasterChief is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2003
Location: Virginia
Posts: 491 MasterChief User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 4 h 47 m 47 sec
Reputation Power: 6
Send a message via AIM to MasterChief Send a message via MSN to MasterChief
I found out that I could use multiple languages with Internet Explorer. I use Mozilla Firebird all the time. So I made Swedish the first priority language. I went to http://www.debian.org and it was in Swedish.

Is it just looking for a file extension with the name of "index.sv.html" because the language is set to "Swedish" or is Debian getting your language setting of your web browser then using the appropriate file.

Reply With Quote
  #8  
Old January 14th, 2004, 05:22 PM
MasterChief MasterChief is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2003
Location: Virginia
Posts: 491 MasterChief User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 4 h 47 m 47 sec
Reputation Power: 6
Send a message via AIM to MasterChief Send a message via MSN to MasterChief
I will be using different file extensions.

index.en.htm (English)
index.sv.htm (Swedish)
... etc.

On every page, there will be a list of links to the files with what ever language the file is available in.

I also want to have it so that if someone's browser has Swedish as their language, it will automatically open "index.sv.htm" or what ever. How can this task be done? http://www.debian.org does NOT use cookies. I made Swedish the browser language and I said "do not accept any cookies". I went to the web site and it was in Sweedish.

Reply With Quote
  #9  
Old January 17th, 2004, 08:20 PM
MasterChief MasterChief is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2003
Location: Virginia
Posts: 491 MasterChief User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 4 h 47 m 47 sec
Reputation Power: 6
Send a message via AIM to MasterChief Send a message via MSN to MasterChief
Well, I found the way that they do it. I contacted someone at http://www.debian.org and they told me to go to a certain website, because that's where they learned how to do it. I will show you how you can do it too. Anyone may submit this to DevShed as an article (as long as I get credit).

////////////////////- Begin -////////////////////

I have: Apache/2.0.48 (Win32)

First, open up your httpd.conf file. You can find this by going to where you installed Apache. Then go to "Apache2" > "conf" > "httpd.conf"

Go to "DirectoryIndex". Add "index.var.txt" and "index.var" if they are not already there.

Now, restart Apache.

Open up your favorite text editor. Copy and past this into your file:

URI: index.en.htm
Content-type: text/html
Content-language: en

URI: index.fr.htm
Content-type: text/html;charset=iso-8859-2
Content-language: fr

Save that as "index.var"

Now make two simple documents. Here is what I used:

Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US" lang="en-US">
  <head>

    <title>nameofwebsite: Home</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />

  </head>

  <body>

    <p>This is the English document.</p>

  </body>
</html>


Save that as "index.en.htm"

Now...

Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" lang="fr">
  <head>

    <title>nameofwebsite: Home</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-2" />

  </head>

  <body>

    <p>This is the French document.</p>

  </body>
</html>


Save that as "index.fr.htm"

Now go to your Apache server (usually http://localhost/???????)

If you did everything correctly, it should go to the English document (assuming that you have English as your default browser language). You can now change the language setting to French (for your browser) and reload the page, it should now be the French document. If it didn't work try changing the xml:lang and lang in the French document to "en-US".

If you use the include/require function in PHP, then all you have to do is include/require the 'x' language version.

In the English document, you would have:
<?php include_once("http://localhost/www/mainmenu.en.htm"); ?>
OR
<?php require_once("http://localhost/www/mainmenu.en.htm"); ?>

In the French document, you would have:
<?php include_once("http://localhost/www/mainmenu.fr.htm"); ?>
OR
<?php require_once("http://localhost/www/mainmenu.fr.htm"); ?>

Good luck, have fun, and happy coding!

Last edited by MasterChief : January 17th, 2004 at 08:23 PM.

Reply With Quote
Reply

Viewing: Dev Shed ForumsWeb DesignWeb Design Help > Using multiple languages


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support |