Wednesday, April 20, 2011

Flex 4.1: Creating a new locale for i18N capable application

What to do, if you are planning to create a flex application that will be internationalized application with locals, and your Flex SDK doesn’t support that locals? Let’s solve it as the following.

Note: there is a tool bundled with Flex SDK (copylocale.exe) that provides creation the new locals.
This example applied to flex SDK 4.x and above.
Usage: copylocale src_locale(language_country) dst_locale(language_country)

Let’s take an example of Arabic support, the default Flex SDK doesn’t support Arabic as local so we need to add it.
If you have flex SDK or you have installed the adobe flash builder 4.x Standard or premium go to the following path.
  1. You have to download Java JRE to allow the tool to run. ***Very important…..
  2. For flex SDK, if downloaded and unzipped the SDK under folder named C:\ Adobe Flex SDK 4.1
    1. Go to C:\ Adobe Flex SDK 4.1\bin
  3. For installed adobe flash builder 4.x
    1. Go to C:\Program Files (x86)\Adobe\Adobe Flash Builder 4\sdks\4.1.0\bin         windows x64 bit
    2. Go to C:\Program Files\Adobe\Adobe Flash Builder 4\sdks\4.1.0\bin                   windows x32 bit
  4. Open CMD command prompt and point to the above path
    1. C:\Program Files (x86)\Adobe\Adobe Flash Builder 4\sdks\4.1.0\bin>
    2. Type the copylocale command to copy the local you want as the following
      1. I want to create Arabic Egyptian local.
      2. C:\Program Files (x86)\Adobe\Adobe Flash Builder 4\sdks\4.1.0\bin> copylocale en_US ar_EG
      3. You will see verbose lines for the tool until it finished and returns to the command line prompt.
  5. To check that your local is created, go to the following path “C:\Program Files (x86)\Adobe\Adobe Flash Builder 4\sdks\4.1.0\frameworks\locale” and you should see you created locale ar_EG.
  6. Congratulation you have done.
Some troubleshooting:
P1 - If you run the copylocale and get the following error:
Error loading: C:\Program Files\Java\jdk1.6.0_21\jre\bin\server\jvm.dll
Answer: this happened when you haven’t installed the java JRE, or installed the JRE x64 bit version.
1- Install the x32 bit version of java JRE.
2- Point to already 32bit java JRE installed. Or to JRE bundled with already installed application, if you want to keep existing x64 bit version.
do the following
  1. Go to the “C:\Program Files (x86)\Adobe\Adobe Flash Builder 4\sdks\4.1.0\bin” and locate the following file “jvm.config”.
  2. Edit the file and locate the line “java.home=”
  3. Make it “java.home=E:/Utilities/Oracle/Middleware/JDev11gU2/jdk160_05”.  For example
    1. Note forward “/” slash not backward “\” slash.
Run again and you will find everything goes successfully.


  1. I have created an arabic locale using the command:

    copylocale en_US ar_JO

    it seems that everything went fine.. I was able to see the folder ar_JO inside the "locale" sub folder of my Flex Builder installation folder. However, whenever I use Arabic locale in my application it appears as squares... I don't see any arabic letter... any idea?

  2. Did you configured the local in your compiler settings in your IDE?

  3. thanx

    Did you configured the local in your compiler settings in your IDE?

    can you tell me how?

  4. 1- Right click on ur project from project explorer.
    2- Select Properties.
    3- From properties menu select flex compiler.
    4- In additional compiler arguments put the following line "-locale en_US ar_JO"

  5. I try it and not work fine in my ios
    see picture please
    and in my code
    and in compiler settings
    -locale en_US ar_SA

  6. I think that iOS doesn't render Arabic correctly.

  7. Adobe flah builder 4.5
    flex 4.5.1

  8. Ok try it in normal web application just one page, to see if it is iOS problem or not.

    for me i have tried it in web and AIR applications and it works.

  9. In Air application work good

    but on android or iphone not all components not work

    Label work good
    textbox arabic character is squers