Localization of AIR app

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Localization of AIR app

Erik J. Thomas
Hey all:

I need to localize Info.plist.NSCameraUsageDescription into tr (turkish). I added the translation to an InfoPlist.strings file (according to XCode docs) that is placed into the app's tr.lproj directory when the XCode project is built.

So I added this command line option to ADT to do the same thing:

-e /Users/ethomas/linqto/FlexDev/keiretsu/locale/tr_TR/InfoPlist.strings tr.lproj/InfoPlist.strings

But when I run the ADT command to package the IPA it gives me this error:

"The path tr.lproj/InfoPlist.strings is restricted. Choose another name for this file."

Has anyone successfully localized iOS Info.plist values in an AIR app? Can you share how?

I am sure I can create a script to run after building the IPA that will place the InfoPlist.strings file into tr.lproj and then re sign the IPA, but was hoping I could get this working for local debug builds. Is there some way to configure ADT to move InfoPlist.strings to tr.lproj?

Thanks!

Erik

Reply | Threaded
Open this post in threaded view
|

Re: Localization of AIR app

Erik J. Thomas
I figured this out so wanted to share the solution in case anyone comes across the same challenge.

First, the AIR SDK ADT command line tool used to package and sign IPAs prevents copying a resource into an IPA packages app locale folder, e.g., yourapp.app/en.lproj. This is just wrong, IMO, so I opened a bug on the Adobe bug tracker. Please vote for it since having this feature would make it so much easier to localize Info.plist values in AIR apps.

https://tracker.adobe.com/#/view/AIR-4198769 <https://tracker.adobe.com/#/view/AIR-4198769>

The workaround for this ADT issue is you need to write a script to copy your localized InfoPlist.strings files to their appropriate locale folders after the IPA has been packaged:

1. package the IPA with ADT (or from your IDE that executes ADT)
2. unzip the IPA
3. copy InfoPlist.strings into each locale folder in the app package for which you have a translation
4. codesign and zip the IPA

Also note InfoPlist.strings files are specified in the following format:

"NSLocationWhenInUseUsageDescription" = "Kullanım sırasında konum servislerine izin verin.";
"NSLocationAlwaysUsageDescription" = "Uygulama kullanımda değilken konum hizmetlerine izin ver.";

Cheers,

Erik

Reply | Threaded
Open this post in threaded view
|

Re: Localization of AIR app

Erik J. Thomas
I knew there had to be another way to localize Info.plist entries in an AIR app than my workaround. I just didn't do enough digging in AIR docs and release notes because I didn't know to search for purposeStrings (AIR names things kind of oblique to what they actually do).

Nevertheless, here is the "correct" way to localize Info.plist values explained by the AIR team:

====

"Comment added by Shubhendu Mishra

Starting AIR 28, you can provide localized purpose strings for the permissions required in the application. You are required to package an XML file called purposeStrings.xml in the application. The format of this XML file should adhere to the sample xml file which is available in AIR SDK at SDK/samples/purposeStrings-sample.xml.

purposeStrings-sample.xml needs to be placed parallel to the swf file while packaging, and the created ipa will automatically contain InfoPlist.strings.

Please refer to the [https://helpx.adobe.com/in/flash-player/release-note/fp_28_air_28_release_notes.html] AIR 28 release notes."

====

My other workaround works OK, but this AIR approach should make it easier to do, so I will switch to purposeStrings.xml method when I get the chance.

Erik

Reply | Threaded
Open this post in threaded view
|

Re: Localization of AIR app

Erik J. Thomas
In reply to this post by Erik J. Thomas
OK, so the epic continues. Adobe AIR SDK 28 release notes claim they include a purposeStrings-example.xml file in examples folder that shows the (otherwise undocumented) format of the xml, but the file wasn't there.

An Adobe engineer read this in my bug report and put the sample file into the beta version of AIR SDK 32, so I downloaded that and implemented the new purposeStrings approach.

But my IDE, when specifying additional ADT command line parameters, places the purposeStrings.xml parameter right after the -package parameter, thus breaking the build. I found an IntelliJ-IDEA bug about this:

https://youtrack.jetbrains.com/issue/IDEA-193254 <https://youtrack.jetbrains.com/issue/IDEA-193254>

I now have to wait on JetBrains to add support for purposeStrings to IntelliJ IDEA, or I can package IPAs from a script outside of the IDE.

Adobe really didn't need to invent this purposeStrings approach at all. They could have simply fixed ADT to allow adding -e option to move localized InfoPlist.strings files directly to the IPA locale folders using IDE packaging options UI. But ADT also fails if you attempt to do that. It displays "Error: The path tr.lproj/InfoPlist.strings is restricted. Choose another name for this file." Of course Apple requires the localized files must be named InfoPlist.strings. LOL.

It could have been so simple.

Erik