Skip to content

Commit

Permalink
Updated for release 5.8.0
Browse files Browse the repository at this point in the history
  • Loading branch information
rmraya committed Nov 28, 2024
1 parent cf61591 commit 9aebb3f
Show file tree
Hide file tree
Showing 10 changed files with 87 additions and 70 deletions.
21 changes: 21 additions & 0 deletions css/dark.css
Original file line number Diff line number Diff line change
Expand Up @@ -606,6 +606,27 @@ th svg {
visibility: visible;
}

.iconTooltip {
position: relative;
display: inline-block;
}

.iconTooltip .tooltiptext {
background-color: var(--gray130);
color: var(--white);
visibility: hidden;
padding: 4px;
border-radius: 4px;
white-space: nowrap;
/* Position the tooltip */
position: absolute;
z-index: 100;
}

.iconTooltip:hover .tooltiptext {
visibility: visible;
}

.highlight {
color: var(--gray40);
}
Expand Down
21 changes: 21 additions & 0 deletions css/light.css
Original file line number Diff line number Diff line change
Expand Up @@ -606,6 +606,27 @@ th svg {
visibility: visible;
}

.iconTooltip {
position: relative;
display: inline-block;
}

.iconTooltip .tooltiptext {
background-color: var(--gray40);
color: var(--black);
visibility: hidden;
padding: 4px;
border-radius: 4px;
white-space: nowrap;
/* Position the tooltip */
position: absolute;
z-index: 100;
}

.iconTooltip:hover .tooltiptext {
visibility: visible;
}

.highlight {
color: var(--gray40);
}
Expand Down
2 changes: 1 addition & 1 deletion html/licenses.html
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
</tr>
<tr class="noWrap">
<td>JSON</td>
<td><a id="JSON">JSON.org</a></td>
<td>Public Domain</td>
</tr>
<tr class="noWrap">
<td>MapDB</td>
Expand Down
22 changes: 0 additions & 22 deletions html/licenses/json.txt

This file was deleted.

