Skip to content

Commit

Permalink
Applying i18n to missing artifacts.
Browse files Browse the repository at this point in the history
  • Loading branch information
davidbuzatto committed Mar 11, 2020
1 parent e019445 commit db152d0
Show file tree
Hide file tree
Showing 8 changed files with 93 additions and 13 deletions.
Binary file modified excelTemplate/template.xlsx
Binary file not shown.
26 changes: 24 additions & 2 deletions src/br/com/davidbuzatto/jjudge/gui/Bundle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# To change this template file, choose Tools | Templates
# and open the template in the editor.

MainWindow.title=JJudge - v1.17.1
MainWindow.title=JJudge - v1.17.2


MainWindow.menuItemShowDetails.text=Show details...
Expand Down Expand Up @@ -168,4 +168,26 @@ ExecutionState.COMPILATION_ERROR=COMPILATION ERROR
ExecutionState.RUNTIME_ERROR=RUNTIME ERROR
ExecutionState.TIMEOUT_ERROR=TIMEOUT ERROR
ExecutionState.FILE_NOT_FOUND_ERROR=FILE NOT FOUND ERROR
ExecutionState.DONT_CHECK=DONT CHECK
ExecutionState.DONT_CHECK=DONT CHECK


TestSet.toString.format=%s (%s) - %02d test(s)
Test.toString.format=%s - %02d test case(s)
TestResult.toString.format=%s - %02d test case(s) result: %s
TestCase.toString.format=<html>input: <strong><font color='#0000FF'>%s</font></strong> - output: <strong><font color='#00CC00'>%s</font></strong></html>


Utils.processResultsToExcel.gradeSheet.name=grades
Utils.processResultsToExcel.gradeSheet.student=student
Utils.processResultsToExcel.gradeSheet.code=code
Utils.processResultsToExcel.gradeSheet.grade=grade
Utils.processResultsToExcel.labelSheet.name=labels
Utils.processResultsToExcel.labelSheet.label=label
Utils.processResultsToExcel.labelSheet.meaning=meaning
Utils.processResultsToExcel.labelSheet.meaning.A=approved
Utils.processResultsToExcel.labelSheet.meaning.R=reproved
Utils.processResultsToExcel.labelSheet.meaning.CE=compilation error
Utils.processResultsToExcel.labelSheet.meaning.RE=runtime error
Utils.processResultsToExcel.labelSheet.meaning.TE=timeout error
Utils.processResultsToExcel.labelSheet.meaning.FE=file not found error
Utils.processResultsToExcel.labelSheet.meaning.DC=don't check
24 changes: 23 additions & 1 deletion src/br/com/davidbuzatto/jjudge/gui/Bundle_pt_BR.properties
Original file line number Diff line number Diff line change
Expand Up @@ -165,4 +165,26 @@ ExecutionState.COMPILATION_ERROR=ERRO DE COMPILA\u00c7\u00c3O
ExecutionState.RUNTIME_ERROR=ERRO: TEMPO DE EXECU\u00c7\u00c3O
ExecutionState.TIMEOUT_ERROR=ERRO: TEMPO ESGOTADO
ExecutionState.FILE_NOT_FOUND_ERROR=ERRO: ARQUIVO N\u00c3O ENCONTRADO
ExecutionState.DONT_CHECK=N\u00c3O CHECAR
ExecutionState.DONT_CHECK=N\u00c3O CHECAR


TestSet.toString.format=%s (%s) - %02d teste(s)
Test.toString.format=%s - %02d caso(s) de teste
TestResult.toString.format=%s - %02d resultado(s) do caso(s) de teste: %s
TestCase.toString.format=<html>entrada: <strong><font color='#0000FF'>%s</font></strong> - sa\u00edda: <strong><font color='#00CC00'>%s</font></strong></html>


