How to make an International Java Application

This post explains how to make an international application in Java.

Aspects to consider when making an International Application in Java

There are some aspects to take into account when making an international Java application:

  • Language
  • Script directionality
  • Number format
  • Date format
  • Decimal format
  • Coding
  • Currency

Language

When making an international application, language may vary between one nation and another. And in fact, some nations have many official or co-official languages.

For more information about how to make a multilingual Java application, check this post.

Script Directionality

Though most modern scripts are read left to right, top to bottom, there are some languages like the extended Arab that are read right to left (RTL).

When there is a RTL, developers should consider adding also layout component in reverse order.

Date Format

Date format is different depending on the country.

Decimal format

Java, as default, uses the dot (.) as the decimal separator for numbers.

However, in some languages like Spanish and Portuguese, they use a comma (,).

Currency

If amounts are displayed within the application, consider whether it makes sense to convert this amount into a local currency.

How to work with Locale Class in Java

Get locale from system:

Locale myLocale = Locale.getDefault();

Store a locale in a variable (option 1):

Locale aLocale = new Locale("fr", "CA"));

Store a locale in a variable (option 2):

Locale aLocale = new Locale.Builder().setLanguage("fr").setRegion("CA").build();

Set a locale in a program in Java:

Locale.setDefault(aLocale) 

You might also be interested in…

External References

One comment

Leave a Reply

Your email address will not be published. Required fields are marked *