The index.html
file containing JavaScript that makes use of the
Globalization API functionality is listed below.
<!DOCTYPE html> <html manifest="manifest.appcache"> <head> <title>Globalization API usage example</title> <link rel="x-antenna-managed-webapp-descriptor" href="webapp-descriptor.xml" /> <script type="text/javascript"> function printText(str) { var d = document.getElementById('text-box'); d.appendChild(document.createTextNode(str)); d.appendChild(document.createElement('br')); d.scrollTop = d.scrollHeight; } function getLocale() { window.launchbox.Globalization.getLocaleName({ 'onSuccess' : function(locale) { printText('System locale settings: ' + locale); }, 'onFailure' : function(error) { printText('Error: ' + error.description + '!'); } }); } function clearOutput(){ var d = document.getElementById('text-box'); d.innerHTML = ""; } </script> </head> <body> <header> <h3>AMP Hybrid Client <span>Globalization API Usage Example</span> </h3> </header> <input type="button" onclick="getLocale();" value="get locale"/> <input type="button" onclick="clearOutput();" value="clear"/> <div id="text-box"></div> </body> </html>
The contents of the cache manifest file called manifest.appcache
for
this application are listed below:
CACHE MANIFEST #v7 CACHE: index.html NETWORK: *
The webapp-descriptor.xml
file for this application is defined in the
following way:
<?xml version="1.0" encoding="UTF-8"?> <webapp-descriptor xmlns="http://www.pega.com/application-hosting/ web-app-descriptor/2.0"> <id>com.pega.sample.globalization</id> <version>1.0.0</version> <name>Globalization API usage example</name> </webapp-descriptor>