Java – Does Android automatically convert numbers to native alphabet?

Does Android automatically convert numbers to native alphabet?… here is a solution to the problem.

Does Android automatically convert numbers to native alphabet?

I have an app that generates numbers. I want to localize for China.

I have code like this:

this.diceValueTextSwitcher.setText("" + (rand.nextInt(6) + 1));

where diceValueTextSwitcher is a text field.

I don’t need to localize numbers for Europe and North America (and other countries where European languages are spoken) because all major European languages (except Russian?) ) all use the Arabic alphabet (0…9). However, Mandarin and Cantonese do not.

If my Android phone is set to Cantonese or Chinese, will Android automatically convert Arabic numerals to Arabic equivalents? Or can Java do this? Or will it not happen at all? If so, is the best way to localize it to have Mandarin string (or other) characters swapped in/out in the normal way?

Solution

It won’t

convert for you automatically, it won’t. The main reason may be that the numbering system does not work exactly the same. Yes, it is a decimal system, but there are separate characters for ten, hundred, thousand, thousand, etc. This is not a one-to-one character swap. Therefore, if it does convert one-to-one, it doesn’t make sense to native readers.

For example, for Arabic numerals, to write twenty-three, you can:

(two)(three)

In Japanese, you can write:

(two)(ten)(three)

I’m not worried though. The Arabic numeral system is taught in schools in Asian countries, and they use it extensively for most things that involve large numbers of people. Price tags, accounting, games, meters, and so on.

If you really really want to localize, you’ll have to do it manually with the correct strings, or look for conversion functions.

Disclaimer: This is based on the fact that I have lived in Japan for a few years, but I am almost certainly the same in China. They use a lot of the same ideograms, including numbers.

Related Problems and Solutions