• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 735
  • Last Modified:

classic asp

Hello Experts,

I have a website having 5 webpages, I want to give users the facility to convert these pages to spanish language whenever they want i.e website in two language.

Can I do this in classic ASP?  if yes can you provide some guidelines so that I can achieve it.

Dinesh Kumar
Dinesh Kumar
2 Solutions
Loganathan NatarajanLAMP DeveloperCommented:
Dinesh KumarAuthor Commented:
I think I can use XML to store language specific content as XML is much faster than Database.

It would be better if you can tell me how to parse the JSON in asp which is lightweight and parsing should be easy in it.
Scott Fell, EE MVEDeveloper & EE ModeratorCommented:
An easy option is to simply use google translate https://translate.google.com/manager/

Another option is to have separate pages for spanish.  Normally, this may not be the best solution but you have a small number of pages.  If somebody clicks to see the site in spanish then they will be taken to the spanish home page.  The plus side of this gives you control of everything including images and layout.

The next option is to make your outer layout into a template and use include files for the content.  If english in chosen, then include english content, if spanish is chosen, include spanish.  

You will make one file called ePage1Main.asp for your english content.  It only needs the html markup for the content.  And another for ePage1SideBar.asp for a side bar content.  Then do the same for sPage1Main.asp and sPage1SideBar.asp for the spanish version.

Then create a template like below
if request.form("language")<>"" then
     ' value e for english; s for spanish
end if
<title>My site</title>
<!--#include virtual=<%=language%>"Page1Main.asp"-->
<!--#include virtual=<%=language%>"Page1SideBar.asp"-->

Open in new window

This works in the similar was as if you used json except the include file places the content directly on the just as if you hard coded it.  With json or xml, you still need to call it.  If you are worried about speed, this is the fastest.

If you still want to use a json file.  Check out http://code.google.com/p/aspjson/.  I used this a lot and works great.
Do you want to literally translate the page on the fly or do you want to have two versions of the page and serve up the appropriate language's content?

If you will have the content pre-translated, you may want to place the content in your HTML into two separate DIVs and merely display the DIV that contains the user's preferred language.

For example,
If the page defaults to English and it has a "En Espanol" link/button, you run some simple javascript that hides the <div id="english"> and displays the <div id="spanish">
function swapLangauge(lang) {
  if (lang=='spanish'){
    document.getElementById('english').style.display = 'none';
    document.getElementById('spanish').style.display = 'block';
  } else {
    document.getElementById('spanish').style.display = 'none';
    document.getElementById('english').style.display = 'block';

Open in new window

Dinesh KumarAuthor Commented:
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

Tackle projects and never again get stuck behind a technical roadblock.
Join Now