Commit 0482d8e2 authored by Tommy Chan's avatar Tommy Chan

language

parent 9699f22b
......@@ -58,9 +58,9 @@ class Editor {
setLines() {
let lines = this.editor.session.getLength();
let linecol = this.editor.selection.getCursor();
$('#lines').html(`<strong id="editor_ln">Ln:<\/strong> ${linecol.row+1}
<strong id="editor_ch">Ch:<\/strong>${linecol.column} |
<strong id="editor_ttln">Total Ln:<\/strong> ${lines}`);
$('#lines').html(`<strong>`+lang.lang.editor_line+`<\/strong> ${linecol.row+1}
<strong>`+lang.lang.editor_ch+`<\/strong>${linecol.column} |
<strong>`+lang.lang.editor_totalline+`<\/strong> ${lines}`);
}
changeTheme(theme) {
......
......@@ -10,7 +10,7 @@ class File {
static fileSupport() {
// Check for the various File API support.
if (!(window.File && window.FileReader && window.FileList && window.Blob)) {
dialog.err('The File APIs are not fully supported in this browser.', lang.lang.error);
dialog.err(lang.lang.api_error, lang.lang.error);
}
}
......@@ -19,7 +19,7 @@ class File {
const data = ace.edit("XMLCode").getValue();
if (!data) {
dialog.err('Text area is empty.', lang.lang.error);
dialog.err(lang.lang.empty_textarea_error, lang.lang.error);
return null;
}
......@@ -38,7 +38,7 @@ class File {
fileName = file.name;
}
fileName = prompt("Please enter the file name", fileName); // FIXME Doesn't work in nodejs
fileName = prompt(lang.lang.enter_filename_error, fileName); // FIXME Doesn't work in nodejs
......@@ -54,7 +54,7 @@ class File {
dialog.err(err, lang.lang.error);
}
else {
dialog.info("The file was saved!");
dialog.info(lang.lang.saved);
}
});
}
......@@ -72,7 +72,7 @@ class File {
if (file.name.substring(file.name.lastIndexOf(".")) != ".xml") {
file = file_tmp;
$("#fileInput").val("");
dialog.err('XML file only.', lang.lang.error);
dialog.err(lang.lang.xml_only_error, lang.lang.error);
return false;
} else {
fileType = "text/xml";
......@@ -80,7 +80,7 @@ class File {
document.getElementById('fileDetails').innerHTML =
'<strong>' + fileName + '</strong> (' + fileType + ') - ' +
fileSize + ' bytes, last modified: ' + lastModified;
fileSize + lang.lang.editor_size_lastm + lastModified;
return true;
}
......
......@@ -89,46 +89,46 @@ function generateExe() {
`;
if (story_number>7 || story_number<1) {
dialog.err("Sorry, you can only replace story 1-7.", lang.lang.error);
dialog.err(lang.lang.replace_story_error, lang.lang.error);
return;
} else {
story_number=parseInt(story_number);
}
if (story_name == "" || story_name == null) {
dialog.err("Please enter a English name for your story.", lang.lang.error);
dialog.err(lang.lang.story_engname_error, lang.lang.error);
return;
}
if (story_nameb5 == "" || story_nameb5 == null) {
dialog.err("Please enter a Chinese name for your story.", lang.lang.error);
dialog.err(lang.lang.story_chiname_error, lang.lang.error);
return;
}
const data = File.getDataFromEditor();
if (data === undefined || data === null || data === '' || data.length == 0) {
dialog.err("Story cannot be empty.", lang.lang.error);
dialog.err(lang.lang.empty_story_error, lang.lang.error);
return;
}
// TODO: XML validation
fs.exists(target_file, exists => {
if (exists) {
dialog.err("Sorry, the story file already exists.", lang.lang.error);
dialog.err(lang.lang.exists_error, lang.lang.error);
return;
}
});
if (data.length > 512 * 1000) {
dialog.err("Sorry, your story is too large.", lang.lang.error);
dialog.err(lang.lang.large_size_error, lang.lang.error);
return;
}
fs.writeFile(target_file, data, err => {
console.log(target_file)
if (err) {
dialog.err("Sorry, there was an error saving your story.", lang.lang.error);
dialog.err(lang.lang.save_error, lang.lang.error);
return;
}
create_mod(target_filename);
......@@ -136,7 +136,7 @@ function generateExe() {
//upload storylist
fs.writeFile(target_file_story_list, storylistdata, err => {
if (err) {
dialog.err("Sorry, there was an error saving the story name.", lang.lang.error);
dialog.err(lang.lang.savename_error, lang.lang.error);
return;
}
create_mod(target_filename);
......
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