Skip to content

Instantly share code, notes, and snippets.

@mike623
Last active December 14, 2015 10:46
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save mike623/9bcfbb2c8eb7aec940b6 to your computer and use it in GitHub Desktop.
lib.js for cordova-plugin-globalization@1.0.2
var currConveter = {
"ZH-HK": {
A: "HKD 8"
},
"ZH-TW": {
A: "TWD 30"
}
}
if (Meteor.isClient) {
document.addEventListener("deviceready", onDeviceReady, false);
function onDeviceReady() {
console.log(navigator.globalization);
// do what u do
navigator.globalization.getPreferredLanguage(
function(language) {
alert('language: ' + language.value + '\n');
Meteor.currency = language.value;
if (!_.has(currConveter, Meteor.currency))
Meteor.currency == "ZH-HK";
},
function() {
alert('Error getting language\n');
}
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment