diff --git a/README.md b/README.md index 7d07c75..089f826 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ Fluenta is an open source tool designed to simplify the translation and localization of DITA projects combining two open standards from OASIS: *DITA* and *XLIFF*. -Fluenta implements the workflow described in the article [Use XLIFF to Translate DITA Projects](https://www.maxprograms.com/articles/ditaxliff.html), making it easy to manage the translation side of your DITA projects following the procedure recommended by the *OASIS DITA Adoption Technical Committee* (see the official publication from the TC available in PDF format from [OASIS](https://www.oasis-open.org/committees/download.php/48340/DITA12XLIFFArticle.pdf) and in HTML format at [ditatranslation.com](https://www.ditatranslation.com/articles/ditaxliff.html)). +Fluenta implements the workflow described in the article [Use XLIFF to Translate DITA Projects](https://www.maxprograms.com/articles/ditaxliff.html), making it easy to manage the translation side of your DITA projects according to the procedure recommended by the *OASIS DITA Adoption Technical Committee* (see the official TC publication, available in PDF at [OASIS](https://www.oasis-open.org/committees/download.php/48340/DITA12XLIFFArticle.pdf) and in HTML format at [ditatranslation.com](https://www.ditatranslation.com/articles/ditaxliff.html)). ## Licenses @@ -25,21 +25,21 @@ Ready to use installers and technical support for Fluenta are available as yearl The version of Fluenta included in the official installers from [Fluenta's Home Page](https://www.maxprograms.com/products/fluenta.html) can be used at no cost for 30 days requesting a free Evaluation Key. -Subscription version includes unlimited email support at tech@maxprograms.com +Subscription version includes unlimited email support at [tech@maxprograms.com](mailto:tech@maxprograms.com). ### Differences sumary -Differences | Source Code | Subscription Based +Differences | From 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 tech@maxprograms.com
- 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 [tech@maxprograms.com](mailto:tech@maxprograms.com)
- Peer support at [Groups.io](https://groups.io/g/maxprograms/) ## Installers -Ready to use installers are available at +Ready to use installers are available at [https://www.maxprograms.com/products/fluenta.html](https://www.maxprograms.com/products/fluenta.html). ## Building Yourself diff --git a/jars/openxliff.jar b/jars/openxliff.jar index 3b39b19..3c44518 100644 Binary files a/jars/openxliff.jar and b/jars/openxliff.jar differ diff --git a/jars/xmljava.jar b/jars/xmljava.jar index e6f4462..f68ca33 100644 Binary files a/jars/xmljava.jar and b/jars/xmljava.jar differ diff --git a/src/com/maxprograms/fluenta/CLI.java b/src/com/maxprograms/fluenta/CLI.java index 13e0833..40cdee0 100755 --- a/src/com/maxprograms/fluenta/CLI.java +++ b/src/com/maxprograms/fluenta/CLI.java @@ -30,6 +30,7 @@ import javax.xml.parsers.ParserConfigurationException; import org.json.JSONException; +import org.json.JSONObject; import org.xml.sax.SAXException; import com.maxprograms.utils.Preferences; @@ -76,6 +77,13 @@ public static void main(String[] args) { } for (int i = 0; i < args.length; i++) { + if (args[i].equals("-version")) { + JSONObject json = new JSONObject(); + json.put("version", Constants.VERSION); + json.put("build", Constants.BUILD); + System.out.println(json.toString(2)); + System.exit(0); + } if (args[i].equals("-add") && (i + 1) < args.length) { addProject = true; addFile = args[i + 1]; diff --git a/src/com/maxprograms/fluenta/Constants.java b/src/com/maxprograms/fluenta/Constants.java index bd56edf..a3c00ad 100755 --- a/src/com/maxprograms/fluenta/Constants.java +++ b/src/com/maxprograms/fluenta/Constants.java @@ -19,6 +19,6 @@ private Constants() { } public static final String NAME = "Fluenta"; - public static final String VERSION = "3.7.0"; - public static final String BUILD = "20230503_0805"; + public static final String VERSION = "3.8.0"; + public static final String BUILD = "20230606_1006"; } diff --git a/src/com/maxprograms/fluenta/controllers/LocalController.java b/src/com/maxprograms/fluenta/controllers/LocalController.java index 7d1dfec..9206b7a 100755 --- a/src/com/maxprograms/fluenta/controllers/LocalController.java +++ b/src/com/maxprograms/fluenta/controllers/LocalController.java @@ -175,8 +175,6 @@ public void generateXliff(Project project, String xliffFolder, List tg params.put("srcLang", project.getSrcLanguage()); params.put("tgtLang", project.getSrcLanguage()); // use src language in master params.put("srcEncoding", EncodingResolver.getEncoding(project.getMap(), FileFormats.DITA).name()); - params.put("paragraph", "no"); - params.put("format", FileFormats.DITA); params.put("srxFile", preferences.getDefaultSRX()); params.put("translateComments", translateComments ? "yes" : "no"); params.put("xmlfilter", preferences.getFiltersFolder()); @@ -1030,7 +1028,6 @@ private List searchTranslations(InternalDatabase database, Element seg, Iterator r = res.iterator(); while (r.hasNext()) { Match match = r.next(); - int quality = match.getSimilarity(); Element alttrans = new Element("alt-trans"); @@ -1047,7 +1044,7 @@ private List searchTranslations(InternalDatabase database, Element seg, alttrans.addContent(tgt); alttrans.addContent("\n "); alttrans = fixTags(seg.getChild("source"), alttrans); - quality = MatchQuality.similarity(TMUtils.pureText(seg.getChild("source")), + int quality = MatchQuality.similarity(TMUtils.pureText(seg.getChild("source")), TMUtils.pureText(alttrans.getChild("source"))); double discount = wrongTags(alttrans.getChild("source"), seg.getChild("source"), penalty); quality = (int) Math.floor(quality - discount); @@ -1118,10 +1115,8 @@ private void cleanCtype(Element e) { if (e.getName().equals("ph") || e.getName().equals("x")) { String value = e.getAttributeValue("ctype"); - if (!value.isEmpty()) { - if (!phCtypes.containsKey(value) && !value.startsWith("x-")) { - e.setAttribute("ctype", "x-" + value); - } + if (!value.isEmpty() && !phCtypes.containsKey(value) && !value.startsWith("x-")) { + e.setAttribute("ctype", "x-" + value); } } if (e.getName().equals("bpt") diff --git a/src/com/maxprograms/fluenta/controllers/ProjectsManager.java b/src/com/maxprograms/fluenta/controllers/ProjectsManager.java index 289a66e..1ad80e8 100644 --- a/src/com/maxprograms/fluenta/controllers/ProjectsManager.java +++ b/src/com/maxprograms/fluenta/controllers/ProjectsManager.java @@ -63,12 +63,12 @@ public ProjectsManager(File home) throws IOException, JSONException, ParseExcept } private JSONObject upgradeProjects(JSONObject json) throws JSONException, ParseException { - JSONArray projects = json.getJSONArray("projects"); + JSONArray projectsArray = json.getJSONArray("projects"); DateFormat df = DateFormat.getDateTimeInstance(); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm"); DateFormat ldf = DateFormat.getDateInstance(DateFormat.LONG); - for (int i = 0; i < projects.length(); i++) { - JSONObject project = projects.getJSONObject(i); + for (int i = 0; i < projectsArray.length(); i++) { + JSONObject project = projectsArray.getJSONObject(i); Date creationDate = df.parse(project.getString("creationDate")); project.put("creationDate", sdf.format(creationDate)); Date lastUpdate = df.parse(project.getString("lastUpdate")); @@ -96,11 +96,11 @@ private synchronized void saveProjects() throws IOException { } } - List getProjects() throws JSONException, ParseException, IOException { + List getProjects() throws JSONException { return projects; } - public Project getProject(long id) throws JSONException, ParseException, IOException { + public Project getProject(long id) throws JSONException, IOException { for (int i = 0; i < projects.size(); i++) { Project project = projects.get(i); if (id == project.getId()) { diff --git a/src/com/maxprograms/fluenta/views/GenerateXliffDialog.java b/src/com/maxprograms/fluenta/views/GenerateXliffDialog.java index c884154..1fe3e09 100755 --- a/src/com/maxprograms/fluenta/views/GenerateXliffDialog.java +++ b/src/com/maxprograms/fluenta/views/GenerateXliffDialog.java @@ -16,15 +16,10 @@ import java.io.IOException; import java.lang.System.Logger; import java.lang.System.Logger.Level; -import java.net.URISyntaxException; -import java.sql.SQLException; -import java.text.ParseException; import java.util.Iterator; import java.util.List; import java.util.Vector; -import javax.xml.parsers.ParserConfigurationException; - import org.eclipse.swt.SWT; import org.eclipse.swt.SWTException; import org.eclipse.swt.events.SelectionAdapter; @@ -45,8 +40,6 @@ import org.eclipse.swt.widgets.MessageBox; import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Text; -import org.json.JSONException; -import org.xml.sax.SAXException; import com.maxprograms.converters.ILogger; import com.maxprograms.fluenta.Fluenta; @@ -343,10 +336,9 @@ public void handleEvent(Event ev) { public void run() { try { mainView.getController().generateXliff(project, xliffFolder, tgtLangs, useice, usetm, count, - ditaval, useXliff20, embedSkeleton, modifiedFilesOnly, ignoreTrackedChanges, paragraphSegmentation, aLogger); - } catch (IOException | ClassNotFoundException | JSONException | SAXException - | NullPointerException | ParserConfigurationException | URISyntaxException - | SQLException | ParseException e) { + ditaval, useXliff20, embedSkeleton, modifiedFilesOnly, ignoreTrackedChanges, + paragraphSegmentation, aLogger); + } catch (Exception e) { aLogger.displayError(e.getMessage()); logger.log(Level.ERROR, e); }