participate


Internationalization (I18N) - Java, Mint and Locale
<<   Back to Forum  |   Give us Feedback
This topic has 1 reply on 1 page.
asdalskdjewfwefcf
Posts:1
Registered: 7/3/06
Java, Mint and Locale   
Nov 2, 2009 10:33 AM

 
Hello,

I am doing some programming in the Java language. In my country we use the dot (.) separator for the decimals and the comma separator for the thousands. For example the number

1,234.567 in the British locale is written as 1.234,567. When I was doing the java programming in Windows Vista Java could detect the default locale and represent and accept output/input of numbers in the right format. Now in (Linux) Mint although I changed the locale (with a process that I will describe below) Java didn't consider that and continued to use its own British locale. Only after using the NumberFormat class and the Locale object I managed to have the expected result but in Windows Vista this happened automatically. Because I don't want to switch back to Vista can you help me?

The procedure that I followed: changed the /var/lib/locales/supported.d/local by adding this line el_GR.UTF-8 UTF-8
changed the /etc/default/locale/ by modifying the variable LANG to el_GR.UTF-8 and the variable LANGUAGE to el_GR:el
run the command sudo dpkg-reconfigure locales
reboot the system
recompile my program.
The code of my program is the following:
public class Dokimi
{
	public static void main(String [] args)
	{
	Number n = new Double(4.2);
 
	System.out.println(n.doubleValue());
	}
}


I have the same problem when I use JOptionPane showInputDialog to get input from the user. If I enter the number 4,2 instead of 4.2 I get an error.

Thanks
 
Joerg22
Posts:1,111
Registered: 6/25/03
Re: Java, Mint and Locale   
Nov 21, 2009 2:01 PM (reply 1 of 1)  (In reply to original post )

 
Try setting the locale from within your programme with
Locale.setDefault(Locale newLocale)
 
This topic has 1 reply on 1 page.
Back to Forum
 
Read the Developer Forums Code of Conduct

Click to email this message Email this Topic

Edit this Topic
  
 
 
Forums Statistics
    Users Online : 54
  • Guests : 135

About Sun forums
  • Sun Forums is a large collection of user generated discussions. It is here to help you ask questions, find answers, and participate in discussions.

    Check out our guide on Getting started with Sun Forums for a full walkthrough of how to best leverage the benefits of this community.

Powered by Jive Forums