Skip to content

Commit

Permalink
Updated for rlease 4.20.0
Browse files Browse the repository at this point in the history
  • Loading branch information
rmraya committed Jul 14, 2022
1 parent a8ead69 commit ca42e96
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 20 deletions.
14 changes: 8 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ An advanced CAT (Computer Aided Translation) tool based on XLIFF Standard that s

Swordfish uses TM (Translation Memory) and MT (Machine Translation). Supports segment filtering, terminology, customization and more.

#### Swordfish IV Running on macOS
## Swordfish IV Running on macOS

<a href="https://www.maxprograms.com/tutorials/TranslateFile.mp4"><img src="https://www.maxprograms.com/images/translateFile.png"></a>

Expand All @@ -32,24 +32,25 @@ Personal Subscription Keys are available in [Maxprograms Online Store](https://
Subscription version includes unlimited email support at [email protected]

### Differences sumary

Differences | Source Code | Subscription Based
-|----------- | -------------
------------|:-----------:|:-----------------:
Ready To Use Installers| No | Yes
Notarized macOS launcher| No | Yes
Signed launcher and installer for Windows | No | Yes
Restricted Features | None | None
Technical Support | Peer support at [Groups.io](https://groups.io/g/maxprograms/)| - Direct email at [email protected] <br> - Peer support at [Groups.io](https://groups.io/g/maxprograms/)

Technical Support | Peer support at [Groups.io](https://groups.io/g/maxprograms/)| - Direct email at [email protected] <br> - Peer support at [Groups.io](https://groups.io/g/maxprograms/)

## Related Projects

- [RemoteTM](https://github.com/rmraya/RemoteTM)
- [OpenXLIFF Filters](https://github.com/rmraya/OpenXLIFF)

## Requirements

- JDK 17 or newer is required for compiling and building. Get it from [Adoptium](https://adoptium.net/).
- Apache Ant 1.10.10 or newer. Get it from [https://ant.apache.org/](https://ant.apache.org/)
- Node.js 16.13.0 LTS or newer. Get it from [https://nodejs.org/](https://nodejs.org/)
- Apache Ant 1.10.12 or newer. Get it from [https://ant.apache.org/](https://ant.apache.org/)
- Node.js 16.16.0 LTS or newer. Get it from [https://nodejs.org/](https://nodejs.org/)

## Building

Expand All @@ -68,6 +69,7 @@ Technical Support | Peer support at [Groups.io](https://groups.io/g/maxprogram
npm install
npm start
```

This video shows how to build and launch Swordfish IV: [https://www.maxprograms.com/tutorials/SwordfishIV_build.mp4](https://www.maxprograms.com/tutorials/SwordfishIV_build.mp4)

Compile once and then simply run `npm start` to start Swordfish
Binary file modified jars/openxliff.jar
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": "4.19.2",
"version": "4.20.0",
"description": "Swordfish Translation Editor",
"main": "js/App.js",
"scripts": {
Expand All @@ -20,7 +20,7 @@
"url": "https://github.com/rmraya/Swordfish.git"
},
"devDependencies": {
"electron": "^19.0.4",
"electron": "^19.0.8",
"typescript": "^4.7.4"
}
}
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 = "4.19.2";
public static final String BUILD = "20220618_1419";
public static final String VERSION = "4.20.0";
public static final String BUILD = "20220714_1219";

public static final String REASON = "reason";
public static final String STATUS = "status";
Expand Down
4 changes: 2 additions & 2 deletions src/com/maxprograms/swordfish/GlossariesHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -580,7 +580,7 @@ public static JSONObject searchTerm(String request) {
return result;
}

private static String generateHTML(List<Element> matches) throws IOException {
private static String generateHTML(List<Element> matches) throws IOException, SAXException, ParserConfigurationException {
StringBuilder builder = new StringBuilder();
builder.append("<table class='stripes'><tr>");
List<Language> languages = MemoriesHandler.getLanguages(matches);
Expand All @@ -600,7 +600,7 @@ private static String generateHTML(List<Element> matches) throws IOException {
return builder.toString();
}

private static String parseTU(Element element, List<Language> languages) {
private static String parseTU(Element element, List<Language> languages) throws SAXException, IOException, ParserConfigurationException {
StringBuilder builder = new StringBuilder();
Map<String, Element> map = new Hashtable<>();
List<Element> tuvs = element.getChildren("tuv");
Expand Down
4 changes: 2 additions & 2 deletions src/com/maxprograms/swordfish/MemoriesHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -580,7 +580,7 @@ public static String getName(String id) throws IOException {
}

private String generateHTML(List<Element> matches, String searchStr, boolean isRegexp, boolean caseSensitive)
throws IOException {
throws IOException, SAXException, ParserConfigurationException {
StringBuilder builder = new StringBuilder();
builder.append("<table class='stripes'><tr>");
List<Language> languages = getLanguages(matches);
Expand All @@ -601,7 +601,7 @@ private String generateHTML(List<Element> matches, String searchStr, boolean isR
}

private String parseTU(Element element, List<Language> languages, String searchStr, boolean isRegexp,
boolean caseSensitive) {
boolean caseSensitive) throws SAXException, IOException, ParserConfigurationException {
StringBuilder builder = new StringBuilder();
Map<String, Element> map = new Hashtable<>();
List<Element> tuvs = element.getChildren("tuv");
Expand Down
6 changes: 3 additions & 3 deletions src/com/maxprograms/swordfish/xliff/Split.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,15 @@

import javax.xml.parsers.ParserConfigurationException;

import org.xml.sax.SAXException;

import com.maxprograms.converters.Join;
import com.maxprograms.converters.Utils;
import com.maxprograms.xml.Document;
import com.maxprograms.xml.Element;
import com.maxprograms.xml.SAXBuilder;
import com.maxprograms.xml.XMLOutputter;

import org.xml.sax.SAXException;

public class Split {

private Split() {
Expand Down Expand Up @@ -81,7 +81,7 @@ public static List<String> split(String xliff, String outputFolder)
file.setAttribute("original", original.substring(treeRoot.length()));
Element skeleton = file.getChild("skeleton");
String href = skeleton.getAttributeValue("href");
if (!skeletons.contains(href)) {
if (!skeletons.contains(href) && new File(href).exists()) {
skeleton.addContent(Utils.encodeFromFile(new File(href).getAbsolutePath()));
skeleton.removeAttribute("href");
skeletons.add(href);
Expand Down
7 changes: 4 additions & 3 deletions src/com/maxprograms/swordfish/xliff/XliffStore.java
Original file line number Diff line number Diff line change
Expand Up @@ -2488,8 +2488,8 @@ private int storeMatches(JSONArray translations, String memoryName, int penaliza
Element matchTarget = XliffUtils.toXliff(segment, j, "target", m.getTarget());
matchTarget.setAttribute("xml:lang", tgtLang);
int similarity = m.getSimilarity() - tagDifferences(original, matchSource) - penalization;
insertMatch(file, unit, segment, memoryName, Constants.TM, similarity, matchSource, matchTarget,
XliffUtils.getTags());
insertMatch(file, unit, segment, memoryName, Constants.TM, similarity, matchSource,
matchTarget, XliffUtils.getTags());
if (similarity == 100 && originalTarget.getContent().isEmpty() && !updated) {
if (!matchTarget.getChildren().isEmpty()) {
matchTarget = fixTags(original, matchSource, matchTarget);
Expand Down Expand Up @@ -3382,7 +3382,8 @@ public void applyMtAll(MT translator)
String segment = rs.getString(3);
String sourceText = TMUtils.getString(rs.getNCharacterStream(4));

Element matchSource = XliffUtils.buildElement("<source>" + XMLUtils.cleanText(sourceText) + "</source>");
Element matchSource = XliffUtils
.buildElement("<source>" + XMLUtils.cleanText(sourceText) + "</source>");

JSONObject tagsData = new JSONObject();
List<JSONObject> translations = translator.translate(sourceText);
Expand Down

0 comments on commit ca42e96

Please sign in to comment.