File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSP and the fly likes Dynamically convert english numbers to arabic in jsp Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Dynamically convert english numbers to arabic in jsp" Watch "Dynamically convert english numbers to arabic in jsp" New topic
Author

Dynamically convert english numbers to arabic in jsp

Susan Monz
Greenhorn

Joined: Aug 23, 2008
Posts: 27
Hi,

I am using Jdeveloper 10.1.2. JSP Struts application. I have seen so many topics on Arabic, but I think my problem is a little different. I have a JSP page which can have 3 versions. One in English, English-Arabic combo and Arabic. Now i could use Application resources. properties file and have a single jsp page. But i choose 3 different jsps. Now I have some data already stored in the database which i can pick and convert to Arabic.
My real problem is the date field and other numeric details that aren't stored. Suppose my page has a field current date. Is there any way I can convert it into its arabic version and display. Remember i also have bilingual pages, so how do i do this. PLease I hope someone has done this before....

Susan..
Martijn Verburg
author
Bartender

Joined: Jun 24, 2003
Posts: 3274
    
    5

Hi Susan,

You probably need to think about a full internationalisation design for your application, this Old article gives some insight on how to do it at the JSP level. I'm not sure what Struts tags etc there might be to assist you as well.

As a last hint, think Locale and NumberFormat


Cheers, Martijn - Blog,
Twitter, PCGen, Ikasan, My The Well-Grounded Java Developer book!,
My start-up.
Susan Monz
Greenhorn

Joined: Aug 23, 2008
Posts: 27
Thanks, The articles you suggested helped a lot. I have created my page complete with resource bundles and the like and i even thoughtdoing the below


java.util.Locale locale = new java.util.Locale("ar");
java.text.DecimalFormat df = (java.text.DecimalFormat)
java.text.DecimalFormat.getNumberInstance(locale);

System.out.println(df.format(12345));

I thought it would display the corresponding arabic numbers. Whereas it doesn't do so. It only displays the same thing.
I was hoping someone already took care of tis. Since I have seen topics on this from 2005...
Also as if this wasn't enough I have to also display arabic calenders instead of the english one.

Help!!!
Martijn Verburg
author
Bartender

Joined: Jun 24, 2003
Posts: 3274
    
    5

Originally posted by Susan Monz:
Thanks, The articles you suggested helped a lot. I have created my page complete with resource bundles and the like and i even thought doing the below

java.util.Locale locale = new java.util.Locale("ar");
java.text.DecimalFormat df = (java.text.DecimalFormat)
java.text.DecimalFormat.getNumberInstance(locale);

System.out.println(df.format(12345));

I thought it would display the corresponding arabic numbers. Whereas it doesn't do so. It only displays the same thing.
I was hoping someone already took care of this. Since I have seen topics on this from 2005...
Also as if this wasn't enough I have to also display arabic calenders instead of the english one.

Help!!!


Oh right, yeah NumberFormat won't perform the automatic conversion to Arabic text, it gives you a romanized version of that. I wasn't able to find any libraries out there on the web but luckily Javaranch from 2 years ago rides to the rescue! It's a bit of a manual process but see this link for some sample code.

Disclaimer: There may be a better 'API' way to do this these days (hopefully someone else chimes in)
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Dynamically convert english numbers to arabic in jsp
 
Similar Threads
Arabic Display
pageEncoding="UTF-8" in jsp
Multilingual support by JTextField
how to export PDF report within the Arabic and English data through jsp code.
Converting JSP to XML