Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@translation/angular

Package Overview
Dependencies
Maintainers
3
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@translation/angular - npm Package Compare versions

Comparing version 1.6.0 to 1.7.0

6

CHANGELOG.md
# Changelog
## [v1.7.0](https://github.com/translation/angular/releases/tag/v1.7.0) (2023-07-07)
#### Fixes (bugs & defects):
* Improve the rebuilding of target XLF files [#7](https://github.com/translation/angular/pull/7).
## [v1.6.0](https://github.com/translation/angular/releases/tag/v1.6.0) (2023-02-20)

@@ -4,0 +10,0 @@

2

package.json
{
"name": "@translation/angular",
"version": "1.6.0",
"version": "1.7.0",
"description": "Translation.io client for Angular applications",

@@ -5,0 +5,0 @@ "repository": {

@@ -346,9 +346,12 @@ const Interpolation = require('../utils/interpolation')

// 4 Populate the loaded .xlf it with targets from Translation.io
const translatedTargetSegments = response.segments[language]
const targetXmlUnitsHash = this.buildXmlUnitsHash(targetXmlUnits)
const translatedTargetSegments = response.segments[language]
const translatedTargetSegmentsHash = this.buildTranslatedTargetSegmentsHash(translatedTargetSegments)
translatedTargetSegments.forEach(translatedTargetSegment => {
let targetXmlUnit = targetXmlUnitsHash[this.uniqueIdentifier(translatedTargetSegment)]
if (targetXmlUnit && translatedTargetSegment.target != '') { // if not translated, then no <target>, then fallback to source language
// Iterate over XML units
targetXmlUnits.forEach(targetXmlUnit => {
const targetXmlUnitSegment = this.convertXmlUnitToSegment(targetXmlUnit)
const xmlUniqueIdentifier = this.uniqueIdentifier(targetXmlUnitSegment)
const translatedTargetSegment = translatedTargetSegmentsHash[xmlUniqueIdentifier]
if (translatedTargetSegment && translatedTargetSegment.target != '') { // if not translated, then no <target>, then fallback to source language
targetXmlUnit.target = this.recomposeTarget(targetXmlUnit, translatedTargetSegment)

@@ -364,2 +367,13 @@ }

// For O(1) search optimization
buildTranslatedTargetSegmentsHash(segments) {
let translatedTargetSegmentsHash = {}
segments.forEach(segment => {
translatedTargetSegmentsHash[this.uniqueIdentifier(segment)] = segment
})
return translatedTargetSegmentsHash
}
// Use XML segment and API segment to build back the target with existing interpolations

@@ -393,14 +407,2 @@ recomposeTarget(xmlUnit, segment) {

// For O(1) search optimization
buildXmlUnitsHash(xmlUnits) {
let targetXmlUnitsHash = {}
xmlUnits.forEach(xmlUnit => {
const segment = this.convertXmlUnitToSegment(xmlUnit)
targetXmlUnitsHash[this.uniqueIdentifier(segment)] = xmlUnit
})
return targetXmlUnitsHash
}
escapeDoubleSingleQuotesFromIcuPlural(icuPlural) {

@@ -407,0 +409,0 @@ // cf. https://www.debuggex.com/r/KO9jkSfi2RVzHlVE

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc