Home ecommerce Technical Clients   Contact Links News 09 May 2008
 
   
Home  
ecommerce  
Technical  
Clients  
Consultancy  
Partners  
Press pack  
News  
Contact  
Articles  
Links  
Forums  
   
 
User 
Pass 
   
  OTASlang: Over The Air Smart Language loading for java
  How to hotswap an apps entire language text on the fly.
   
        Carl Whalley, 04-Jul-2003
Screenshots  
   
At first only English is available   English menus   Refresh discovers new languages available
     
French was chosen so the language list becomes localised too   Now the menus are in French    
I18n  
Some wit once coined the i18n abbreviation for internationalisation with good reason. In today's global marketplace, any shortcuts to ensuring your products reach the widest audience are very welcome indeed. Take smartphones for example. These beauties can load software after they are shipped - in fact users quickly begin to treat them like their PC and load whatever apps, games or utilities take their fancy. For the developers though there is a problem - what language does your user speak? Traditionally, you'd have to perform separate builds for each one, swapping in the various string resources at build time and hoping you'd got it right in order to avoid a costly re-release. Now, with the advent of smarter java phones like the P800, there are other interesting possibilities in this area.  
With smartphones, you are dealing with a device that can connect to a remote server on demand. This means you can load data, any data, into your app - even data the app uses intrinsically to operate. That's where smart language loaders come in. Described here is such a system, which provides smart language resources on demand over-the-air, hence "OTASlang". Furthermore, because it can do this when any new languages become available or are changed, it's much more future-proof. The system presented here is a freely available demonstratation of the commercial OTASlang service. The app loads all the language resources at once. It doesn't need to connect again unless the user wants to change language or refresh the current one. Smartphone resources, whilst growing nicely with each new model, are still finite. There's no need to hold multiple language sets per app when you can hotswap new ones whenever needed.  
From Server to Client  
OTASlang is implemented in java at both the server and client ends. The client asks the server for the language resources and the server responds with the full set. The client then stores them locally. The application which uses those resources will have been written so that each item displayed is given an ID code and loaded in at runtime. This is no different to the traditional way: all displayable items are abstracted and are never hardcoded in the body of the app. Another advantage to using a smart language loader relates to the fact that only one build is required for all languages. Many applications require signing before they can be deployed and it's only a matter of time before this becomes mandatory. In any event, building 10 separate versions of the app for 10 languages means the developer has to pay for signing 10 times over: a concern for smaller operations.  
PersonalJava  
The version described here is for the Sony Ericsson P800 running PersonalJava. This demonstration is shipped with a small test app to illustrate dynamic menus, dialog boxes etc. When first run, there is only one language available, "English". You can discover which languages the server supports with the "Refresh" button. The app will connect to the server and update this list. You can then choose one of the languages with "Done" and see the changes in the various controls.  
Usage  
The framework requires the installation of the language server on a J2EE server. It's implemented as a few servlets that draw on standard java property files in response to the client requests. This could be developed further via the use of an SQL database, for example. No special protocol is defined between the two, the language key/value pairs are simply sent in the "ID=Value;" format. The client receives a set of these and stores them locally as a properties file, in effect copying the language from the server to its own persistent storage. Java has handled unicode since its inception - the default encoding is UTF-8, so basic character accents shouldn't be a problem. To use the framework in a real app you would abstract all the strings into a properties file, say "ENGLISH.properties", and store this on the server. The client looks for "Language.properties" locally so a copy on the client is needed with this name. New language installation means storing, for example, "FRENCH.properties" on the server alongside the English one and serving it when required. You should install the language server at whatever URL you want and point the entry "LanguageServer= " in the client file "OTASlang.properties" at it. The language server with the test app is running at http://www.java-technical.com/otaslang, however if load gets too heavy this will be reviewed.  
Tips  
  • Plan the language system as early as possible, certainly before any code is written.
  • Consider building a "neutral" language that won't be used in production but acts as the default for development. Including the keys in the displayed values (where possible) can help UI troubleshooting a great deal.
  • To ease layout issues you may want to define a "padding" language. This is where each entry consists purely of padding characters that fill up the fields to their maximum, for example "XxxxxxxxxX". When deployed, it will look a little odd (!!) but will assist greatly with UI field length checking. You could then automate tests for candidate production languages against it.
  • Consolidate languages for several projects in a common database. The client doesn't care how the languages are sourced, but if you can identify common strings across projects you will save time and effort translating them more than once. This is where the "neutral" language can help.
  •  
    Download OTASlang sample application (SIS to run on P800).  
    Documentation OTASlang client.  
    Documentation OTASlang server.  
       

    The net means business

    Never before has it been possible to interact with such a vast market. Your business can extend right to the place you want it the most : your customers.  
    Automated ebusiness is now very much an everyday reality across the globe.

    Mobile Information

    Instant access to realtime data. Make updates from any device and see it change on all connected systems. All views of your data are supplied from one central  
    source. Use timely, accurate information where you need it the most - all secured by industry-standard encryption systems as used by the military and governments.

    Your business is unique

    No-one knows your business better than you. When extending it to the internet your individuality will be preserved. Methodologies exist which enable tried and  
    tested business systems to be implemented modelling perfectly the business rules and logic you are using today.
    Home | ecommerce | Technical | Clients | News | Contact | Consultancy | Partners | Links | Press pack |
    Want your news on this web site? Have an opinion on it? Contact us
    Established 1987. Copyright © 1999-2004 Carmichael Data Systems Ltd. All Rights Reserved. Privacy Statement.