Utils.processResultsToExcel.gradeSheet.name=notas
Utils.processResultsToExcel.gradeSheet.student=aluno
Utils.processResultsToExcel.gradeSheet.code=ra/bv
Utils.processResultsToExcel.gradeSheet.grade=nota
Utils.processResultsToExcel.labelSheet.name=etiquetas
Utils.processResultsToExcel.labelSheet.label=etiqueta
Utils.processResultsToExcel.labelSheet.meaning=significado
Utils.processResultsToExcel.labelSheet.meaning.A=aprovado
Utils.processResultsToExcel.labelSheet.meaning.R=reprovado
Utils.processResultsToExcel.labelSheet.meaning.CE=erro de compila\u00e7\u00e3o
Utils.processResultsToExcel.labelSheet.meaning.RE=erro de tempo de execu\u00e7\u00e3o
Utils.processResultsToExcel.labelSheet.meaning.TE=erro de tempo esgotado
Utils.processResultsToExcel.labelSheet.meaning.FE=erro de arquivo n\u00e3o encontrado
Utils.processResultsToExcel.labelSheet.meaning.DC=n\u00e3o verificar
7 changes: 6 additions & 1 deletion src/br/com/davidbuzatto/jjudge/testsets/Test.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@
*/
package br.com.davidbuzatto.jjudge.testsets;

import br.com.davidbuzatto.jjudge.utils.Utils;
import java.util.ArrayList;
import java.util.List;
import java.util.ResourceBundle;

/**
*
Expand All @@ -16,6 +18,8 @@ public class Test implements Cloneable {

private String name;
private List<TestCase> testCases;

private transient ResourceBundle bundle = Utils.bundle;

public String getName() {
return name;
Expand All @@ -35,7 +39,8 @@ public void setTestCases( List<TestCase> testCases ) {

@Override
public String toString() {
return String.format( "%s - %02d test case(s)", name, testCases.size() );
return String.format( bundle.getString( "Test.toString.format" ),
name, testCases.size() );
}

@Override
Expand Down
5 changes: 4 additions & 1 deletion src/br/com/davidbuzatto/jjudge/testsets/TestCase.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
package br.com.davidbuzatto.jjudge.testsets;

import br.com.davidbuzatto.jjudge.utils.Utils;
import java.util.ResourceBundle;

/**
*
Expand All @@ -15,6 +16,8 @@ public class TestCase implements Cloneable {

private String input;
private String output;

private transient ResourceBundle bundle = Utils.bundle;

public String getInput() {
return input;
Expand All @@ -35,7 +38,7 @@ public void setOutput( String output ) {
@Override
public String toString() {

return String.format( "<html>input: <strong><font color='#0000FF'>%s</font></strong> - output: <strong><font color='#00CC00'>%s</font></strong></html>",
return String.format( bundle.getString( "TestCase.toString.format" ),
input.isEmpty() ? "&lt;empty&gt;" : input.length() > 10 ? Utils.showScapeChars( input.substring( 0, 10 ) ) + "..." : Utils.showScapeChars( input ),
output.isEmpty() ? "&lt;empty&gt;" : output.length() > 10 ? Utils.showScapeChars( output.substring( 0, 10 ) ) + "..." : Utils.showScapeChars( output ) );

Expand Down
7 changes: 6 additions & 1 deletion src/br/com/davidbuzatto/jjudge/testsets/TestResult.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
package br.com.davidbuzatto.jjudge.testsets;

import br.com.davidbuzatto.jjudge.processor.ExecutionState;
import br.com.davidbuzatto.jjudge.utils.Utils;
import java.util.List;
import java.util.ResourceBundle;

/**
*
Expand All @@ -18,6 +20,8 @@ public class TestResult {
private List<TestCaseResult> testCasesResult;
private ExecutionState executionState;
private String errorMessage;

private transient ResourceBundle bundle = Utils.bundle;

public String getName() {
return name;
Expand Down Expand Up @@ -57,7 +61,8 @@ public void setErrorMessage( String errorMessage ) {

@Override
public String toString() {
return String.format( "%s - %02d test case(s) result: %s", name, testCasesResult.size(), executionState );
return String.format( bundle.getString( "TestResult.toString.format" ),
name, testCasesResult.size(), executionState );
}

}
7 changes: 6 additions & 1 deletion src/br/com/davidbuzatto/jjudge/testsets/TestSet.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@
*/
package br.com.davidbuzatto.jjudge.testsets;

import br.com.davidbuzatto.jjudge.utils.Utils;
import java.util.ArrayList;
import java.util.List;
import java.util.ResourceBundle;

