These past few days I have been working on a little mobile app (J2ME / Java ME) that displays the various Catholic prayers and devotions. Simple stuffs like "Pater Noster" all the way to the mysteries of the rosary, and thanksgiving prayers, in multiple languages.
It started out pretty simply, and the complication happened only when I had to 'versionize' the source code and the resources used by different language versions. Some versions should be able to handle multiple-language requests from the user, some display only one language of choice.
Two problems: versioning and internationalization.
Internationalization has always been an interesting topic for most application developers because frankly, few of us bother to provision for Unicode display until the product is almost ready. Then began the scramble to make the application accommodate the havoc wreaked by the different encoding the input came in.
Versioning problems came about because I did not use CVS. Period. Well, there's more to the story than that, but bottomline is, there are existing tools that can track your files' changes.
During the course of this project, I have learned that Ant (which is the build tool I use to compile J2ME applications) is extremely nifty with multiple compilation paths. A little familiarity is required with the Ant build file, and more curiosity, to learn the various types of variable and property that are used to signal different customization and compilation paths.
For example (in J2ME Polish):
The element <sources> can be customized to point to different folders for different versions. So instead of re-naming your public classes, MyMIDlet_v1 or MyMIDlet_v2, you can stick with the same name in different folders.
The element <jarName> can contain references to other variables or properties, to be something like: "prayer-${polish.name}-${polish.locale}-${TwoLangCombi}.jar"
Those variables and properties can combine to indicate which resources folder you would like to use when compiling for a particular locale, or particular screen size, or particular handset brand.
Why am I writing this?
I have suffered greatly because I did not learn to use these 'best practices' in my daily work! I hope anyone of you who happens to read this and understand may benefit from my suffering and this little note ;)
No comments:
Post a Comment