Skip to content

Commit

Permalink
Updated for release 5.7.0
Browse files Browse the repository at this point in the history
  • Loading branch information
rmraya committed Nov 20, 2024
1 parent ffbd260 commit cf61591
Show file tree
Hide file tree
Showing 26 changed files with 693 additions and 282 deletions.
12 changes: 1 addition & 11 deletions .classpath
Original file line number Diff line number Diff line change
Expand Up @@ -41,17 +41,7 @@
<attribute name="module" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="lib" path="jars/slf4j-api-2.0.13.jar">
<attributes>
<attribute name="module" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="lib" path="jars/slf4j-nop-2.0.13.jar">
<attributes>
<attribute name="module" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="lib" path="jars/sqlite-jdbc-3.45.3.0.jar">
<classpathentry kind="lib" path="jars/sqlite-jdbc-3.47.0.1-20241024.015404-1.jar">
<attributes>
<attribute name="module" value="true"/>
</attributes>
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ Technical Support | Peer support at [Groups.io](https://groups.io/g/maxprograms
## Requirements

- JDK 21 or newer is required for compiling and building. Get it from [Adoptium](https://adoptium.net/).
- Apache Ant 1.10.12 or newer. Get it from [https://ant.apache.org/](https://ant.apache.org/)
- Apache Ant 1.10.14 or newer. Get it from [https://ant.apache.org/](https://ant.apache.org/)
- Node.js 20.16.0 LTS or newer. Get it from [https://nodejs.org/](https://nodejs.org/)
- TypeScript 5.6.2 or newer, get it from [https://www.typescriptlang.org/](https://www.typescriptlang.org/)
- TypeScript 5.6.3 or newer, get it from [https://www.typescriptlang.org/](https://www.typescriptlang.org/)

## Building

Expand Down
4 changes: 1 addition & 3 deletions build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@
<pathelement location="jars/mapdb.jar" />
<pathelement location="jars/openxliff.jar" />
<pathelement location="jars/xmljava.jar" />
<pathelement location="jars/slf4j-api-2.0.13.jar" />
<pathelement location="jars/slf4j-nop-2.0.13.jar" />
<pathelement location="jars/sqlite-jdbc-3.45.3.0.jar" />
<pathelement location="jars/sqlite-jdbc-3.47.0.1-20241024.015404-1.jar" />
</path>
<condition property="isWindows">
<os family="windows"/>
Expand Down
85 changes: 85 additions & 0 deletions html/editProject.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
<!DOCTYPE html>
<html lang="en">

<head>
<title>Edit Project</title>
<link id="theme" rel="stylesheet" type="text/css" href="../css/light.css">
<link rel="stylesheet" type="text/css" href="../css/fonts.css">
</head>

<body class="dialogBody" onload="new EditProject();">
<table class="fill_width">
<tr>
<td class="middle">
<label for="nameInput">Name</label>
</td>
<td class="fill_width middle">
<input type="text" id="nameInput" class="table_input">
</td>
</tr>
</table>

<table>
<tr>
<td style="width:50%; padding:0;">
<table class="fill_width">
<tr style="height: 2.5em;">
<td class="middle noWrap">
<label for="srcLangSelect">Source Language</label>
</td>
<td class="fill_width middle form_height">
<select id="srcLangSelect" class="fill_width">

</select>
</td>
</tr>
<tr style="height: 2.5em;">
<td class="middle noWrap">
<label for="tgtLangSelect">Target Language</label>
</td>
<td class="fill_width middle form_height">
<select id="tgtLangSelect" class="fill_width">

</select>
</td>
</tr>
</table>
</td>
<td style="width:50%; padding:0;">
<table class="fill_width">
<tr style="height: 2.5em;">
<td class="middle">
<label for="subjectInput">Subject</label>
</td>
<td class="fill_width middle form_height">
<input list="subjects" id="subjectInput" class="table_input middle" >
<datalist id="subjects">
<option value="none">
</datalist>
</td>
</tr>
<tr style="height: 2.5em;">
<td class="middle">
<label for="clientInput">Client</label>
</td>
<td class="fill_width middle form_height">
<input list="clients" id="clientInput" class="table_input middle" >
<datalist id="clients">
<option value="none">
</datalist>
</td>
</tr>
</table>
</td>
</tr>
</table>

<div class="buttonArea">
<span class="fill_width">&nbsp;</span>
<button id="updateProjectButton">Update Project</button>
</div>

<script src="../js/editProject.js"></script>
</body>

</html>
32 changes: 0 additions & 32 deletions html/messages.html

This file was deleted.

10 changes: 5 additions & 5 deletions html/sortSegments.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
<table>
<tr>
<td class="middle">
<input type="radio" id="language" name="sortType" style="margin-top: 4px;" checked>
<input type="radio" id="language" name="sortType" " checked>
</td>
<td class="middle noWrap fill_width">
<td class=" middle noWrap fill_width">
<label for="language">Sort on Column Text Content</label>
</td>
</tr>
Expand All @@ -23,13 +23,13 @@
<table>
<tr>
<td class="middle">
<input type="radio" id="source" name="lang" style="margin-top: 4px;" checked>
<input type="radio" id="source" name="lang" checked>
</td>
<td class="middle noWrap">
<label for="source">Source Column</label>
</td>
<td class="middle">
<input type="radio" id="target" name="lang" style="margin-left:10px;margin-top: 4px;">
<input type="radio" id="target" name="lang">
</td>
<td class="middle noWrap">
<label for="target">Target Column</label>
Expand All @@ -41,7 +41,7 @@
</tr>
<tr>
<td class="middle">
<input type="radio" id="status" name="sortType" style="margin-top: 4px;">
<input type="radio" id="status" name="sortType">
</td>
<td class="middle noWrap fill_width">
<label for="status">Sort on Segment Status</label>
Expand Down
Binary file modified jars/openxliff.jar
Binary file not shown.
Binary file removed jars/slf4j-api-2.0.13.jar
Binary file not shown.
Binary file removed jars/slf4j-nop-2.0.13.jar
Binary file not shown.
Binary file not shown.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "swordfish",
"productName": "Swordfish",
"version": "5.6.5",
"version": "5.7.0",
"description": "Swordfish Translation Editor",
"main": "js/Swordfish.js",
"scripts": {
Expand All @@ -20,7 +20,7 @@
"url": "https://github.com/rmraya/Swordfish.git"
},
"devDependencies": {
"electron": "^32.2.0",
"electron": "^33.2.0",
"typescript": "^5.6.3"
},
"dependencies": {
Expand Down
4 changes: 2 additions & 2 deletions src/com/maxprograms/swordfish/Constants.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ private Constants() {
}

public static final String APPNAME = "Swordfish";
public static final String VERSION = "5.6.4";
public static final String BUILD = "20240921_0931";
public static final String VERSION = "5.7.0";
public static final String BUILD = "20241117_0847";

public static final String REASON = "reason";
public static final String STATUS = "status";
Expand Down
40 changes: 38 additions & 2 deletions src/com/maxprograms/swordfish/ProjectsHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,8 @@ private JSONObject processRequest(String url, String request) {
try {
if ("/projects/create".equals(url)) {
response = createProject(request);
} else if ("/projects/update".equals(url)) {
response = updateProject(request);
} else if ("/projects/list".equals(url)) {
response = listProjects();
} else if ("/projects/get".equals(url)) {
Expand Down Expand Up @@ -815,6 +817,40 @@ private JSONObject getSegmentsCount(String request) {
return result;
}

private JSONObject updateProject(String request) {
JSONObject result = new JSONObject();
JSONObject json = new JSONObject(request);
String projectId = json.getString("project");
if (!projectStores.containsKey(projectId)) {
try {
Map<String, Project> projects = getProjects();
Project prj = projects.get(projectId);
XliffStore store = new XliffStore(prj.getXliff(), prj.getSourceLang().getCode(),
prj.getTargetLang().getCode());
projectStores.put(projectId, store);
} catch (SAXException | IOException | ParserConfigurationException | URISyntaxException | SQLException e) {
logger.log(Level.ERROR, Messages.getString("ProjectsHandler.3"), e);
result.put(Constants.REASON, e.getMessage());
return result;
}
}
try {
projectStores.get(json.getString("project")).updateProject(json);
Map<String, Project> projects = getProjects();
Project project = projects.get(json.getString("project"));
project.setDescription(json.getString("description"));
project.setSourceLang(LanguageUtils.getLanguage(json.getString("srcLang")));
project.setTargetLang(LanguageUtils.getLanguage(json.getString("tgtLang")));
project.setClient(json.getString("client"));
project.setSubject(json.getString("subject"));
saveProjectsList(projects);
} catch (IOException | SAXException | ParserConfigurationException e) {
logger.log(Level.ERROR, e);
result.put(Constants.REASON, e.getMessage());
}
return result;
}

private JSONObject createProject(String request) {
JSONObject result = new JSONObject();
JSONObject json = new JSONObject(request);
Expand Down Expand Up @@ -1486,9 +1522,9 @@ private JSONObject generateStatistics(String request) {
try {
JSONObject json = new JSONObject(request);
String project = json.getString("project");
Map<String, Project> projects = getProjects();
if (!projectStores.containsKey(project)) {
try {
Map<String, Project> projects = getProjects();
Project prj = projects.get(project);
XliffStore store = new XliffStore(prj.getXliff(), prj.getSourceLang().getCode(),
prj.getTargetLang().getCode());
Expand All @@ -1500,7 +1536,7 @@ private JSONObject generateStatistics(String request) {
return result;
}
}
String analysis = projectStores.get(project).generateStatistics();
String analysis = projectStores.get(project).generateStatistics(projects.get(project).getDescription());
result.put("analysis", analysis);
} catch (SQLException | JSONException | SAXException | IOException | ParserConfigurationException
| URISyntaxException e) {
Expand Down
8 changes: 8 additions & 0 deletions src/com/maxprograms/swordfish/models/Project.java
Original file line number Diff line number Diff line change
Expand Up @@ -200,10 +200,18 @@ public String getClient() {
return client;
}

public void setClient(String client) {
this.client = client;
}

public String getSubject() {
return subject;
}

public void setSubject(String subject) {
this.subject = subject;
}

@Override
public int compareTo(Project o) {
return creationDate.compareTo(o.getCreationDate());
Expand Down
Loading

0 comments on commit cf61591

Please sign in to comment.