/**
*
Expand All @@ -17,6 +19,8 @@ public class TestSet implements Cloneable {
private String description;
private TestProgrammingLanguage programmingLanguage;
private List<Test> tests;

private transient ResourceBundle bundle = Utils.bundle;

public String getDescription() {
return description;
Expand Down Expand Up @@ -44,7 +48,8 @@ public void setTests( List<Test> tests ) {

@Override
public String toString() {
return String.format( "%s (%s) - %02d test(s)", description, programmingLanguage, tests.size() );
return String.format( bundle.getString( "TestSet.toString.format" ),
description, programmingLanguage, tests.size() );
}

@Override
Expand Down
30 changes: 24 additions & 6 deletions src/br/com/davidbuzatto/jjudge/utils/Utils.java
Original file line number Diff line number Diff line change
Expand Up @@ -555,22 +555,27 @@ public static void processResultsToExcel( List<TestSetResult> tSetResList, TestS

InputStream inp = Utils.class.getResourceAsStream( "/template.xlsx" );
XSSFWorkbook workbook = XSSFWorkbookFactory.createWorkbook( inp );
XSSFSheet sheet = workbook.getSheetAt(0);
XSSFSheet gradeSheet = workbook.getSheetAt( 0 );
XSSFSheet labelSheet = workbook.getSheetAt( 1 );

Row r = sheet.getRow( 0 );
r.getCell( 0 ).setCellValue( "student" );
r.getCell( 1 ).setCellValue( "code" );
workbook.setSheetName( 0, bundle.getString( "Utils.processResultsToExcel.gradeSheet.name" ) );
workbook.setSheetName( 1, bundle.getString( "Utils.processResultsToExcel.labelSheet.name" ) );

// grades
Row r = gradeSheet.getRow( 0 );
r.getCell( 0 ).setCellValue( bundle.getString( "Utils.processResultsToExcel.gradeSheet.student" ) );
r.getCell( 1 ).setCellValue( bundle.getString( "Utils.processResultsToExcel.gradeSheet.code" ) );
int cc = 2; // current cell
int cr = 1; // current row

for ( TestResult tr : tSetResList.get( 0 ).getTestResults() ) {
r.getCell( cc++ ).setCellValue( tr.getName() );
}
r.getCell( cc ).setCellValue( "grade" );
r.getCell( cc ).setCellValue( bundle.getString( "Utils.processResultsToExcel.gradeSheet.grade" ) );

for ( TestSetResult tsr : tSetResList ) {

r = sheet.getRow( cr++ );
r = gradeSheet.getRow( cr++ );
r.getCell( 0 ).setCellValue( tsr.getStudent().getName() );
r.getCell( 1 ).setCellValue( tsr.getStudent().getCode() );
cc = 2;
Expand Down Expand Up @@ -614,6 +619,19 @@ public static void processResultsToExcel( List<TestSetResult> tSetResList, TestS

}

// labels
r = labelSheet.getRow( 0 );
r.getCell( 0 ).setCellValue( bundle.getString( "Utils.processResultsToExcel.labelSheet.label" ) );
r.getCell( 1 ).setCellValue( bundle.getString( "Utils.processResultsToExcel.labelSheet.meaning" ) );

labelSheet.getRow( 1 ).getCell( 1 ).setCellValue( bundle.getString( "Utils.processResultsToExcel.labelSheet.meaning.A" ) );
labelSheet.getRow( 2 ).getCell( 1 ).setCellValue( bundle.getString( "Utils.processResultsToExcel.labelSheet.meaning.R" ) );
labelSheet.getRow( 3 ).getCell( 1 ).setCellValue( bundle.getString( "Utils.processResultsToExcel.labelSheet.meaning.CE" ) );
labelSheet.getRow( 4 ).getCell( 1 ).setCellValue( bundle.getString( "Utils.processResultsToExcel.labelSheet.meaning.RE" ) );
labelSheet.getRow( 5 ).getCell( 1 ).setCellValue( bundle.getString( "Utils.processResultsToExcel.labelSheet.meaning.TE" ) );
labelSheet.getRow( 6 ).getCell( 1 ).setCellValue( bundle.getString( "Utils.processResultsToExcel.labelSheet.meaning.FE" ) );
labelSheet.getRow( 7 ).getCell( 1 ).setCellValue( bundle.getString( "Utils.processResultsToExcel.labelSheet.meaning.DC" ) );

JFileChooser jfc = new JFileChooser( new File( Utils.getPref( "saveSheetPath" ) ) );
jfc.setDialogTitle( bundle.getString( "Utils.processResultsToExcel.saveResults" ) );
jfc.setMultiSelectionEnabled( false );
Expand Down

0 comments on commit db152d0

Please sign in to comment.