How to do internationalization in classic ASP (w/o dynamic includes)?

E

Emre Sevinc

I'm using classical ASP on IIS 6.0 (Windows 2003 Server). What I want
to do is to serve the same pages in two different languages without
using two different folders and doubling my same ASP code and changing
the string values.

What I need is DYNAMIC INCLUDE functionality similar to PHP, however I
know that I don't have it in ASP. Moreover Server.Execute is useless
because it doesn't have a functionality like an include file, calling
some file (that includes language string constants) conditionally is
not useful because when the file is executed its scope is over and I
cannot reach the constants or variables defined in that file.

What do you advise in such a situation? I need two groups of
constants, one for English, one for Turkish, like:

english.asp
---------------
lngWeek = "Week"
lngEdit = "Edit"
lngSubmit = "Submit"
..
..
..


turkish.asp
---------------
lngWeek = "Hafta"
lngEdit = "Düzenle"
lngSubmit = "Gönder"
..
..
..


and use the same constant throughout my other ASP pages. Now, you may
advise me to use database, yes I can store the data above in a
database but everytime an ASP page is rendered a connection must be
opened to database and I need loops (imagine I more than a few hundred
string constatns) and control structures. The performance penalty
scares me.

How can such a system be implemented in classical ASP?

Thanks in advance.
 
A

Aaron [SQL Server MVP]

What I need is DYNAMIC INCLUDE functionality similar to PHP, however I
know that I don't have it in ASP.

Have you seen http://www.aspfaq.com/2042 ?

You could also store your constants in a database table with three columns:
ConstantName, EnglishValue, TurkishValue, and then have a stored procedure
or function that takes your current locale as a parameter and returns the
constants as a single resultset or as output parameters. You really
shouldn't be so scared of making minimal calls to a database if it makes
your job easier. With the hardware we're using these days, it's not as
sacreligious as it used to be. I would bet that a large percentage of the
web sites you go to use the database not just for constants but for all of
the content as well, and the only ones that are slow are the ones that are
on a single node, old compaq server with 256 MB of RAM, using Access and
trying to serve 8 billion pages an hour (e.g. friendster.com). Anyway, you
should test the performance of a database solution, instead of just writing
it off based on assumptions and fear.
 
E

Emre Sevinc

Thanks for the advice. We did a simple test and saw that it took about
roughly 55 seconds to make 3500 calls to SQL Server from within an ASP
page. This calculation let us to decide and we decided to use database
for storing our multilingual string constants.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top