Time to time I get requests for adding new custom language support in Adobe AIR. Unfortunately, officially you can use only English, Chinese, Czech, Dutch, French, German, Italian, Japanese, Korean, Polish, Portuguese, Russian, Spanish, Swedish and Turkish.
You can use any language inside your app but when you want to see your custom language in Apple AppStore market as supported – you need my help. From my statistics I see that AIR developers mostly required Danish, Hebrew and Norwegian languages as additional. In my own case I need Slovak language support
Technically (I don’t know why) all language support is embedded inside AIR SDK binaries and you can’t find simple solution (or I don’t know about it). But you can patch AIR SDK binaries to fix this.
Part 1: Software preparing
This tutorial for Windows users only. Produced patched version of AIR SDK will work on OSX also but patching can be done using Windows according to my tutorial.
First thing that you need it’s obtain latest AIR version. At time of this article it’s AIR 18.104.22.168 from the labs.
Now you need to download Java Bite software. Unfortunately, official web site don’t work anymore and this disassembler is outdated but still work perfectly! Many times I tried to contact it’s author but without any success so I’m posting link from my dropbox. Also it’s free.
Finally you need to download 7zip archiver. It’s also free to use.
Part2: Patching Adobe AIR SDK binaries
1. Go to Adobe Air SDK\air16_sdk_win\lib and open adt.jar file in 7zip
2. In adt.jar go to com\adobe\air\ and locate ApplicationDescriptor.class file
3. Extract it somewhere by a simple drag and drop out of jar archive. For ex. drag it to c:\
4. Execute jbloader.exe from JavaByte.zip (link above)
5. Go to Classes menu and select Add Java Class
6. Select ApplicationDescriptor.class file
7. Find your language codes. For example I will add Danish, Hebrew, Slovak and Norwegian. I founded this page really useful with language codes for iOS. So my codes is da, he, sk and nb.
8. Back to disassembler and select Class Tools > Add new constant pool entry > CONSTANT_Utf8
9. Now add da string and press Ok. Do the same for the rest he, sk, nb
10. In previous step we created Utf8 constant. Now we must to create a String constant from that Utf8 constant. Go to Class Tools > Add new constant pool entry > CONSTANT_String
11. Select our first language da Utf8 entry from the end of list and press Ok. Do the same for the rest languages
12. Now we must to check everything is correct. Press on Constant Pool at the left of Java Byte class explorer and check that you have 4 new Utf8 records and 4 String that was linked to that Utf8
13. Ok, we almost finished with Java Byte disassembler. Now press on <clinit> entry in Methods entry. You will see disassembled Java virtual machine bytecode
14. Now we will work with the right side of this window. You must see bipush opcode with value 15. In our case this mean that AIR SDK support 15 language codes. We want to add new 4 language records so totally now we must have 19. Press right mouse button bipush 15 and select Edit instruction from context menu
15. Now make double-click on 15 value and input 19 instead. Press Ok, Ok and your bytecode window must reloads automatically.
16. Great! Now we have increased length of array with language strings from 15 to 19
17. After that we must fill new 4 indexes with some String data. Scroll down this window to position as on image and select last aastore opcode from that Array:
18. If you check all opcodes above you can understand what we must to do right now Right! We going to add new opcodes
Press right mouse button on selected aastore opcode and select Add instruction after
Select dup instruction and press Ok. If you want to know what is dup and the rest opcodes – click here. But you don’t required to know this for small things like we doing here
After each time you editing opcodes – wait for bytecode window refresh so each time you must scroll down to your opcode position. Now you can see that dup was added successfully
Now select that dup and press again right mouse button, select Add instruction after and insert bipush with 15 value. Than press Ok, Ok and after window refresh – scroll to this opcode
Now we added second opcode and currently we can see next state
As you can see – we need to add two new opcodes to finish adding 1 language Select bipush 15 > Add instruction after and select ldc_w instruction with String <da> value instead of 1.
Than press Ok, Ok and you will get this as result. Be careful and select String and not Utf8 because our Array is String typed Array.
Now we must store added value into the Array. On just added opcode press again mrb (mouse right button) > select Add instruction after and select aastore opcode. Actually you will receive same as on image:
Using same steps you must add last 3 languages from the list so your new bytecode will be like this:
Since in Java arrays indexes started from 0 – last language index is 18 and not 19.
Just for checkup - we just added this opcodes:
19. Now we must save patched ApplicationDescriptor.class. Go to Classes > Save Class and than close Java Byte editor. When you save the class – there is no any popups. But when you close editor – you will see “Save changes to Untitled” dialog. It’s ok, just press No.
20. Drag back patched ApplicationDescriptor.class to adt.jar at same place where it was located and press Yes when 7zip will ask about archive updating.
P.S. Actually Java Byte it’s Java Bite. But when I downloaded it from it’s authors website long long ago – it’s was called exactly the same as I’m writing here
Part 3: Preparing language localization files
1. Back to adt.jar in 7zip and locate folder com\adobe\air\ipa\
2. Drag out en.lproj folder anywhere you can access it
3. Now you must to create 4 language .lproj folder with our languages using dragged en.lproj as template. You don’t need to translate anything inside that folder. Just leave as is and rename en.lproj to da.lproj, he.lproj, sk.lproj, nb.lproj so you will receive next folders
4. Select this 4 folders and drag they back into opened adt.jar in 7zip. When you dragging new folders – archiver will ask about coping. Press Yes.
Before – After
5. Now you can close your 7zip. We already done!
Part 4: Using new custom languages
1. Create your AIR app as you doing this usually
2. Open *-app.xml decriptor of your AIR application
3. Add to supportedLanguages section new values also don’t forget about name section and save it
Part 5: Device testing
Compile your app and install it on device. If your device language one from the list above – you will see Name of your app the same as you described in name section of *-app.xml. Also in AppStore market you can see now that languages you just added as supported!
Flash Professional CC/2014
Users of IDE also can use this hack. Just must to know that custom languages will not appear in Language tab of AIR for iOS Settings panel but still will works because they described in *-app.xml
Hope this helps