All server queries now send system language
This commit is contained in:
parent
0239ce9f89
commit
6a5fa9b4f8
@ -36,7 +36,7 @@ function askLogout() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function logout() {
|
function logout() {
|
||||||
$.getJSON(mkApiUrl('deletesession'), {}, function (data) {
|
$.getJSON(mkApiUrl('deletesession') + "?lang=" + USER_LANGUAGE, {}, function (data) {
|
||||||
if (data.status === 'OK') {
|
if (data.status === 'OK') {
|
||||||
localStorage.setItem("username", '');
|
localStorage.setItem("username", '');
|
||||||
localStorage.setItem("password", '');
|
localStorage.setItem("password", '');
|
||||||
@ -54,7 +54,8 @@ function logout() {
|
|||||||
var teamchoosercheckretried = false;
|
var teamchoosercheckretried = false;
|
||||||
function checkUserHasTeamOpenChooserIfNot(username) {
|
function checkUserHasTeamOpenChooserIfNot(username) {
|
||||||
$.getJSON(mkApiUrl('getstats'), {
|
$.getJSON(mkApiUrl('getstats'), {
|
||||||
user: username
|
user: username,
|
||||||
|
lang: USER_LANGUAGE
|
||||||
}, function (data) {
|
}, function (data) {
|
||||||
if (data.status === 'OK') {
|
if (data.status === 'OK') {
|
||||||
if (data.stats.teamid && data.stats.teamid > 0) {
|
if (data.stats.teamid && data.stats.teamid > 0) {
|
||||||
@ -118,7 +119,8 @@ function dosignup() {
|
|||||||
user: $('#usernameBox').val(),
|
user: $('#usernameBox').val(),
|
||||||
pass: $('#passwordBox').val(),
|
pass: $('#passwordBox').val(),
|
||||||
name: $('#nameBox').val(),
|
name: $('#nameBox').val(),
|
||||||
email: $('#emailBox').val()
|
email: $('#emailBox').val(),
|
||||||
|
lang: USER_LANGUAGE
|
||||||
},
|
},
|
||||||
function (data) {
|
function (data) {
|
||||||
if (data === 'OK') {
|
if (data === 'OK') {
|
||||||
@ -126,6 +128,7 @@ function dosignup() {
|
|||||||
$.post(mkApiUrl('login'), {
|
$.post(mkApiUrl('login'), {
|
||||||
user: $('#usernameBox').val(),
|
user: $('#usernameBox').val(),
|
||||||
pass: $('#passwordBox').val(),
|
pass: $('#passwordBox').val(),
|
||||||
|
lang: USER_LANGUAGE
|
||||||
}, function (out) {
|
}, function (out) {
|
||||||
if (out.status === 'OK') {
|
if (out.status === 'OK') {
|
||||||
loginOK();
|
loginOK();
|
||||||
@ -175,7 +178,8 @@ function dologin() {
|
|||||||
$.post(mkApiUrl("login"),
|
$.post(mkApiUrl("login"),
|
||||||
{
|
{
|
||||||
user: $('#usernameBox').val(),
|
user: $('#usernameBox').val(),
|
||||||
pass: $('#passwordBox').val()
|
pass: $('#passwordBox').val(),
|
||||||
|
lang: USER_LANGUAGE
|
||||||
},
|
},
|
||||||
function (data) {
|
function (data) {
|
||||||
if (data.status === 'OK') {
|
if (data.status === 'OK') {
|
||||||
|
@ -139,7 +139,7 @@ function loadPlaces(lat, long) {
|
|||||||
if (!lockGot) {
|
if (!lockGot) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var url = mkApiUrl('places', 'gs') + "?lat=" + lat + "&long=" + long + "&radius=.5&names=1";
|
var url = mkApiUrl('places', 'gs') + "?lat=" + lat + "&long=" + long + "&radius=.5&names=1&lang=" + USER_LANGUAGE;
|
||||||
try {
|
try {
|
||||||
$.getJSON(
|
$.getJSON(
|
||||||
url,
|
url,
|
||||||
@ -196,7 +196,7 @@ var updatePosition = function (position) {
|
|||||||
|
|
||||||
function pingServer() {
|
function pingServer() {
|
||||||
if (lockGot && gpsaccuracy < requiredaccuracy) {
|
if (lockGot && gpsaccuracy < requiredaccuracy) {
|
||||||
$.getJSON(mkApiUrl('ping') + "?user=" + username + "&lat=" + latitude + "&long=" + longitude, function (data) {
|
$.getJSON(mkApiUrl('ping') + "?user=" + username + "&lat=" + latitude + "&long=" + longitude + "&lang=" + USER_LANGUAGE, function (data) {
|
||||||
if (data.status == "ERROR" && logoutInProgress != true) {
|
if (data.status == "ERROR" && logoutInProgress != true) {
|
||||||
localStorage.setItem("no_autologin", "true");
|
localStorage.setItem("no_autologin", "true");
|
||||||
username = null;
|
username = null;
|
||||||
|
@ -27,6 +27,8 @@ MUNZEE_CLIENT_ID = '616cecc70e17f4a3cb64146dce2d33f5';
|
|||||||
MUNZEE_REDIRECT = 'http://gs.terranquest.net/munzee.php';
|
MUNZEE_REDIRECT = 'http://gs.terranquest.net/munzee.php';
|
||||||
CODE_SCAN_COOLDOWN_SECONDS = 15; // Also change in CSS (.cooldown-fade-anim)
|
CODE_SCAN_COOLDOWN_SECONDS = 15; // Also change in CSS (.cooldown-fade-anim)
|
||||||
|
|
||||||
|
USER_LANGUAGE = "en-US";
|
||||||
|
|
||||||
currentscreen = "";
|
currentscreen = "";
|
||||||
/*
|
/*
|
||||||
* Runs when the app opens
|
* Runs when the app opens
|
||||||
@ -54,6 +56,16 @@ function onDeviceReady() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
setLocale();
|
||||||
|
}
|
||||||
|
|
||||||
|
function setLocale() {
|
||||||
|
navigator.globalization.getPreferredLanguage(
|
||||||
|
function (language) {
|
||||||
|
USER_LANGUAGE = language.value;
|
||||||
|
},
|
||||||
|
function () {}
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Depending on the device, a few examples are:
|
// Depending on the device, a few examples are:
|
||||||
|
@ -25,7 +25,8 @@ function buycoins(productId) {
|
|||||||
os: 'android',
|
os: 'android',
|
||||||
data: data.receipt,
|
data: data.receipt,
|
||||||
signature: data.signature,
|
signature: data.signature,
|
||||||
id: productId
|
id: productId,
|
||||||
|
lang: USER_LANGUAGE
|
||||||
}, function (result) {
|
}, function (result) {
|
||||||
if (result.status == 'OK') {
|
if (result.status == 'OK') {
|
||||||
return inAppPurchase.consume(data.type, data.receipt, data.signature);
|
return inAppPurchase.consume(data.type, data.receipt, data.signature);
|
||||||
@ -53,7 +54,8 @@ function buycoins(productId) {
|
|||||||
os: 'ios',
|
os: 'ios',
|
||||||
data: data.receipt,
|
data: data.receipt,
|
||||||
signature: data.signature,
|
signature: data.signature,
|
||||||
id: productId
|
id: productId,
|
||||||
|
lang: USER_LANGUAGE
|
||||||
}, function (result) {
|
}, function (result) {
|
||||||
if (result.status == 'OK') {
|
if (result.status == 'OK') {
|
||||||
return inAppPurchase.consume(data.type, data.receipt, data.signature);
|
return inAppPurchase.consume(data.type, data.receipt, data.signature);
|
||||||
@ -81,7 +83,8 @@ function buyitem(id, cost) {
|
|||||||
$('#shopitem-' + id).prop('onclick', null).off('click');
|
$('#shopitem-' + id).prop('onclick', null).off('click');
|
||||||
$.getJSON(mkApiUrl('buyitem', 'gs'), {
|
$.getJSON(mkApiUrl('buyitem', 'gs'), {
|
||||||
merchid: id,
|
merchid: id,
|
||||||
cost: cost
|
cost: cost,
|
||||||
|
lang: USER_LANGUAGE
|
||||||
}, function (data) {
|
}, function (data) {
|
||||||
if (data.status == 'OK') {
|
if (data.status == 'OK') {
|
||||||
showSuccessMessage(data.message);
|
showSuccessMessage(data.message);
|
||||||
@ -142,7 +145,7 @@ function setcoinhtmlfromiap(coinsjson) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function loadstorefront() {
|
function loadstorefront() {
|
||||||
$.getJSON(mkApiUrl('shopitems'), function (data) {
|
$.getJSON(mkApiUrl('shopitems') + "?lang=" + USER_LANGUAGE, function (data) {
|
||||||
var content = "";
|
var content = "";
|
||||||
if (data.status == 'OK') {
|
if (data.status == 'OK') {
|
||||||
var items = data.items;
|
var items = data.items;
|
||||||
@ -163,7 +166,7 @@ function loadstorefront() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function refreshcoins() {
|
function refreshcoins() {
|
||||||
$.getJSON(mkApiUrl('shopitems'), function (data) {
|
$.getJSON(mkApiUrl('shopitems') + "?lang=" + USER_LANGUAGE, function (data) {
|
||||||
if (data.status == 'OK') {
|
if (data.status == 'OK') {
|
||||||
$('#coinbalance').text(data.balance);
|
$('#coinbalance').text(data.balance);
|
||||||
}
|
}
|
||||||
|
@ -33,7 +33,8 @@ var terrainName = "Other";
|
|||||||
*/
|
*/
|
||||||
function syncStats() {
|
function syncStats() {
|
||||||
$.getJSON(mkApiUrl('getstats'), {
|
$.getJSON(mkApiUrl('getstats'), {
|
||||||
user: username
|
user: username,
|
||||||
|
lang: USER_LANGUAGE
|
||||||
}, function (data) {
|
}, function (data) {
|
||||||
if (data.status === 'OK') {
|
if (data.status === 'OK') {
|
||||||
maxenergy = data.stats.maxenergy;
|
maxenergy = data.stats.maxenergy;
|
||||||
@ -57,7 +58,8 @@ function getChat() {
|
|||||||
$.getJSON(mkApiUrl('chat', 'cs'), {
|
$.getJSON(mkApiUrl('chat', 'cs'), {
|
||||||
lat: latitude,
|
lat: latitude,
|
||||||
long: longitude,
|
long: longitude,
|
||||||
name: username
|
name: username,
|
||||||
|
lang: USER_LANGUAGE
|
||||||
}, function (data) {
|
}, function (data) {
|
||||||
data = sortResults(data, 'time', true);
|
data = sortResults(data, 'time', true);
|
||||||
var content = "";
|
var content = "";
|
||||||
@ -79,7 +81,7 @@ function getChat() {
|
|||||||
|
|
||||||
function privMsgSync() {
|
function privMsgSync() {
|
||||||
$.getJSON(
|
$.getJSON(
|
||||||
mkApiUrl('privmsgs') + "?filter=unread",
|
mkApiUrl('privmsgs') + "?filter=unread&lang=" + USER_LANGUAGE,
|
||||||
function (data) {
|
function (data) {
|
||||||
if (data.status === 'OK') {
|
if (data.status === 'OK') {
|
||||||
if (data.msgs.length > 0) {
|
if (data.msgs.length > 0) {
|
||||||
@ -98,7 +100,8 @@ skycons.add("weathericon", "clear-day");
|
|||||||
function getWeather() {
|
function getWeather() {
|
||||||
$.getJSON(mkApiUrl('getweather'), {
|
$.getJSON(mkApiUrl('getweather'), {
|
||||||
lat: latitude,
|
lat: latitude,
|
||||||
long: longitude
|
long: longitude,
|
||||||
|
lang: USER_LANGUAGE
|
||||||
}, function (data) {
|
}, function (data) {
|
||||||
var currently = data.currently;
|
var currently = data.currently;
|
||||||
rawWeatherData = currently;
|
rawWeatherData = currently;
|
||||||
@ -110,7 +113,8 @@ function getWeather() {
|
|||||||
function getTerrain() {
|
function getTerrain() {
|
||||||
$.getJSON(mkApiUrl('getterrain'), {
|
$.getJSON(mkApiUrl('getterrain'), {
|
||||||
lat: latitude,
|
lat: latitude,
|
||||||
long: longitude
|
long: longitude,
|
||||||
|
lang: USER_LANGUAGE
|
||||||
}, function (data) {
|
}, function (data) {
|
||||||
var terrainid = -1;
|
var terrainid = -1;
|
||||||
var terrainstr = "Other";
|
var terrainstr = "Other";
|
||||||
@ -159,7 +163,8 @@ $("#chatsendform").submit(function (event) {
|
|||||||
lat: latitude,
|
lat: latitude,
|
||||||
long: longitude,
|
long: longitude,
|
||||||
msg: message,
|
msg: message,
|
||||||
name: username
|
name: username,
|
||||||
|
lang: USER_LANGUAGE
|
||||||
}, function (data) {
|
}, function (data) {
|
||||||
if (data.status === 'OK') {
|
if (data.status === 'OK') {
|
||||||
$('#chatbox-input').val("");
|
$('#chatbox-input').val("");
|
||||||
|
@ -50,7 +50,8 @@
|
|||||||
//alert($('input[name=teamChooser]:checked').val());
|
//alert($('input[name=teamChooser]:checked').val());
|
||||||
var team = $('input[name=teamChooser]:checked').val();
|
var team = $('input[name=teamChooser]:checked').val();
|
||||||
$.getJSON(mkApiUrl('setteam', 'gs'), {
|
$.getJSON(mkApiUrl('setteam', 'gs'), {
|
||||||
teamid: team
|
teamid: team,
|
||||||
|
lang: USER_LANGUAGE
|
||||||
}, function (data) {
|
}, function (data) {
|
||||||
if (data.status === 'OK') {
|
if (data.status === 'OK') {
|
||||||
// We're all good.
|
// We're all good.
|
||||||
|
@ -169,7 +169,8 @@
|
|||||||
os: 'android',
|
os: 'android',
|
||||||
data: prod.receipt,
|
data: prod.receipt,
|
||||||
signature: prod.signature,
|
signature: prod.signature,
|
||||||
id: prod.productId
|
id: prod.productId,
|
||||||
|
lang: USER_LANGUAGE
|
||||||
}, function (result) {
|
}, function (result) {
|
||||||
if (result.status == 'OK') {
|
if (result.status == 'OK') {
|
||||||
inAppPurchase.consume(prod.type, prod.receipt, prod.signature);
|
inAppPurchase.consume(prod.type, prod.receipt, prod.signature);
|
||||||
|
@ -46,7 +46,8 @@
|
|||||||
// Load the list of nearby players
|
// Load the list of nearby players
|
||||||
$.getJSON(mkApiUrl('nearby'), {
|
$.getJSON(mkApiUrl('nearby'), {
|
||||||
lat: latitude,
|
lat: latitude,
|
||||||
long: longitude
|
long: longitude,
|
||||||
|
lang: USER_LANGUAGE
|
||||||
}, function (data) {
|
}, function (data) {
|
||||||
var content = "";
|
var content = "";
|
||||||
if (data.status === 'OK') {
|
if (data.status === 'OK') {
|
||||||
@ -75,7 +76,8 @@
|
|||||||
}
|
}
|
||||||
$.getJSON(mkApiUrl('giveitem', 'gs'), {
|
$.getJSON(mkApiUrl('giveitem', 'gs'), {
|
||||||
giveto: playername,
|
giveto: playername,
|
||||||
itemuuid: uuid
|
itemuuid: uuid,
|
||||||
|
lang: USER_LANGUAGE
|
||||||
}, function (data) {
|
}, function (data) {
|
||||||
if (data.status === 'OK') {
|
if (data.status === 'OK') {
|
||||||
loadinventory();
|
loadinventory();
|
||||||
@ -92,7 +94,8 @@
|
|||||||
function useitem(uuid) {
|
function useitem(uuid) {
|
||||||
$('#invitem-' + uuid).prop('onclick', null).off('click');
|
$('#invitem-' + uuid).prop('onclick', null).off('click');
|
||||||
$.getJSON(mkApiUrl('useitem', 'gs'), {
|
$.getJSON(mkApiUrl('useitem', 'gs'), {
|
||||||
itemuuid: uuid
|
itemuuid: uuid,
|
||||||
|
lang: USER_LANGUAGE
|
||||||
}, function (data) {
|
}, function (data) {
|
||||||
if (data.status === 'OK') {
|
if (data.status === 'OK') {
|
||||||
loadinventory();
|
loadinventory();
|
||||||
@ -132,7 +135,8 @@
|
|||||||
|
|
||||||
function loadinventory() {
|
function loadinventory() {
|
||||||
$.getJSON(mkApiUrl('inventory'), {
|
$.getJSON(mkApiUrl('inventory'), {
|
||||||
user: username
|
user: username,
|
||||||
|
lang: USER_LANGUAGE
|
||||||
}, function (data) {
|
}, function (data) {
|
||||||
var content = "";
|
var content = "";
|
||||||
if (data.status == 'OK') {
|
if (data.status == 'OK') {
|
||||||
|
@ -36,7 +36,8 @@
|
|||||||
function loadnearby() {
|
function loadnearby() {
|
||||||
$.getJSON(mkApiUrl('nearby'), {
|
$.getJSON(mkApiUrl('nearby'), {
|
||||||
lat: latitude,
|
lat: latitude,
|
||||||
long: longitude
|
long: longitude,
|
||||||
|
lang: USER_LANGUAGE
|
||||||
}, function (data) {
|
}, function (data) {
|
||||||
var content = "";
|
var content = "";
|
||||||
if (data.status === 'OK') {
|
if (data.status === 'OK') {
|
||||||
|
@ -87,7 +87,8 @@
|
|||||||
function resync(firstload) {
|
function resync(firstload) {
|
||||||
$('#place-refresh').addClass('fa-spin');
|
$('#place-refresh').addClass('fa-spin');
|
||||||
$.getJSON(mkApiUrl('getstats', 'gs'), {
|
$.getJSON(mkApiUrl('getstats', 'gs'), {
|
||||||
user: username
|
user: username,
|
||||||
|
lang: USER_LANGUAGE
|
||||||
}, function (data) {
|
}, function (data) {
|
||||||
if (data.status === 'OK') {
|
if (data.status === 'OK') {
|
||||||
maxenergy = data.stats.maxenergy;
|
maxenergy = data.stats.maxenergy;
|
||||||
@ -99,7 +100,8 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
$.getJSON(mkApiUrl('placestats', 'gs'), {
|
$.getJSON(mkApiUrl('placestats', 'gs'), {
|
||||||
locationid: thisplace.properties.gameinfo.locationid
|
locationid: thisplace.properties.gameinfo.locationid,
|
||||||
|
lang: USER_LANGUAGE
|
||||||
}, function (data) {
|
}, function (data) {
|
||||||
if (data.status === 'OK') {
|
if (data.status === 'OK') {
|
||||||
placeteam = data.stats.teamid;
|
placeteam = data.stats.teamid;
|
||||||
@ -167,7 +169,8 @@
|
|||||||
$.getJSON(mkApiUrl('attackplace', 'gs'), {
|
$.getJSON(mkApiUrl('attackplace', 'gs'), {
|
||||||
locationid: thisplace.properties.gameinfo.locationid,
|
locationid: thisplace.properties.gameinfo.locationid,
|
||||||
lat: latitude,
|
lat: latitude,
|
||||||
long: longitude
|
long: longitude,
|
||||||
|
lang: USER_LANGUAGE
|
||||||
}, function (data) {
|
}, function (data) {
|
||||||
if (data.status === 'OK') {
|
if (data.status === 'OK') {
|
||||||
$('#capturebtn').text(data.message);
|
$('#capturebtn').text(data.message);
|
||||||
@ -205,7 +208,8 @@
|
|||||||
$.getJSON(mkApiUrl('refillplace', 'gs'), {
|
$.getJSON(mkApiUrl('refillplace', 'gs'), {
|
||||||
locationid: thisplace.properties.gameinfo.locationid,
|
locationid: thisplace.properties.gameinfo.locationid,
|
||||||
lat: latitude,
|
lat: latitude,
|
||||||
long: longitude
|
long: longitude,
|
||||||
|
lang: USER_LANGUAGE
|
||||||
}, function (data) {
|
}, function (data) {
|
||||||
if (data.status === 'OK') {
|
if (data.status === 'OK') {
|
||||||
$('#refillbtn').text(data.message);
|
$('#refillbtn').text(data.message);
|
||||||
@ -241,7 +245,8 @@
|
|||||||
$.getJSON(mkApiUrl('claimplace', 'gs'), {
|
$.getJSON(mkApiUrl('claimplace', 'gs'), {
|
||||||
locationid: thisplace.properties.gameinfo.locationid,
|
locationid: thisplace.properties.gameinfo.locationid,
|
||||||
lat: latitude,
|
lat: latitude,
|
||||||
long: longitude
|
long: longitude,
|
||||||
|
lang: USER_LANGUAGE
|
||||||
}, function (data) {
|
}, function (data) {
|
||||||
if (data.status === 'OK') {
|
if (data.status === 'OK') {
|
||||||
$('#capturebtn').text(data.message);
|
$('#capturebtn').text(data.message);
|
||||||
|
@ -72,7 +72,8 @@
|
|||||||
if (message !== '') {
|
if (message !== '') {
|
||||||
$.post(mkApiUrl('privmsgs'), {
|
$.post(mkApiUrl('privmsgs'), {
|
||||||
msg: message,
|
msg: message,
|
||||||
to: toplayer
|
to: toplayer,
|
||||||
|
lang: USER_LANGUAGE
|
||||||
}, function (data) {
|
}, function (data) {
|
||||||
if (data.status === 'OK') {
|
if (data.status === 'OK') {
|
||||||
$('#privmsgbox').val("");
|
$('#privmsgbox').val("");
|
||||||
@ -89,7 +90,8 @@
|
|||||||
|
|
||||||
function loadPlayerStats(user) {
|
function loadPlayerStats(user) {
|
||||||
$.getJSON(mkApiUrl('getstats'), {
|
$.getJSON(mkApiUrl('getstats'), {
|
||||||
user: user
|
user: user,
|
||||||
|
lang: USER_LANGUAGE
|
||||||
}, function (data) {
|
}, function (data) {
|
||||||
if (data.status === 'OK' && data.stats != null) {
|
if (data.status === 'OK' && data.stats != null) {
|
||||||
if (data.stats.level != null) {
|
if (data.stats.level != null) {
|
||||||
@ -121,7 +123,7 @@
|
|||||||
$('#loading-badges').html('<i class="fa fa-spinner fa-pulse"></i> Loading...');
|
$('#loading-badges').html('<i class="fa fa-spinner fa-pulse"></i> Loading...');
|
||||||
$('#loading-badges').css('display', 'block');
|
$('#loading-badges').css('display', 'block');
|
||||||
$.getJSON(
|
$.getJSON(
|
||||||
mkApiUrl('getbadges') + '?user=' + user,
|
mkApiUrl('getbadges') + '?user=' + user + "&lang=" + USER_LANGUAGE,
|
||||||
function (data) {
|
function (data) {
|
||||||
if (data.status === 'OK') {
|
if (data.status === 'OK') {
|
||||||
data.badges.forEach(function (item) {
|
data.badges.forEach(function (item) {
|
||||||
@ -149,7 +151,7 @@
|
|||||||
$('#privmsg-box').css('display', 'block');
|
$('#privmsg-box').css('display', 'block');
|
||||||
$('#privmsgs').css('display', 'block');
|
$('#privmsgs').css('display', 'block');
|
||||||
$.getJSON(
|
$.getJSON(
|
||||||
mkApiUrl('privmsgs'),
|
mkApiUrl('privmsgs') + "?lang=" + USER_LANGUAGE,
|
||||||
function (data) {
|
function (data) {
|
||||||
if (data.status === 'OK') {
|
if (data.status === 'OK') {
|
||||||
$('#privmsgs').html("");
|
$('#privmsgs').html("");
|
||||||
|
Reference in New Issue
Block a user