Commit 1525c6d1 authored by Sietse Ringers's avatar Sietse Ringers

Translating javascript strings

parent 09713025
var conf, strings, server;
function getSetupFromJson() {
console.log("Running getSetupFromJson");
$.getJSON("conf.json", function(json) {
conf = json;
console.log("Configuration:", conf);
$.getJSON("languages/" + conf.language + ".json", function(text) {
strings = text;
console.log("Loaded language strings");
});
});
}
function showError(message) {
$("#alert_box").html("<div class=\"alert alert-danger\" role=\"alert\">"
......@@ -14,4 +29,6 @@ var showSuccess = function(msg) {
+ msg + "</div>");
};
$(function() {
getSetupFromJson();
})
$(function() {
var translTable = {
"zipcode": "Postcode",
"address": "Adres",
"city": "Stad",
"initials": "Initialen",
"familyname": "Achternaam",
"gender": "Geslacht",
"dateofbirth": "Geboortedatum",
"country": "Land",
"telephone": "Telefoonnummer",
"email": "E-mailadres",
"over12": "Over 12",
"over16": "Over 16",
"over18": "Over 18",
"over21": "Over 21",
"over65": "Over 65"
};
var doneURL = "done.html";
function addTableLine(table, head, data){
......@@ -31,15 +13,15 @@ $(function() {
}
function displayAttributes (creds, translator) {
function displayAttributes (creds) {
$.each(creds, function(i, cred) {
if (cred.credential === "pbdf.pbdf.idin"){
$.each(cred.attributes, function(key, value) {
addTableLine($('#idinTable'),translator.hasOwnProperty(key) ? translator[key] : key, value);
addTableLine($('#idinTable'), strings.hasOwnProperty("attribute_" + key) ? strings["attribute_" + key] : key, value);
});
} else {
$.each(cred.attributes, function(key, value) {
addTableLine($('#ageTable'),translator.hasOwnProperty(key) ? translator[key] : key, value);
addTableLine($('#ageTable'), strings.hasOwnProperty("attribute_" + key) ? strings["attribute_" + key] : key, value);
});
}
});
......@@ -68,6 +50,6 @@ $(function() {
//decode the issuing JWT and show the values in a table
var decoded = jwt_decode(Cookies.get("jwt"));
displayAttributes(decoded.iprequest.request.credentials, translTable)
displayAttributes(decoded.iprequest.request.credentials)
});
$(function() {
var success_fun = function(data) {
$("#result_status").html("Succes!");
$("#result_header").html("Resultaat");
$("#result_status").html(strings.verify_success);
$("#result_header").html(strings.verify_result);
var bd = jwt_decode(data).attributes["pbdf.pbdf.idin.dateofbirth"];
$("#token-content").html("<b>Uw geboortedatum is:</b> " + bd);
//TODO: check voor verjaardag
$("#token-content").html("<b>" + strings.verify_birthdate + "</b> " + bd);
//TODO: check for birthdate
}
var cancel_fun = function(data) {
$("#result_header").html("Resultaat");
$("#result_status").html("Geannuleerd!");
$("#result_header").html(strings.verify_result);
$("#result_status").html(strings.verify_cancelled);
}
var error_fun = function(data) {
console.log("De verificatie is niet gelukt!");
console.log("Verification failed!");
console.log("Error data:", data);
$("#result_header").html("Resultaat");
$("#result_status").html("Mislukt!");
$("#result_header").html(strings.verify_result);
$("#result_status").html(strings.verify_failed);
}
$("#verify_idin_bd_btn").on("click", function() {
......@@ -35,4 +35,4 @@ $(function() {
IRMA.verify(jwt, success_fun, error_fun);
});
});
\ No newline at end of file
});
......@@ -20,5 +20,27 @@
"done_text2": "U kunt ze nu gebruiken op iedere website die deze attributen accepteert.",
"done_text3": "Door op de knop hieronder te klikken kunt u dit testen; u toont dan uw geboortedatum-attribuut.",
"done_show_button": "Toon geboortedatum-attribuut",
"done_return": "Keer terug naar de attribuut-uitgifte pagina"
"done_return": "Keer terug naar de attribuut-uitgifte pagina",
"attribute_zipcode": "Postcode",
"attribute_address": "Adres",
"attribute_city": "Stad",
"attribute_initials": "Initialen",
"attribute_familyname": "Achternaam",
"attribute_gender": "Geslacht",
"attribute_dateofbirth": "Geboortedatum",
"attribute_country": "Land",
"attribute_telephone": "Telefoonnummer",
"attribute_email": "E-mailadres",
"attribute_over12": "Over 12",
"attribute_over16": "Over 16",
"attribute_over18": "Over 18",
"attribute_over21": "Over 21",
"attribute_over65": "Over 65",
"verify_success": "Succes!",
"verify_result": "Resultaat",
"verify_birthdate": "Uw geboortedatum is:",
"verify_cancelled": "Geannuleerd!",
"verify_failed": "Mislukt!"
}
......@@ -20,5 +20,27 @@
"done_text2": "U kunt ze nu gebruiken op iedere website die deze attributen accepteert.",
"done_text3": "Door op de knop hieronder te klikken kunt u dit testen; u toont dan uw geboortedatum-attribuut.",
"done_show_button": "Toon geboortedatum-attribuut",
"done_return": "Keer terug naar de attribuut-uitgifte pagina"
"done_return": "Keer terug naar de attribuut-uitgifte pagina",
"attribute_zipcode": "Postcode",
"attribute_address": "Adres",
"attribute_city": "Stad",
"attribute_initials": "Initialen",
"attribute_familyname": "Achternaam",
"attribute_gender": "Geslacht",
"attribute_dateofbirth": "Geboortedatum",
"attribute_country": "Land",
"attribute_telephone": "Telefoonnummer",
"attribute_email": "E-mailadres",
"attribute_over12": "Over 12",
"attribute_over16": "Over 16",
"attribute_over18": "Over 18",
"attribute_over21": "Over 21",
"attribute_over65": "Over 65",
"verify_success": "Succes!",
"verify_result": "Resultaat",
"verify_birthdate": "Uw geboortedatum is:",
"verify_cancelled": "Geannuleerd!",
"verify_failed": "Mislukt!"
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment