Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
student:java:localization [2018/08/16 10:47] bernstdhstudent:java:localization [2022/05/03 14:18] (current) bernstdh
Line 26: Line 26:
  
  
-The Java Virtual Machine can be provided with the information is   should use to identify the ''%%Locale%%'' when it is started   using the ''%%-Duser.country%%''   and ''%%-Duser.language%%'' options. For example, when   executing an application named ''%%Test%%'' in the United   States one could tell the JVM to use the ''%%Locale%%'' for   Canadian French as follows: +The Java Virtual Machine can be provided with the information is   should use to identify the ''%%Locale%%'' when it is started   using the ''%%-Duser.country%%''   and ''%%-Duser.language%%'' options. For example, when   executing an application named ''%%Test%%'' in the United   States one could tell the JVM to use the ''%%Locale%%'' for  Canadian French using the following virtual machine (VM) options:
  
 <code> <code>
-java -Duser.country=CA -Duser.language=fr Test+-Duser.country=CA -Duser.language=fr
 </code> </code>
 +
 +They can be passed to the VM from the command line when executing the ''%%java%%'' command. (Note: When using PowerShell, the arguments must be enclosed in double-quotes.) All IDEs also have a way of passing options to the VM (e.g., in Eclipse as part of the "VM arguments" in the"Arguments" tab of a "Run Configuration"; in jGRASP as "RUN Arguments").
 +
  
 It is also possible to change the ''%%Locale%%'' inside of a   program using   the [[ http://docs.oracle.com/javase/9/docs/api/java/util/Locale.html#setDefault(java.util.Locale) |  java.util.Locale#setDefault(java.util.Locale) ]]   method. It is also possible to change the ''%%Locale%%'' inside of a   program using   the [[ http://docs.oracle.com/javase/9/docs/api/java/util/Locale.html#setDefault(java.util.Locale) |  java.util.Locale#setDefault(java.util.Locale) ]]   method.
Line 85: Line 87:
  
  
-There are versions of the ''%%printf()%%''     and ''%%format()%%'' methods in     the [[ http://docs.oracle.com/javase/9/docs/api/java/io/PrintStream.html |  java.io.PrintStream ]] class that are     a ''%%Locale%%'' object and use it to determine the     appropriate formatting for numbers. The versions that are not     passed a ''%%Locale%%'' simply call the versions that are,     passing the default ''%%Locale%%''. Hence, if one uses these     methods one need not make any special accommodations to handle     locales.+There are versions of the ''%%printf()%%'' method in  the [[ http://docs.oracle.com/javase/9/docs/api/java/io/PrintStream.html |  java.io.PrintStream ]] class and and ''%%format()%%'' in the [[ http://docs.oracle.com/javase/9/docs/api/java/lang/String.html |  java.lang.String ]] class that are     a ''%%Locale%%'' object and use it to determine the     appropriate formatting for numbers. The versions that are not     passed a ''%%Locale%%'' simply call the versions that are,     passing the default ''%%Locale%%''. Hence, if one uses these     methods one need not make any special accommodations to handle     locales.
  
  
Line 111: Line 113:
   * [[ https://docs.oracle.com/javase/tutorial/i18n/ | Localization/Internationalization in Java ]]   * [[ https://docs.oracle.com/javase/tutorial/i18n/ | Localization/Internationalization in Java ]]
   * [[ http://www.oracle.com/technetwork/articles/javase/locale-140624.html |    * [[ http://www.oracle.com/technetwork/articles/javase/locale-140624.html | 
-  Understanding ''%%Locale%%'' ]]+  Understanding Locale ]]
   * [[ https://docs.oracle.com/javase/tutorial/i18n/text/shapedDigits.html |    * [[ https://docs.oracle.com/javase/tutorial/i18n/text/shapedDigits.html | 
   Using Different Number-Writing Systems ]]   Using Different Number-Writing Systems ]]