Localization: Convert English Number to Bangla Number


To support localization in an application, We need to store all primary text translations into files or database.

There are some techniques to set language into the app or website. We can set language automatically based on users location or IP address, or we can provide option to change it manually.

Every popular framework or platform like Android, J2EE, PHP frameworks and CMS support multi-language localization. Most of these are based of simple configuration or settings.

Most common approaches used by these platform or frameworks are:

  • XML based localization string files
  • Database driven: tag based data structure.

But some times also we need to convert text or number with code.

Here is a scenario like this: If we want to print serial number of some items, we need to print number(1,2,3….). But to support localization like Bangla language we need to convert this number to Bangla number(,,৩,...).

Here is code example in java to convert an English number to Bangla number:

public String engNumToBngNum(String number) {
    StringBuffer sb = new StringBuffer();
    for(int i=0;i<number.length();i++){
        sb.append((char) (number.charAt(i) + '০' - '0'));
    return sb.toString();

Leave a Reply

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