add language_part (#39)

This commit is contained in:
moebiusl
2024-10-11 23:52:14 +02:00
committed by GitHub
parent 218d15ff51
commit 6bc93dec53
2 changed files with 12 additions and 4 deletions
+4 -4
View File
@@ -22,6 +22,7 @@ const GlpPage = () => {
const tr_SpecProblems = text(language, 'SpecProblem'); const tr_SpecProblems = text(language, 'SpecProblem');
const tr_fileUpload = text(language, 'FileUpload'); const tr_fileUpload = text(language, 'FileUpload');
const tr_fileName = text(language, 'FileName'); const tr_fileName = text(language, 'FileName');
const tr_DownloadGmpl = text(language, 'download_gmpl');
@@ -180,7 +181,7 @@ const GlpPage = () => {
const endTime = performance.now(); const endTime = performance.now();
const solverDuration = ((endTime - startTime) / 1000).toFixed(2); const solverDuration = ((endTime - startTime) / 1000).toFixed(2);
setSolverTime(`Solver time: ${solverDuration} seconds`); setSolverTime(`{tr_solverTime}: ${solverDuration} seconds`);
addMessage(`Solver time: ${solverDuration} seconds`); addMessage(`Solver time: ${solverDuration} seconds`);
let status; let status;
@@ -211,7 +212,7 @@ const GlpPage = () => {
variables += `${GLPKAPI.glp_get_col_name(lp, i)} = ${GLPKAPI.glp_mip_col_val(lp, i)}\n`; variables += `${GLPKAPI.glp_get_col_name(lp, i)} = ${GLPKAPI.glp_mip_col_val(lp, i)}\n`;
} }
if (solverTimeoutRef.current) clearTimeout(solverTimeoutRef.current); if (solverTimeoutRef.current) clearTimeout(solverTimeoutRef.current);
setResultContent(`${result}\n\n${variables}\n\nSolver time: ${solverDuration} seconds`); setResultContent(`${result}\n\nOptimal Value: ${GLPKAPI.glp_mip_obj_val(lp)}\n\n${variables}\n\nSolver time: ${solverDuration} seconds`);
setShowPopup(true); setShowPopup(true);
} catch (err) { } catch (err) {
@@ -300,7 +301,7 @@ const GlpPage = () => {
rows={getTextAreaHeight(fileContent)} rows={getTextAreaHeight(fileContent)}
/> />
<button className="button" onClick={downloadFile}> <button className="button" onClick={downloadFile}>
Download GMPL File {tr_DownloadGmpl}
</button> </button>
</div> </div>
)} )}
@@ -313,7 +314,6 @@ const GlpPage = () => {
)} )}
<div id="msgZone" className="msgZone"></div> <div id="msgZone" className="msgZone"></div>
<div>{solverTime}</div> {/* Display Solver Time */}
{/* Syntax Errors {/* Syntax Errors
{syntaxErrors.length > 0 && ( {syntaxErrors.length > 0 && (
+8
View File
@@ -6,6 +6,10 @@ export default function text(lang: string, input: string): string {
return "OR-Tool"; return "OR-Tool";
case "header_subtitle": case "header_subtitle":
return "von Spaceholder Programming"; return "von Spaceholder Programming";
case "download_gmpl":
return "GMPL-Datei herunterladen";
case "solver_time_lang":
return "Solver Laufzeit";
case "boxObjTitle": case "boxObjTitle":
return "Ziel"; return "Ziel";
case "GmplHeader": case "GmplHeader":
@@ -119,6 +123,10 @@ export default function text(lang: string, input: string): string {
// English translation // English translation
if (lang === "eng") { if (lang === "eng") {
switch (input) { switch (input) {
case "download_gmpl":
return "Download GMPL-File";
case "solver_time_lang":
return "Solver Time";
case "GmplHeader": case "GmplHeader":
return "General Linear Problems"; return "General Linear Problems";
case "SpecProblem": case "SpecProblem":