@translation/angular
Advanced tools
Comparing version 1.4.0 to 1.5.0
# Changelog | ||
## [v1.5.0](https://github.com/translation/angular/releases/tag/v1.5.0) (2023-01-13) | ||
#### New features: | ||
* Improve substitution for interpolations with complex expressions like `user.birthday | date:\'dd/MM/y\'`. | ||
#### Fixes (bugs & defects): | ||
* Better node parsing if no `<source>` or `<target>` is found. | ||
## [v1.4.0](https://github.com/translation/angular/releases/tag/v1.4.0) (2023-01-12) | ||
@@ -4,0 +14,0 @@ |
{ | ||
"name": "@translation/angular", | ||
"version": "1.4.0", | ||
"version": "1.5.0", | ||
"description": "Translation.io client for Angular applications", | ||
@@ -5,0 +5,0 @@ "repository": { |
@@ -173,3 +173,3 @@ const Interpolation = require('../utils/interpolation') | ||
} else if (xmlNode) { | ||
return xmlNode['#text'] | ||
return xmlNode['#text'] || '' | ||
} else { | ||
@@ -176,0 +176,0 @@ return '' |
@@ -59,5 +59,15 @@ const HtmlTagExtraction = require('./html-tag-extraction') | ||
substitution = `{x1}` | ||
} else if (this.includesAll(extraction, ['id="INTERPOLATION', 'equiv-text="{{', '}}"'])) { // {name}, {variable}, {count} | ||
name = extraction.split('equiv-text="{{', 2)[1].split('}}"', 2)[0].trim() | ||
substitution = `{${name}}` | ||
} else if (this.includesAll(extraction, ['id="INTERPOLATION', 'equiv-text="{{', '}}"'])) { // {variable} or {complex | expression} | ||
name = extraction.split('equiv-text="{{', 2)[1].split('}}"', 2)[0].trim() | ||
if (/^[a-zA-Z_$][a-zA-Z_$0-9]*$/.test(name)) { // {variable} | ||
substitution = `{${name}}` | ||
} else { // {complex | expression} transformed as {x} | ||
if (extraction.includes('id="INTERPOLATION_')) { | ||
number = parseInt(extraction.split('id="INTERPOLATION_', 2)[1].split('"', 2)[0]) + 1 | ||
substitution = `{x${number}}` | ||
} else { | ||
substitution = `{x1}` | ||
} | ||
} | ||
} else if (this.includesAll(extraction, ['id="PH_', 'equiv-text='])) { // {x2}, {x3}, ... // Interpolations (placeholders) in components, using $localize | ||
@@ -64,0 +74,0 @@ number = parseInt(extraction.split('id="PH_', 2)[1].split('"', 2)[0]) + 1 |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
51590
711