Binary file modified jars/openxliff.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "swordfish",
"productName": "Swordfish",
"version": "5.7.0",
"version": "5.8.0",
"description": "Swordfish Translation Editor",
"main": "js/Swordfish.js",
"scripts": {
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.7.0";
public static final String BUILD = "20241117_0847";
public static final String VERSION = "5.8.0";
public static final String BUILD = "20241124_1736";

public static final String REASON = "reason";
public static final String STATUS = "status";
Expand Down
6 changes: 1 addition & 5 deletions ts/Swordfish.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2150,10 +2150,6 @@ export class Swordfish {
licenseFile = 'file://' + this.path.join(app.getAppPath(), 'html', 'licenses', 'java.html');
title = 'GPL2 with Classpath Exception';
break;
case "JSON":
licenseFile = 'file://' + this.path.join(app.getAppPath(), 'html', 'licenses', 'json.txt');
title = 'JSON.org License';
break;
case "jsoup":
licenseFile = 'file://' + this.path.join(app.getAppPath(), 'html', 'licenses', 'jsoup.txt');
title = 'MIT License';
Expand Down Expand Up @@ -3468,7 +3464,7 @@ export class Swordfish {
default: parent = Swordfish.mainWindow;
}
}
dialog.showMessageBox(parent, {
dialog.showMessageBoxSync(parent, {
icon: this.iconPath,
type: arg.type,
message: arg.message,
Expand Down
3 changes: 0 additions & 3 deletions ts/licenses.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,6 @@ class Licenses {
document.getElementById('BCP47J').addEventListener('click', () => {
this.openLicense('BCP47J');
});
document.getElementById('JSON').addEventListener('click', () => {
this.openLicense('JSON');
});
document.getElementById('MapDB').addEventListener('click', () => {
this.openLicense('MapDB');
});
Expand Down
76 changes: 40 additions & 36 deletions ts/translation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,14 @@ class TranslationView {
static SVG_WARNING: string = "<svg xmlns='http://www.w3.org/2000/svg' height='24' viewBox='0 0 24 24' width='24'><path d='M11 15h2v2h-2v-2zm0-8h2v6h-2V7zm.99-5C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2zM12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z'/></svg>";
static SVG_NOTE: string = "<svg xmlns='http://www.w3.org/2000/svg' height='24' viewBox='0 0 24 24' width='24'><path d='M20 2H4c-1.1 0-1.99.9-1.99 2L2 22l4-4h14c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zm0 14H5.17l-.59.59-.58.58V4h16v12zm-9-4h2v2h-2zm0-6h2v4h-2z'/></svg>";

static LOCK_SPAN: string = "<span class='iconTooltip'>" + this.SVG_LOCK + " <small class='tooltiptext'>Locked segment</small></span>";
static FINAL_SPAN: string = "<span class='iconTooltip'>" + this.SVG_FINAL + " <small class='tooltiptext'>Confirmed</small></span>";
static TRANSLATED_SPAN: string = "<span class='iconTooltip'>" + this.SVG_TRANSLATED + " <small class='tooltiptext'>Draft</small></span>";
static NOTES_SPAN: string = "<span class='iconTooltip'>" + this.SVG_NOTE + " <small class='tooltiptext'>Segment has notes</small></span>";
static SPACE_WARNING: string = "<span class='iconTooltip'>" + this.SVG_WARNING + " <small class='tooltiptext'>Space errors</small></span>";
static TAG_WARNING: string = "<span class='iconTooltip'>" + this.SVG_WARNING + " <small class='tooltiptext'>Tag errors</small></span>";
static SPACE_TAG_WARNING: string = "<span class='iconTooltip'>" + this.SVG_WARNING + " <small class='tooltiptext'>Tag and space errors</small></span>";

static LOCK_FRAGMENT: string = 'M18 8h-1V6c0-2.76-2';
static NOTE_FRAGMENT: string = 'M20 2H4c-1.1 0-1.99';

Expand Down Expand Up @@ -1026,20 +1034,19 @@ class TranslationView {
td.classList.add('middle');
td.classList.add('center');
td.classList.add('translate');
td.innerHTML = row.translate ? TranslationView.SVG_BLANK : TranslationView.SVG_LOCK;
if ((row.tagErrors || row.spaceErrors) && row.translate) {
let title = '';
td.innerHTML = TranslationView.SVG_BLANK;
if (!row.translate) {
td.innerHTML = TranslationView.LOCK_SPAN;
} else if (row.tagErrors || row.spaceErrors) {
if (row.tagErrors) {
title = 'Tag errors';
td.innerHTML = TranslationView.TAG_WARNING;
}
if (row.spaceErrors) {
title = 'Space errors';
td.innerHTML = TranslationView.SPACE_WARNING;
}
if (row.tagErrors && row.spaceErrors) {
title = 'Tags and space errors';
td.innerHTML = TranslationView.SPACE_TAG_WARNING;
}
td.classList.add('tooltip');
td.innerHTML = TranslationView.SVG_WARNING + '<span class="tooltiptext">' + title + '</span>';
}
tr.appendChild(td);

Expand All @@ -1060,13 +1067,13 @@ class TranslationView {
td.innerHTML = TranslationView.SVG_BLANK;
}
if (row.state === 'translated') {
td.innerHTML = TranslationView.SVG_TRANSLATED;
td.innerHTML = TranslationView.TRANSLATED_SPAN;
}
if (row.state === 'final') {
td.innerHTML = TranslationView.SVG_FINAL;
td.innerHTML = TranslationView.FINAL_SPAN;
}
if (row.hasNotes) {
td.innerHTML = td.innerHTML + TranslationView.SVG_NOTE;
td.innerHTML = td.innerHTML + TranslationView.NOTES_SPAN;
}
tr.appendChild(td);

Expand Down Expand Up @@ -1215,36 +1222,36 @@ class TranslationView {
this.currentState.classList.remove('final');
if (translation === '') {
this.currentState.classList.add('initial');
this.currentState.innerHTML = hasNotes ? TranslationView.SVG_NOTE : TranslationView.SVG_BLANK;
this.currentState.innerHTML = hasNotes ? TranslationView.NOTES_SPAN : TranslationView.SVG_BLANK;
} else {
this.currentState.classList.add('translated');
this.currentState.innerHTML = TranslationView.SVG_TRANSLATED;
this.currentState.innerHTML = TranslationView.TRANSLATED_SPAN;
if (hasNotes) {
this.currentState.innerHTML = this.currentState.innerHTML + TranslationView.SVG_NOTE;
this.currentState.innerHTML = this.currentState.innerHTML + TranslationView.NOTES_SPAN;
}
}
}
if (confirm) {
this.currentState.classList.remove('initial');
this.currentState.classList.remove('translated');
this.currentState.classList.add('final');
this.currentState.innerHTML = TranslationView.SVG_FINAL;
this.currentState.innerHTML = TranslationView.FINAL_SPAN;
if (hasNotes) {
this.currentState.innerHTML = this.currentState.innerHTML + TranslationView.SVG_NOTE;
this.currentState.innerHTML = this.currentState.innerHTML + TranslationView.NOTES_SPAN;
}
} else {
if (translation === '') {
this.currentState.classList.remove('final');
this.currentState.classList.remove('translated');
this.currentState.classList.add('initial');
this.currentState.innerHTML = hasNotes ? TranslationView.SVG_NOTE : TranslationView.SVG_BLANK;
this.currentState.innerHTML = hasNotes ? TranslationView.NOTES_SPAN : TranslationView.SVG_BLANK;
} else {
this.currentState.classList.remove('final');
this.currentState.classList.remove('initial');
this.currentState.classList.add('translated');
this.currentState.innerHTML = TranslationView.SVG_TRANSLATED;
this.currentState.innerHTML = TranslationView.TRANSLATED_SPAN;
if (hasNotes) {
this.currentState.innerHTML = this.currentState.innerHTML + TranslationView.SVG_NOTE;
this.currentState.innerHTML = this.currentState.innerHTML + TranslationView.NOTES_SPAN;
}
}
}
Expand Down Expand Up @@ -1368,7 +1375,7 @@ class TranslationView {
this.currentState.innerHTML = TranslationView.SVG_BLANK;
} else {
this.currentState.classList.add('translated');
this.currentState.innerHTML = TranslationView.SVG_TRANSLATED;
this.currentState.innerHTML = TranslationView.TRANSLATED_SPAN;
}
}

Expand Down Expand Up @@ -1502,12 +1509,12 @@ class TranslationView {
this.currentState.classList.remove('final');
if (source.innerHTML === '') {
this.currentState.classList.add('initial');
this.currentState.innerHTML = hasNotes ? TranslationView.SVG_NOTE : TranslationView.SVG_BLANK;
this.currentState.innerHTML = hasNotes ? TranslationView.NOTES_SPAN : TranslationView.SVG_BLANK;
} else {
this.currentState.classList.add('translated');
this.currentState.innerHTML = TranslationView.SVG_TRANSLATED;
this.currentState.innerHTML = TranslationView.TRANSLATED_SPAN;
if (hasNotes) {
this.currentState.innerHTML = this.currentState.innerHTML + TranslationView.SVG_NOTE;
this.currentState.innerHTML = this.currentState.innerHTML + TranslationView.NOTES_SPAN;
}
}
this.currentCell.focus();
Expand Down Expand Up @@ -1598,7 +1605,7 @@ class TranslationView {
this.currentState.innerHTML = TranslationView.SVG_BLANK;
} else {
this.currentState.classList.add('translated');
this.currentState.innerHTML = TranslationView.SVG_TRANSLATED;
this.currentState.innerHTML = TranslationView.TRANSLATED_SPAN;
}
this.currentCell.focus();
}
Expand Down Expand Up @@ -1970,7 +1977,7 @@ class TranslationView {
segment: this.currentId.id
});
let isLocked: boolean = this.currentTranslate.innerHTML.includes(TranslationView.LOCK_FRAGMENT);
this.currentTranslate.innerHTML = isLocked ? TranslationView.SVG_BLANK : TranslationView.SVG_LOCK;
this.currentTranslate.innerHTML = isLocked ? TranslationView.SVG_BLANK : TranslationView.LOCK_SPAN;
this.selectRow(this.currentRow);
return;
}
Expand Down Expand Up @@ -2240,18 +2247,15 @@ class TranslationView {
if (row.getAttribute('data-file') === arg.file && row.getAttribute('data-unit') === arg.unit
&& row.getAttribute('data-id') === arg.segment) {
let td: HTMLTableCellElement = row.getElementsByClassName('translate')[0] as HTMLTableCellElement;
let title = '';
if (arg.tagErrors) {
title = 'Tag errors';
td.innerHTML = TranslationView.TAG_WARNING;
}
if (arg.spaceErrors) {
title = 'Space errors';
td.innerHTML = TranslationView.SPACE_WARNING;
}
if (arg.tagErrors && arg.spaceErrors) {
title = 'Tags and space errors';
td.innerHTML = TranslationView.SPACE_TAG_WARNING;
}
td.classList.add('tooltip');
td.innerHTML = TranslationView.SVG_WARNING + '<span class="tooltiptext">' + title + '</span>';
break;
}
}
Expand Down Expand Up @@ -2289,27 +2293,27 @@ class TranslationView {
notesRemoved(arg: any): void {
if (this.currentState.innerHTML.includes(TranslationView.NOTE_FRAGMENT)) {
if (this.currentState.classList.contains('final')) {
this.currentState.innerHTML = TranslationView.SVG_FINAL;
this.currentState.innerHTML = TranslationView.FINAL_SPAN;
}
if (this.currentState.classList.contains('initial')) {
this.currentState.innerHTML = TranslationView.SVG_BLANK;
}
if (this.currentState.classList.contains('translated')) {
this.currentState.innerHTML = TranslationView.SVG_TRANSLATED;
this.currentState.innerHTML = TranslationView.TRANSLATED_SPAN;
}
}
}

notesAdded(arg: any): void {
if (!this.currentState.innerHTML.includes(TranslationView.NOTE_FRAGMENT)) {
if (this.currentState.classList.contains('final')) {
this.currentState.innerHTML = TranslationView.SVG_FINAL + TranslationView.SVG_NOTE;
this.currentState.innerHTML = TranslationView.FINAL_SPAN + TranslationView.NOTES_SPAN;
}
if (this.currentState.classList.contains('initial')) {
this.currentState.innerHTML = TranslationView.SVG_BLANK + TranslationView.SVG_NOTE;
this.currentState.innerHTML = TranslationView.SVG_BLANK + TranslationView.NOTES_SPAN;
}
if (this.currentState.classList.contains('translated')) {
this.currentState.innerHTML = TranslationView.SVG_TRANSLATED + TranslationView.SVG_NOTE;
this.currentState.innerHTML = TranslationView.TRANSLATED_SPAN + TranslationView.NOTES_SPAN;
}
}
}
Expand Down

0 comments on commit 9aebb3f

Please sign in to comment.