diff --git a/package.json b/package.json index 9365da2..bf2ffde 100644 --- a/package.json +++ b/package.json @@ -47,68 +47,68 @@ "!tsconfig.json" ], "dependencies": { - "@nestjs/common": "^10.2.0", - "@nestjs/core": "^10.2.0", - "@nestjs/platform-express": "^10.2.0", - "@nestjs/platform-ws": "^10.2.0", - "@nestjs/serve-static": "^4.0.0", - "@nestjs/websockets": "^10.2.0", - "@xmldom/xmldom": "^0.8.10", + "@nestjs/common": "^10.4.15", + "@nestjs/core": "^10.4.15", + "@nestjs/platform-express": "^10.4.15", + "@nestjs/platform-ws": "^10.4.15", + "@nestjs/serve-static": "^4.0.2", + "@nestjs/websockets": "^10.4.15", + "@xmldom/xmldom": "^0.9.6", "class-transformer": "^0.5.1", - "class-validator": "^0.14.0", + "class-validator": "^0.14.1", "js-levenshtein": "^1.1.6", "reflect-metadata": "^0.2.2", "rxjs": "~7.8.1" }, "devDependencies": { - "@angular-devkit/build-angular": "^19.0.1", - "@angular-eslint/builder": "19.0.0-alpha.1", - "@angular-eslint/eslint-plugin": "19.0.0-alpha.1", - "@angular-eslint/eslint-plugin-template": "19.0.0-alpha.1", - "@angular-eslint/schematics": "19.0.0-alpha.1", - "@angular-eslint/template-parser": "19.0.0-alpha.1", - "@angular/animations": "^19.0.0", - "@angular/cdk": "^19.0.0", - "@angular/cli": "^19.0.1", - "@angular/common": "^19.0.0", - "@angular/compiler": "^19.0.0", - "@angular/compiler-cli": "^19.0.0", - "@angular/core": "^19.0.0", - "@angular/forms": "^19.0.0", - "@angular/language-service": "^19.0.0", - "@angular/localize": "^19.0.0", - "@angular/material": "^19.0.0", - "@angular/platform-browser": "^19.0.0", - "@angular/platform-browser-dynamic": "^19.0.0", - "@angular/router": "^19.0.0", - "@nestjs/schematics": "^10.0.0", - "@nestjs/testing": "^10.2.0", - "@types/express": "^4.17.20", - "@types/jasmine": "~5.1.1", - "@types/jest": "^29.5.7", - "@types/js-levenshtein": "^1.1.2", - "@types/node": "^18.16.3", - "@types/ws": "^8.5.8", - "@typescript-eslint/eslint-plugin": "^7.2.0", - "@typescript-eslint/parser": "^7.2.0", + "@angular-devkit/build-angular": "^19.0.5", + "@angular-eslint/builder": "19.0.2", + "@angular-eslint/eslint-plugin": "19.0.2", + "@angular-eslint/eslint-plugin-template": "19.0.2", + "@angular-eslint/schematics": "19.0.2", + "@angular-eslint/template-parser": "19.0.2", + "@angular/animations": "^19.0.4", + "@angular/cdk": "^19.0.3", + "@angular/cli": "^19.0.5", + "@angular/common": "^19.0.4", + "@angular/compiler": "^19.0.4", + "@angular/compiler-cli": "^19.0.4", + "@angular/core": "^19.0.4", + "@angular/forms": "^19.0.4", + "@angular/language-service": "^19.0.4", + "@angular/localize": "^19.0.4", + "@angular/material": "^19.0.3", + "@angular/platform-browser": "^19.0.4", + "@angular/platform-browser-dynamic": "^19.0.4", + "@angular/router": "^19.0.4", + "@nestjs/schematics": "^10.2.3", + "@nestjs/testing": "^10.4.15", + "@types/express": "^5.0.0", + "@types/jasmine": "~5.1.5", + "@types/jest": "^29.5.14", + "@types/js-levenshtein": "^1.1.3", + "@types/node": "^22.10.2", + "@types/ws": "^8.5.13", + "@typescript-eslint/eslint-plugin": "^8.18.0", + "@typescript-eslint/parser": "^8.18.0", "commit-and-tag-version": "^12.5.0", - "eslint": "^8.57.0", - "eslint-plugin-import": "^2.29.0", - "husky": "^9.0.11", - "jasmine-core": "~5.1.1", + "eslint": "^9.16.0", + "eslint-plugin-import": "^2.31.0", + "husky": "^9.1.7", + "jasmine-core": "~5.5.0", "jest": "^29.7.0", - "karma": "~6.4.2", + "karma": "~6.4.4", "karma-chrome-launcher": "~3.2.0", "karma-coverage": "~2.2.1", "karma-jasmine": "~5.1.0", "karma-jasmine-html-reporter": "~2.1.0", - "lint-staged": "^15.0.2", - "prettier": "^3.0.3", - "rimraf": "^5.0.5", - "rollup": "^4.3.0", + "lint-staged": "^15.2.11", + "prettier": "^3.4.2", + "rimraf": "^6.0.1", + "rollup": "^4.28.1", "rollup-plugin-ts": "^3.4.5", - "ts-jest": "^29.1.1", - "ts-node": "^10.4.0", + "ts-jest": "^29.2.5", + "ts-node": "^10.9.2", "tsconfig-paths": "^4.2.0", "tslib": "^2.8.1", "typescript": "~5.6.3", @@ -153,5 +153,6 @@ "*.{js,ts,css,scss,json,md,html}": [ "prettier --write --ignore-unknown" ] - } + }, + "packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e" } diff --git a/server/deserialization/xlf2-deserializer.ts b/server/deserialization/xlf2-deserializer.ts index cf33f6f..79a16a1 100644 --- a/server/deserialization/xlf2-deserializer.ts +++ b/server/deserialization/xlf2-deserializer.ts @@ -85,7 +85,11 @@ export class Xlf2Deserializer extends XlfDeserializerBase { } private _extractTarget(segment: Element) { - return this._convertToString(segment.getElementsByTagName('target')[0]); + const node = segment.getElementsByTagName('target')[0]; + if (!node) { + return ''; + } + return this._convertToString(node); } private _extractNote(notes: Element, category: string): string[] { diff --git a/server/serialization/xlf2-serializer.ts b/server/serialization/xlf2-serializer.ts index 25f0d77..93bc2da 100644 --- a/server/serialization/xlf2-serializer.ts +++ b/server/serialization/xlf2-serializer.ts @@ -25,7 +25,11 @@ ${units } ${u.source} - ${u.target} + ${ + u.state === 'initial' && (!u.target || u.target === '') + ? `` // Don't include target if it is "initial" and empty + : `${u.target}` + } `, ) diff --git a/src/app/target/core/translation-target.service.ts b/src/app/target/core/translation-target.service.ts index 6c53d7e..14d0c03 100644 --- a/src/app/target/core/translation-target.service.ts +++ b/src/app/target/core/translation-target.service.ts @@ -99,9 +99,7 @@ export class TranslationTargetService { } updateUnit(unit: Partial) { - if (unit.target === '' && unit.state !== 'initial') { - unit.state = 'initial'; - } else if (unit.target !== '' && unit.state === 'initial') { + if (unit.target !== '' && unit.state === 'initial') { unit.state = 'translated'; } diff --git a/src/app/target/translate/translate-datasource.ts b/src/app/target/translate/translate-datasource.ts index d4b8b74..ac7e49e 100644 --- a/src/app/target/translate/translate-datasource.ts +++ b/src/app/target/translate/translate-datasource.ts @@ -43,7 +43,7 @@ export class TranslateDataSource extends TranslationDataSource< const unit: FormTargetUnit = { ...u, target: new UntypedFormControl(u.target), - state: new UntypedFormControl({ value: u.state, disabled: !u.target }), + state: new UntypedFormControl(u.state), }; this._translationTargetService.updateUnitOnChange(u, unit, this._destroy); unit.target.markAsTouched(); diff --git a/src/app/target/translate/translate.component.html b/src/app/target/translate/translate.component.html index 5db637c..dc908bb 100644 --- a/src/app/target/translate/translate.component.html +++ b/src/app/target/translate/translate.component.html @@ -42,9 +42,7 @@ - Initial + Initial Translated Reviewed Final @@ -132,7 +130,7 @@ 'source-filter', 'target-filter', 'state-filter', - 'action' + 'action', ]; sticky: true " diff --git a/src/app/target/translate/translate.component.ts b/src/app/target/translate/translate.component.ts index dc465ca..f81e300 100644 --- a/src/app/target/translate/translate.component.ts +++ b/src/app/target/translate/translate.component.ts @@ -1,5 +1,5 @@ import { TextFieldModule } from '@angular/cdk/text-field'; -import { NgIf, AsyncPipe } from '@angular/common'; +import { AsyncPipe } from '@angular/common'; import { ChangeDetectionStrategy, Component, OnInit } from '@angular/core'; import { UntypedFormBuilder, ReactiveFormsModule } from '@angular/forms'; import { MatButtonModule } from '@angular/material/button'; @@ -33,7 +33,6 @@ import { TranslateDataSource } from './translate-datasource'; TextFieldModule, ReactiveFormsModule, MatSelectModule, - NgIf, MatOptionModule, MatButtonModule, RouterLink, diff --git a/src/app/target/unit/unit.component.html b/src/app/target/unit/unit.component.html index 86312ce..14f5a4d 100644 --- a/src/app/target/unit/unit.component.html +++ b/src/app/target/unit/unit.component.html @@ -35,9 +35,7 @@

{{ (unit | async)?.id }}

State - Initial + Initial Translated Reviewed Final diff --git a/src/app/target/unit/unit.component.ts b/src/app/target/unit/unit.component.ts index 8aa3d82..3caf9ed 100644 --- a/src/app/target/unit/unit.component.ts +++ b/src/app/target/unit/unit.component.ts @@ -71,7 +71,7 @@ export class UnitComponent implements OnDestroy { meaning: [{ value: unit.meaning || '-', disabled: true }], source: [{ value: unit.source, disabled: true }], target: unit.target, - state: [{ value: unit.state, disabled: !unit.target }], + state: unit.state, }); this._translationTargetService.updateUnitOnChange( unit,