Search This Blog


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.