Results 1 to 5 of 5

Thread: Converting numbers to other languages?

  1. #1

    Thread Starter
    Dazed Member
    Join Date
    Oct 1999
    Location
    Ridgefield Park, NJ
    Posts
    3,418

    Resolved Converting numbers to other languages?

    Anyone know a way to take an integer and convert it to it's representation in another language? I tried this and it dosen't seem to convert the number over. Thanks.
    Code:
     import java.io.*;
     import java.text.*;  
     import java.util.*;
    
     try{
       BufferedReader buff = new BufferedReader(
       new InputStreamReader(System.in));
        String input = buff.readLine(); 
        NumberFormat nf = NumberFormat.getInstance(Locale.CHINESE);
        Number converted = nf.parse(input);
        System.out.println(converted.shortValue()); 
       }catch(IOException io){
         System.err.println(io); 
        }catch(Exception e){
         System.err.println(e); 
        }

  2. #2
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594

    Re: Converting numbers to other languages?

    What do you mean by "other language"? Do you want to convert 5 to "five" if English is selected and "fünf" if German is selected? There's nothing in Java that does that. All Java does for you is to place correct punctuation for large numbers, e.g. 1000000 to 1,000,000 in English, 1.000.000 in German, 10.00.000 in Nepalese, ...
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  3. #3

  4. #4
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594

    Re: Converting numbers to other languages?

    Welllllll.........

    Not out of the box, no. You need:
    a version of Java that has full support for Chinese (no idea where to get it).
    a font that supports Chinese characters.
    and perhaps even a Windows that supports Chinese.

    Then your method should yield the correct result.
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  5. #5

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width