A New Strategy of Language Pack Management for Wireless Apps
By Huang Chang & Tong Chun Jie2005-04-18
LPInvoker Bundle
Listing 3. The start method of LPInvoker Bundle
public void start(BundleContext context) throws Exception {
System.out.println("starting invoker...");
this.bc = context;
//Get LPProxyService from the run time
ServiceReference ref =
context.getServiceReference(LPProxyService.class.getName());
proxy = (LPProxyService)context.getService(ref);
//Initialize the LocaleData bundle by specifying the baseName and locale.
proxy.setBaseName("LP");
proxy.setLocale(new Locale("en", "US"));
//proxy.setLocale(new Locale("zh", "CN"));
//Invoke proxy.getString method to read from the localization package.
System.out.println("from invoker: "+proxy.getString("Hi") + ", ");
System.out.println(getBundleName());
}Finally, we submit all these bundles to the Service Management Framework bundle server and elect to install the LPInvoker bundle. In the Service Management Framework run time console, we should see the output when the bundle starts and stops, as shown in Figure 4. We can try again by switching the locale to zh_CN in the start method, and the output changes accordingly, as shown in Figure 5.
Figure 4. The output from the console with locale en_US
Figure 5. The output from the console with locale zh_CN
First published by IBM DeveloperWorks
|
|||||||||
You might also want to check these out:
|
Leave a Comment on "A New Strategy of Language Pack Management for Wireless Apps"
You must be logged in to post a comment.
Link to This Tutorial Page!

