• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 733
  • 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.

regards
dinesh
0
Dinesh Kumar
Asked:
Dinesh Kumar
2 Solutions
 
Loganathan NatarajanLAMP DeveloperCommented:
0
 
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.
0
 
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
<%
language="english"
if request.form("language")<>"" then
     language=request.form("language")
     ' value e for english; s for spanish
end if
%>
<html>
<head>
<title>My site</title>
</head>
<body>
<article>
<!--#include virtual=<%=language%>"Page1Main.asp"-->
<article>
<aside>
<!--#include virtual=<%=language%>"Page1SideBar.asp"-->
</aside>
</body>
</html>

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.
0
 
nap0leonCommented:
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

0
 
Dinesh KumarAuthor Commented:
Thanks.
0

Featured Post

Become an Android App Developer

Ready to kick start your career in 2018? Learn how to build an Android app in January’s Course of the Month and open the door to new opportunities.

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