Add primitive check for file encoding when a file is uploaded and warn

if it's not UTF-8

Close #8
This commit is contained in:
Joshua Ramon Enslin 2022-11-28 14:27:46 +01:00
parent f5ea1f850a
commit 20810aa850
Signed by: jrenslin
GPG Key ID: 46016F84501B70AE
9 changed files with 32 additions and 15 deletions

@ -1 +1 @@
Subproject commit 9ef4465d0d13365657430f099d9a4f213604de79
Subproject commit a4a3733f9a5dcfab2def7bace7fe4517eb00df86

@ -1 +1 @@
Subproject commit f4dbfcc5bf910c360ac7414ecb9d308bbc8abdc1
Subproject commit 4663b4a5f77f4b417cc93b923f1304d354317203

View File

@ -553,7 +553,8 @@ class CsvxmlPage {
uploadFileForValidation(file) {
const reader = new FileReader();
reader.readAsText(file);
let utf8 = true;
reader.readAsText(file, utf8 ? 'UTF-8' : 'CP1251');
let app = this;
@ -563,6 +564,13 @@ class CsvxmlPage {
function handleValidation() {
(async function() {
const result = reader.result;
if (utf8 && result.includes('<27>')) {
window.alert('The file encoding appears to not be UTF-8!\n\nTry exporting the file using the format "CSV (UTF-8)" if you use MS Excel or set the encoding to UTF-8 when exporting through LibreOffice!');
}
})();
// On loading success, check if the upload is valid JSON
console.log("Read file");
// Validate the file

View File

@ -8,10 +8,12 @@ console.log(this.toValidate);let lineCounter=1;for(let line of this.toValidate){
lineCounter++;}}
checkDuplicateInvNos(){let invNoEncountered=[];let lineCounter=1;for(let line of this.toValidate){if(invNoEncountered.includes(line.inventory_number)){this.errors.duplicateInvNos.push("Duplicate inventory number "+line.inventory_number+" on line "+lineCounter);}
invNoEncountered.push(line.inventory_number);lineCounter++;}}
checkDependentColumns(){const headers=Object.keys(this.toValidate[0]);for(let header of headers){if(this.fieldList[header]===undefined||this.fieldList[header].dependsOn===undefined||this.fieldList[header].dependsOn===null)continue;let dependencies=this.fieldList[header].dependsOn;for(let dep of dependencies){if(headers.includes(dep)===false){this.errors.dependentColumns.push("Dependency issue at column "+header+": Corresponding column "+dep+" is missing");}}}}
checkDependentColumns(){const headers=Object.keys(this.toValidate[0]);for(let header of headers){if(this.fieldList[header]===undefined||this.fieldList[header].dependsOn===undefined||this.fieldList[header].dependsOn===null)continue;let dependencies=this.fieldList[header].dependsOn;for(let dep of dependencies){if(headers.includes(dep)===false){this.errors.dependentColumns.push("Dependency issue at column "+header+": Corresponding column "+dep+" is missing");}}}
let lineCounter=1;for(let line of this.toValidate){for(let fieldName in line){if(line[fieldName]==='')continue;const dependencies=this.fieldList[fieldName].dependsOn;if(dependencies===undefined)continue;for(let dependency of dependencies){if(line[dependency]===''){this.errors.dependentColumns.push("Dependency issue at column "+fieldName+": Corresponding column "+dependency+" is empty");}}}
lineCounter++;}}
checkControlledLists(){let lineCounter=1;for(let line of this.toValidate){for(let fieldName in line){if(this.fieldList[fieldName]===undefined){console.log("Undefined but requested field "+fieldName);continue;}
let allowedValues=this.fieldList[fieldName].allowedValues;if(allowedValues===undefined||allowedValues===null)continue;if(Object.values(allowedValues).length===0||Object.values(allowedValues).includes(line[fieldName])){continue;}
this.errors.controlledLists.push("Disallowed value used for column "+fieldName+" at line "+lineCounter+" (Allowed values are: "+Object.values(allowedValues).join(", ")+"; current value is "+line[fieldName]+")");}
const allowedValues=this.fieldList[fieldName].allowedValues;if(allowedValues===undefined||allowedValues===null)continue;if(Object.values(allowedValues).length===0||Object.values(allowedValues).includes(line[fieldName])){continue;}
if(line[fieldName]==='')continue;this.errors.controlledLists.push("Disallowed value used for column "+fieldName+" at line "+lineCounter+" (Allowed values are: "+Object.values(allowedValues).join(", ")+"; current value is "+line[fieldName]+")");}
lineCounter++;}}
checkMainImageResource(){}
isValid(){for(let errorClass in this.errors){if(this.errors[errorClass].length!==0)return false;}
@ -34,7 +36,8 @@ static closeDialogueByEscape(e){if(e.keyCode===27){CsvxmlDialogue.closeDialogue(
static drawDialogue(contents){let dialogueArea=document.createElement("div");dialogueArea.id="dialogueArea";let dialogue=document.createElement("div");dialogue.id="dialogue";dialogue.appendChild(contents);dialogueArea.appendChild(dialogue);document.body.appendChild(dialogueArea);document.addEventListener('keydown',CsvxmlDialogue.closeDialogueByEscape);return dialogue;}}
class CsvxmlPage{fieldList;fieldListFlat;tls;domHelpWrapper;domUploaderWrapper;domMainWrapper;selectedFields;csvBySelectionButton;unsetSelectionButton;constructor(fieldList,tls){this.fieldList=Object.freeze(fieldList);let list={};for(let sectionName in fieldList){list=Object.assign(list,fieldList[sectionName]);}
this.fieldListFlat=Object.freeze(list);this.tls=Object.freeze(tls);let domHelpWrapper=document.createElement("div");domHelpWrapper.id="helpSection";this.domHelpWrapper=domHelpWrapper;let domUploaderWrapper=document.createElement("div");domUploaderWrapper.id="uploader";domUploaderWrapper.classList.add("uploader");this.domUploaderWrapper=domUploaderWrapper;let domMainWrapper=document.createElement("main");this.domMainWrapper=domMainWrapper;this.selectedFields=[];}
generateCsv(selectedFields=[]){let line1=[];let line2=[];let line3=[];for(let fieldName in this.fieldListFlat){console.log(fieldName);console.log(selectedFields);if(selectedFields.length!==0&&selectedFields.includes(fieldName)===false)continue;const field=this.fieldListFlat[fieldName];line1.push(fieldName);line2.push(field.name_human_readable);if(field.allowedValues!==undefined){let values=[];for(let key in field.allowedValues)values.push(field.allowedValues[key]);line3.push(values.join(","));}
generateCsv(selectedFields=[]){let line1=[];let line2=[];let line3=[];for(let fieldName in this.fieldListFlat){console.log(fieldName);console.log(selectedFields);if(selectedFields.length!==0&&selectedFields.includes(fieldName)===false)continue;const field=this.fieldListFlat[fieldName];line1.push(fieldName);line2.push(field.name_human_readable);if(field.allowedValues!==undefined){let values=[];for(let key in field.allowedValues){values.push(field.allowedValues[key]);}
line3.push(values.join(","));}
else line3.push("");}
const csvLine1='"'+line1.join('";"')+'"';const csvLine2='"'+line2.join('";"')+'"';const csvLine3='"'+line3.join('";"')+'"';const toStore=csvLine1+"\n"+csvLine2+"\n"+csvLine3;const triggerLink=document.createElement('a');triggerLink.setAttribute('href','data:text/plain;charset=utf-8,'+encodeURIComponent(toStore));triggerLink.setAttribute('download',"csvxml_museum-digital_template.csv");triggerLink.style.display='none';document.body.appendChild(triggerLink);triggerLink.click();document.body.removeChild(triggerLink);}
zipUploadToXml(validator){function runZipping(){let zip=new JSZip();let xmlFiles=validator.generateXml();const serializer=new XMLSerializer();let lineCounter=0;for(let xml of xmlFiles){zip.file(lineCounter+".xml",serializer.serializeToString(xml));lineCounter++;}
@ -45,7 +48,7 @@ generateDialogueCloseButton(){const cancelB=document.createElement("a");cancelB.
listValidationErrors(validator){console.log("Listing validation errors");const dialogueContent=document.createElement("div");const headline=document.createElement("h3");headline.textContent=this.tls.validation_errors;headline.appendChild(this.generateDialogueCloseButton());dialogueContent.appendChild(headline);const domErrorsSection=document.createElement("div");for(let errorType in validator.errors){if(validator.errors[errorType].length===0)continue;const ulHl=document.createElement("h4");ulHl.textContent=this.tls['errors_'+errorType]+" ("+validator.errors[errorType].length+")";ulHl.style.cursor="pointer";domErrorsSection.appendChild(ulHl);const ul=document.createElement("ul");for(let error of validator.errors[errorType]){const li=document.createElement("li");li.textContent=error;ul.appendChild(li);}
ulHl.addEventListener('click',function(){ul.classList.toggle("minimized");});domErrorsSection.appendChild(ul);}
dialogueContent.appendChild(domErrorsSection);const domDlSection=document.createElement("div");const domDlA=document.createElement("span");domDlA.textContent=this.tls.download;domDlA.classList.add("buttonLike");let app=this;domDlA.addEventListener('click',function(){app.zipUploadToXml(validator);});domDlSection.appendChild(domDlA);dialogueContent.appendChild(domDlSection);dialogue=CsvxmlDialogue.drawDialogue(dialogueContent);}
uploadFileForValidation(file){const reader=new FileReader();reader.readAsText(file);let app=this;document.body.classList.add("loading");reader.onload=function(){function handleValidation(){console.log("Read file");let validator=new CsvxmlValidator(app.fieldListFlat,reader.result);document.body.classList.remove("loading");if(validator.isValid()===true){alert("Document is valid. Press ok to download.");app.zipUploadToXml(validator);}
uploadFileForValidation(file){const reader=new FileReader();let utf8=true;reader.readAsText(file,utf8?'UTF-8':'CP1251');let app=this;document.body.classList.add("loading");reader.onload=function(){function handleValidation(){(async function(){const result=reader.result;if(utf8&&result.includes('<27>')){window.alert('The file encoding appears to not be UTF-8!\n\nTry exporting the file using the format "CSV (UTF-8)" if you use MS Excel or set the encoding to UTF-8 when exporting through LibreOffice!');}})();console.log("Read file");let validator=new CsvxmlValidator(app.fieldListFlat,reader.result);document.body.classList.remove("loading");if(validator.isValid()===true){alert("Document is valid. Press ok to download.");app.zipUploadToXml(validator);}
else{console.log("Identified invalid upload document");app.listValidationErrors(validator);}}
console.log("Postload papaparse");if(typeof Papa==="undefined"){const loadScript=document.createElement("script");loadScript.setAttribute("src","assets/js/papaparse/papaparse.min.js");loadScript.addEventListener('load',function(){handleValidation();},{passive:true,once:true});document.body.appendChild(loadScript);}
else{handleValidation();}};reader.onerror=function(){alert(reader.error);};}

View File

@ -4,7 +4,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
<link rel="stylesheet" type="text/css" href="assets/css/csvxml.min.css?v000005" />
<link rel="stylesheet" type="text/css" href="assets/css/csvxml.min.css?v000006" />
<link rel="manifest" href="/manifest.json" />
<meta name="theme-color" content="#aa4400" />
@ -27,7 +27,7 @@
</head>
<body class="loading">
<script src="assets/js/csvxmlV2.min.js?v000005" type="text/javascript" async></script>
<script src="assets/js/csvxmlV2.min.js?v000006" type="text/javascript" async></script>
</body>
</html>

View File

@ -1 +1 @@
{"remarks":"Notizen","download":"Download","upload":"Hochladen","select_csv_file_for_upload":"Bitte w\u00e4hlen Sie eine CSV Datei als Basis zum Erstellen von XML Dateien","currently_approved_tags":"Derzeit zum Import verf\u00fcgbare Tags \/ Felder","download_csv_all":"CSV-Vorlage mit allen Feldern runterladen","download_csv_by_selection":"CSV-Vorlage auf Basis der Auswahl herunterladen","select_required_fields":"Pflichtfelder ausw\u00e4hlen","select_all_fields":"Alle Felder ausw\u00e4hlen","unset_selection":"Auswahl entfernen","file_format":"Dateiformat","validation_errors":"Validierungsfehler","errors_parsing":"Parsing-Fehler","errors_mandatoryTags":"Fehlende Pflichtfelder","errors_duplicateInvNos":"Doppelte Inventarnummern","errors_dependentColumns":"Spaltenabh\u00e4ngigkeiten nicht ber\u00fccksichtigt","errors_controlledLists":"Kontrollierte Werte","errors_mainImageResource":"Fehlende Haupt-Bilder oder Ressourcen","allowed_values":"Zugelassene Werte","privacy_policy":"Datenschutzerkl\u00e4rung","contact":"Kontakt","news":"Neuigkeiten","imprint":"Impressum","about":"\u00dcber","help_where_am_i":"What is this page for?","help_where_am_i_content":" CSVXML helps validate import object data for museum-digital following museum-digital's standard import format.","help_what_is_csv":"Was hei\u00dft CSV?","help_what_is_csv_content":"CSV steht f\u00fcr Comma Separated Value. Es handelt sich dabei um ein Dateiformat, mit dem tabellarische Informationen in einer reinen Textdatei ausgedr\u00fcckt werden k\u00f6nnen, und wird auch von den meisten Tabellenkalkulationsprogrammen wie Excel und LibreOffice Calc unterst\u00fctzt. W\u00e4hrend nach der urspr\u00fcnglichen Definition des Standards nur eine ASCii-Kodierung der Daten erlaubt war, zeigte sich im Laufe der Jahre, dass die Benutzung breiterer Kodierungen wie UTF-8 in der Praxis n\u00f6tig ist. Ebenso lassen sich in den meisten Kalkulationsprogrammen Semikola oder andere Trennzeichen statt eines Kommas setzen. CSV ist keinesfalls identisch mit Standard-Excel-Dateien. Jedoch kann jede Excel-Datei \u2013 \u00fcber \u201eSpeichern unter \u2026\u201c als CSV-Datei gespeichert werden.","help_how_to_format_csv":"Wie muss das CSV geformt sein?","help_how_to_format_csv_content":"Damit CSVXML mit einer CSV-Datei umgehen kann und importierbare Daten generieren kann, muss die CSV-Datei in passender Form heraufgeladen werden. Dazu geh\u00f6rt vor allem, dass Semikola als Trennzeichen und doppelte Anf\u00fchrungsstriche als Delimiter ausgew\u00e4hlt sein m\u00fcssen. Die enthaltenen Daten m\u00fcssen in der Kodierung UTF-8 vorliegen, sonst erscheinen z.B. im XML statt Umlauten unerwartete Zeichen. Neuere Excel-Versionen erlauben im Dialog \u201eSpeichern unter\u201c die Auswahl \u201eCSV UTF-8 (durch Trennzeichen getrennt) (*.csv)\u201c. Hier\u00fcber k\u00f6nnen Sie ihre urspr\u00fcngliche Excel-Datei im f\u00fcr CSVXML passenden Format speichern. LibreOffice Calc bietet eine \u00e4quivalente Option."}
{"remarks":"Notizen","download":"Download","upload":"Hochladen","select_csv_file_for_upload":"Bitte w\u00e4hlen Sie eine CSV Datei als Basis zum Erstellen von XML Dateien","currently_approved_tags":"Derzeit zum Import verf\u00fcgbare Tags \/ Felder","download_csv_all":"CSV-Vorlage mit allen Feldern runterladen","download_csv_by_selection":"CSV-Vorlage auf Basis der Auswahl herunterladen","select_required_fields":"Pflichtfelder ausw\u00e4hlen","select_all_fields":"Alle Felder ausw\u00e4hlen","unset_selection":"Auswahl entfernen","file_format":"Dateiformat","validation_errors":"Validierungsfehler","errors_parsing":"Parsing-Fehler","errors_mandatoryTags":"Fehlende Pflichtfelder","errors_duplicateInvNos":"Doppelte Inventarnummern","errors_dependentColumns":"Spaltenabh\u00e4ngigkeiten nicht ber\u00fccksichtigt","errors_controlledLists":"Kontrollierte Werte","errors_mainImageResource":"Fehlende Haupt-Bilder oder Ressourcen","allowed_values":"Zugelassene Werte","privacy_policy":"Datenschutzerkl\u00e4rung","contact":"Kontakt","news":"Neuigkeiten","imprint":"Impressum","about":"\u00dcber","help_where_am_i":"What is this page for?","help_where_am_i_content":" CSVXML helps validate import object data for museum-digital following museum-digital's standard import format.","help_what_is_csv":"Was hei\u00dft CSV?","help_what_is_csv_content":"CSV steht f\u00fcr Comma Separated Value. Es handelt sich dabei um ein Dateiformat, mit dem tabellarische Informationen in einer reinen Textdatei ausgedr\u00fcckt werden k\u00f6nnen, und wird auch von den meisten Tabellenkalkulationsprogrammen wie Excel und LibreOffice Calc unterst\u00fctzt. W\u00e4hrend nach der urspr\u00fcnglichen Definition des Standards nur eine ASCii-Kodierung der Daten erlaubt war, zeigte sich im Laufe der Jahre, dass die Benutzung breiterer Kodierungen wie UTF-8 in der Praxis n\u00f6tig ist. Ebenso lassen sich in den meisten Kalkulationsprogrammen Semikola oder andere Trennzeichen statt eines Kommas setzen. CSV ist keinesfalls identisch mit Standard-Excel-Dateien. Jedoch kann jede Excel-Datei \u2013 \u00fcber \u201eSpeichern unter \u2026\u201c als CSV-Datei gespeichert werden.","help_how_to_format_csv":"Wie muss das CSV geformt sein?","help_how_to_format_csv_content":"Damit CSVXML mit einer CSV-Datei umgehen kann und importierbare Daten generieren kann, muss die CSV-Datei in passender Form heraufgeladen werden. Dazu geh\u00f6rt vor allem, dass Semikola als Trennzeichen und doppelte Anf\u00fchrungsstriche als Delimiter ausgew\u00e4hlt sein m\u00fcssen. Die enthaltenen Daten m\u00fcssen in der Kodierung UTF-8 vorliegen, sonst erscheinen z.B. im XML statt Umlauten unerwartete Zeichen. Neuere Excel-Versionen erlauben im Dialog \u201eSpeichern unter\u201c die Auswahl \u201eCSV UTF-8 (durch Trennzeichen getrennt) (*.csv)\u201c. Hier\u00fcber k\u00f6nnen Sie ihre urspr\u00fcngliche Excel-Datei im f\u00fcr CSVXML passenden Format speichern. LibreOffice Calc bietet eine \u00e4quivalente Option.","file_encoding_is_not_utf8":"Die Datei scheint nicht UTF-8-kodiert zu sein!","non_utf8_file_instruction":"Versuchen Sie die Datei als \"CSV (UTF-8)\" zu speichern, falls sie MS Excel verwenden, oder die Dateikodierung beim Speichern auf \"UTF-8\" einzustellen, falls Sie LibreOffice Calc verwenden."}

View File

@ -1 +1 @@
{"remarks":"Remarks","download":"Download","upload":"Upload","select_csv_file_for_upload":"Please select a CSV file to create XML files","currently_approved_tags":"Currently approved tags (column names) for md:import","download_csv_all":"Download CSV template with all fields","download_csv_by_selection":"Download CSV template based on selection","select_required_fields":"Select required fields","select_all_fields":"Select all fields","unset_selection":"Unset selection","file_format":"File format","validation_errors":"Validation errors","errors_parsing":"Parse errors","errors_mandatoryTags":"Missing mandatory tags","errors_duplicateInvNos":"Duplicate inventory numbers","errors_dependentColumns":"Column dependencies unresolved","errors_controlledLists":"Controlled lists","errors_mainImageResource":"Missing main images or resources","allowed_values":"Allowed values","privacy_policy":"Privacy policy","contact":"Contact","news":"News","imprint":"Imprint","about":"About","help_where_am_i":"What is this page for?","help_where_am_i_content":" CSVXML helps validate import object data for museum-digital following museum-digital's standard import format.","help_what_is_csv":"What is CSV?","help_what_is_csv_content":"CSV is the abbreviation for \u201eComma Separated Value\u201c. It describes a file format for expressing tabular information in plain text files, that is supported by most table calculation programms such as MS Excel and LibreOffice Calc. It is thus a useful choice for quickly generating and sharing semi-structured data that can be further processed by other programms.","help_how_to_format_csv":"How to format CSV files for CSVXML?","help_how_to_format_csv_content":"CSVXML first of all requires CSV file using semicolons as a separator and double quotation marks as a delimiter. For generating actually importable data, it is advisable to save the CSV file in UTF-8 rather than the standard-conformant ASCII. Both current versions of MS Excel and LibreOffice Calc support export options for exporting CSV files using UTF-8 encoding."}
{"remarks":"Remarks","download":"Download","upload":"Upload","select_csv_file_for_upload":"Please select a CSV file to create XML files","currently_approved_tags":"Currently approved tags (column names) for md:import","download_csv_all":"Download CSV template with all fields","download_csv_by_selection":"Download CSV template based on selection","select_required_fields":"Select required fields","select_all_fields":"Select all fields","unset_selection":"Unset selection","file_format":"File format","validation_errors":"Validation errors","errors_parsing":"Parse errors","errors_mandatoryTags":"Missing mandatory tags","errors_duplicateInvNos":"Duplicate inventory numbers","errors_dependentColumns":"Column dependencies unresolved","errors_controlledLists":"Controlled lists","errors_mainImageResource":"Missing main images or resources","allowed_values":"Allowed values","privacy_policy":"Privacy policy","contact":"Contact","news":"News","imprint":"Imprint","about":"About","help_where_am_i":"What is this page for?","help_where_am_i_content":" CSVXML helps validate import object data for museum-digital following museum-digital's standard import format.","help_what_is_csv":"What is CSV?","help_what_is_csv_content":"CSV is the abbreviation for \u201eComma Separated Value\u201c. It describes a file format for expressing tabular information in plain text files, that is supported by most table calculation programms such as MS Excel and LibreOffice Calc. It is thus a useful choice for quickly generating and sharing semi-structured data that can be further processed by other programms.","help_how_to_format_csv":"How to format CSV files for CSVXML?","help_how_to_format_csv_content":"CSVXML first of all requires CSV file using semicolons as a separator and double quotation marks as a delimiter. For generating actually importable data, it is advisable to save the CSV file in UTF-8 rather than the standard-conformant ASCII. Both current versions of MS Excel and LibreOffice Calc support export options for exporting CSV files using UTF-8 encoding.","file_encoding_is_not_utf8":"The file encoding appears to not be UTF-8!","non_utf8_file_instruction":"Try exporting the file using the format \"CSV (UTF-8)\" if you use MS Excel or set the encoding to UTF-8 when exporting through LibreOffice!"}

View File

@ -1 +1 @@
{"remarks":"Megjegyz\u00e9sek","download":"Let\u00f6lt\u00e9s","upload":"Felt\u00f6lt\u00e9s","select_csv_file_for_upload":"Please select a CSV file to create XML files","currently_approved_tags":"Jelenleg j\u00f3v\u00e1hagyott c\u00edmk\u00e9k (oszlopnevek) az md:importhoz","download_csv_all":"Download CSV template with all fields","download_csv_by_selection":"Download CSV template based on selection","select_required_fields":"K\u00f6telez\u0151 mez\u0151k kijel\u00f6l\u00e9se","select_all_fields":"\u00d6sszes mez\u0151 kijel\u00f6l\u00e9s","unset_selection":"Kijel\u00f6l\u00e9s megsz\u00fcntet\u00e9se","file_format":"Kiterjeszt\u00e9s","validation_errors":"Validation errors","errors_parsing":"Parse errors","errors_mandatoryTags":"Missing mandatory tags","errors_duplicateInvNos":"Duplicate inventory numbers","errors_dependentColumns":"Column dependencies unresolved","errors_controlledLists":"Controlled lists","errors_mainImageResource":"Missing main images or resources","allowed_values":"Allowed values","privacy_policy":"Privacy policy","contact":"Contact","news":"News","imprint":"Imprint","about":"About","help_where_am_i":"What is this page for?","help_where_am_i_content":" CSVXML helps validate import object data for museum-digital following museum-digital's standard import format.","help_what_is_csv":"What is CSV?","help_what_is_csv_content":"CSV is the abbreviation for \u201eComma Separated Value\u201c. It describes a file format for expressing tabular information in plain text files, that is supported by most table calculation programms such as MS Excel and LibreOffice Calc. It is thus a useful choice for quickly generating and sharing semi-structured data that can be further processed by other programms.","help_how_to_format_csv":"How to format CSV files for CSVXML?","help_how_to_format_csv_content":"CSVXML first of all requires CSV file using semicolons as a separator and double quotation marks as a delimiter. For generating actually importable data, it is advisable to save the CSV file in UTF-8 rather than the standard-conformant ASCII. Both current versions of MS Excel and LibreOffice Calc support export options for exporting CSV files using UTF-8 encoding."}
{"remarks":"Megjegyz\u00e9sek","download":"Let\u00f6lt\u00e9s","upload":"Felt\u00f6lt\u00e9s","select_csv_file_for_upload":"Please select a CSV file to create XML files","currently_approved_tags":"Jelenleg j\u00f3v\u00e1hagyott c\u00edmk\u00e9k (oszlopnevek) az md:importhoz","download_csv_all":"Download CSV template with all fields","download_csv_by_selection":"Download CSV template based on selection","select_required_fields":"K\u00f6telez\u0151 mez\u0151k kijel\u00f6l\u00e9se","select_all_fields":"\u00d6sszes mez\u0151 kijel\u00f6l\u00e9s","unset_selection":"Kijel\u00f6l\u00e9s megsz\u00fcntet\u00e9se","file_format":"Kiterjeszt\u00e9s","validation_errors":"Validation errors","errors_parsing":"Parse errors","errors_mandatoryTags":"Missing mandatory tags","errors_duplicateInvNos":"Duplicate inventory numbers","errors_dependentColumns":"Column dependencies unresolved","errors_controlledLists":"Controlled lists","errors_mainImageResource":"Missing main images or resources","allowed_values":"Allowed values","privacy_policy":"Privacy policy","contact":"Contact","news":"News","imprint":"Imprint","about":"About","help_where_am_i":"What is this page for?","help_where_am_i_content":" CSVXML helps validate import object data for museum-digital following museum-digital's standard import format.","help_what_is_csv":"What is CSV?","help_what_is_csv_content":"CSV is the abbreviation for \u201eComma Separated Value\u201c. It describes a file format for expressing tabular information in plain text files, that is supported by most table calculation programms such as MS Excel and LibreOffice Calc. It is thus a useful choice for quickly generating and sharing semi-structured data that can be further processed by other programms.","help_how_to_format_csv":"How to format CSV files for CSVXML?","help_how_to_format_csv_content":"CSVXML first of all requires CSV file using semicolons as a separator and double quotation marks as a delimiter. For generating actually importable data, it is advisable to save the CSV file in UTF-8 rather than the standard-conformant ASCII. Both current versions of MS Excel and LibreOffice Calc support export options for exporting CSV files using UTF-8 encoding.","file_encoding_is_not_utf8":"The file encoding appears to not be UTF-8!","non_utf8_file_instruction":"Try exporting the file using the format \"CSV (UTF-8)\" if you use MS Excel or set the encoding to UTF-8 when exporting through LibreOffice!"}

View File

@ -7,6 +7,8 @@
declare(strict_types = 1);
require_once __DIR__ . "/../functions/functions.php";
const GET_PARAM_JS_CSS = "v000006";
/**
* Generates the json for a translation file.
*
@ -66,6 +68,10 @@ function generateTranslationFile(string $lang):string {
'help_what_is_csv_content' => $tlLoader->tl("csvxml-overview", "csvxml_overview", 'help_what_is_csv_content'),
'help_how_to_format_csv' => $tlLoader->tl("csvxml-overview", "csvxml_overview", 'help_how_to_format_csv'),
'help_how_to_format_csv_content' => $tlLoader->tl("csvxml-overview", "csvxml_overview", 'help_how_to_format_csv_content'),
'file_encoding_is_not_utf8' => $tlLoader->tl("csvxml-overview", "csvxml_overview", 'file_encoding_is_not_utf8'),
'non_utf8_file_instruction' => $tlLoader->tl("csvxml-overview", "csvxml_overview", 'non_utf8_file_instruction'),
]);
}
@ -83,7 +89,7 @@ function generateAppShell():string {
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
<link rel="stylesheet" type="text/css" href="assets/css/csvxml.min.css?v000005" />
<link rel="stylesheet" type="text/css" href="assets/css/csvxml.min.css?' . GET_PARAM_JS_CSS . '" />
<link rel="manifest" href="/manifest.json" />
<meta name="theme-color" content="#aa4400" />
@ -106,7 +112,7 @@ function generateAppShell():string {
</head>
<body class="loading">
<script src="assets/js/csvxmlV2.min.js?v000005" type="text/javascript" async></script>
<script src="assets/js/csvxmlV2.min.js?' . GET_PARAM_JS_CSS . '" type="text/javascript" async></script>
</body>
</html>';