By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,741 Members | 1,973 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,741 IT Pros & Developers. It's quick & easy.

whats the best way to have multiple language asp pages?

P: n/a
Hello all,

any advice or links to pages about how to have multiple language asp
pages? For example, you have a database driven website that you want
customers around the world to use. How do you setup the asp pages so
that it is easy to change the text based on where the user is
connecting from?

Thanks,
Mike

Sep 14 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Mike,
any advice or links to pages about how to have multiple language asp
pages? For example, you have a database driven website that you want
customers around the world to use. How do you setup the asp pages so
that it is easy to change the text based on where the user is
connecting from?


There are several aspects to this. One of which is how/if you automatically
will determine the users locale (like much of microsoft.com does, for
instance), or if you will present a specific language and allow the user to
choose from other languages as he or she pleases. One other aspect is how to
present the correct information based on the users locale or choise. I'll
give you a few pointers on the latter part;

Normally when I start designing a multilanguage site, I start with paper and
pencil, and establish an overview of how the database needs to be designed.
The content and functionality of the site sets the boundaries for this. In a
very simplified version, let's say that the page's build, the layout,
positioning of images, etc. etc. are all done in the asp page. The only data
you store in the database (as far as this example goes, is the acctual text
(and, prehaps, some formatting) of the document. My table handling this
would look something like the following:

tblPages:
fldID, integer, identity, auto increment, no nulls, no duplicates (this
field is only needed if you require a unique identifier, or a primary key)
fldName, (var)char, [size according to preference], no nulls, allow
duplicates
fldContents, (var)char, [size according to preference],no nulls, allow
duplicates (not likely to have duplicates, but nevertheless)
fldLanguage, (var)char, [size according to preference (you should only need
two characters, but maybe the language name is more descriptive)], no nulls,
allow duplicates

That is a VERY simplified table, but it would do the trick. Now, using
whatever method you deem fitting, you either temporary (session variable) or
semi-permanently (cookie) store a variable determining the users prefered
language, or in the event that you need support for browsers/users that do
not allow for cookies, pass a variable with every page request. This
variable allows for filtering what content to provide in the asp page. The
SQL could look like

"SELECT fldContent FROM tblPages WHERE fldName = '" &
strNameOfContentYouRequest & "' AND fldLanguage = '" & strLanguageVariable &
"'"

Again, this is a gravely simplified query, it does not protect against SQL
injection, and so on. But I hope it gives the general idea. In the database
table, you might want to add colunms for createdDate, validFrom, validTo,
contentActive, and so on, depending on the complexity of the application.

HTH,

//Leif Beaton
Sep 14 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.