I finally figured out how to get my web pages to be in Spanish. This is been a desire I had now for a long time, but recently I been thinking of moving back to Tiahuana and intagrating my knowledge of the Internet with the tequila culture that florishes there. The'res lots of ways to get online, like if you go to a Internet cafe, but have you every considered surfing the net when your in a tequila bar? No of course not. And most if not all the folks in Tiahuana haven't either. So I'm thinking that maybe theres a gap in the market that no one's yet foreseen (yes, hard to beleive in this day and age): A network of free access points, funded by the city, for all tequila establishments combined with lots of Internet pages translated in to Spanish! Like they say, if you can't bring the horse to the well, bring the well to the horse.
So this is a two-fold process. We all have to sign a petishion that states that culture and education would benifit from the Internet, and after I recieve a thousand email addresses and credit card numbers, we'll present this to the Mayor of Tiahuagna and then we'll need to support some service for the Spanish Internet pages. I been trying to learn Struts lately and I found a way to do this combined with Google transalater:
So this is a two-fold process. We all have to sign a petishion that states that culture and education would benifit from the Internet, and after I recieve a thousand email addresses and credit card numbers, we'll present this to the Mayor of Tiahuagna and then we'll need to support some service for the Spanish Internet pages. I been trying to learn Struts lately and I found a way to do this combined with Google transalater:
- Create a page in your web project that will be the page thats going to be multilingual. For example I programmed a page that introduces the project and contains a form that will get your name, credit card details, and email:
<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <link rel="stylesheet" type="text/css" href="gstyle.css"> <title>Tiahuana Project</title> </head> <body bgcolor="#eee" style="font-family: sans-serif"> <center> <h1>Tiahuana Project</h1> <p style="width:50%">The Internet is a primary source of intellectual stimulation for people of all ages and for collaboration of people across geographic boundaries. Help support our efforts to intagrate the Internet into places including, but not limited to, tequila bars. We need your moral and financial support.</p> <html:form action="/signup"> <table cellpadding="5"> <tr> <td align="right">Name: </td> <td><html:text property="name" /></td> </tr> <tr> <td align="right">Email Address: </td> <td><html:text property="email" /></td> </tr> <tr> <td align="right">Credit Card Type and Number: </td> <td><html:text property="ccDetails" /></td> </tr> <tr> <td></td> <td><html:submit value="Donate" /></td> </tr> </table> </html:form> </center> </body> </html> - Create a properties file named 'words' in your web project in the WEB-INF > classes folder. If the classes folder doesn't exist then create it. Then create key value pairs for all the text in the page:
title=Tiahuana Project name=Name
- Then create another properties file in the WEB-INF > classes folder and call it words_es:
- Go to the Google Translator Page for a free translation of words into Spanish:
http://translate.google.com
Type in the English words and get the Spanish translaiton
Add the translations to the Spanish properties file:title=Proyecto Tiahuana name=Nombre email=El dirección de correo electrónico creditcard=Tipo de tarjeta de crédito y el número intro=El Internet es una fuente primaria de estímulo intelectual para las personas de todas las edades y para la colaboración de personas a través de límites geográficos. Ayuda de apoyo a nuestros esfuerzos intagrate los lugares en Internet, incluyendo pero no limitado a, tequila bares. Necesitamos su apoyo moral y financiero. example=por ejemplo
-
In the struts-config file add an entry for the properties file (you only have to do one entry, for the words.properties file):
<message-resources parameter="words" null="false"/>
- Now go back to the form page and use <bean:message> tags everywhere:
<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <link rel="stylesheet" type="text/css" href="gstyle.css"> <title><bean:message key="title"/></title> </head> <body bgcolor="#eee" style="font-family: sans-serif"> <h1><bean:message key="title"/></h1> <p style="width:70%"><bean:message key="intro"/></p> <html:form action="/signup"> <table cellpadding="5"> <tr> <td align="right"><bean:message key="name"/>: </td> <td><html:text property="name" /> <span style="color:grey"> <bean:message key="example"/>: Larry Wales</span> </td> </tr> <tr> <td align="right"><bean:message key="email"/>: </td> <td><html:text property="email" /> <span style="color:grey"> <bean:message key="example"/>: larrywales@hotmail.com</span> </td> </tr> <tr> <td align="right"><bean:message key="creditcard"/>: </td> <td><html:text property="ccDetails" /> <span style="color:grey"> <bean:message key="example"/>: Visa 1234-1234-1234-1234</span> </td> </tr> <tr> <td></td> <td><html:submit value="Donate" /></td> </tr> </table> </html:form> </body> </html> - Run the project and you should see the page showed above in your Internet browser. To tell your browser to view the Spanish, you got to change the language settings in it. I did this like this in Firefox on my new computer:
- Now when you view the page again the browser shows the Spanish versoin:
