views:

271

answers:

1

Hi,

I want to translate my web page to 7 different languages and I'm curious about what is the best way to handle this?

I know this subject opened multiple times but I didn't get a reasonable answer. Actually, all the topics are about php and gettext but I use classic asp (vbscript).

The method I'm using now is that;

I have en.asp and tr.asp which contains

lang_home="Home Page" and lang_home="Ana Sayfa"

and in my pages, I display them like <%=lang_home%>. I don't want to use lots of bracelets because I believe they slow down my site.

Evan, I thought that <%=GetTranslatedText(lang_home)%>

What I need to know is what is the best approach for multi-language web sites for asp and is there any solution like gettext for asp?

Thanks in advance.

A: 

There are only two ways to send dynamic text to the browser in ASP:

  1. Write the entire HTML page with Response.Write calls
  2. Embedded calls to Response.Write in otherwise-static HTML.

I think you're on the right path, balancing the need to have easily-editable HTML code with a fast lookup and replacement of language-specific strings. At least faster than, say, a bunch of SELECT CASE statetments, or a lookup against a Collection.

(If performance is really an issue, why not move over to ASP.NET?)

One other option is to pre-compile your ASP pages... keep a template of, say, "default.asp.template" that contains variables, separate language files (like you have now), and some code to generate "default-en.asp", "default-en.asp", etc. each time you change your template. Then, set the "default.asp" to simply and silently transfer execution to the correct page based on the user language.

An excellent (but commercial) app I've used for pre-compilation of ASP pages is WebGecko APGen (http://www.webgecko.com/).

richardtallent