langsys-js-typescript 0.6.0 → 0.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +9 -1
- package/dist/index.d.mts +9 -1
- package/dist/index.d.ts +9 -1
- package/dist/index.js +5 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +5 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,12 @@
|
|
|
1
|
-
## 0.6.
|
|
1
|
+
## 0.6.1 - 2026-08-15
|
|
2
|
+
|
|
3
|
+
### Fixed
|
|
4
|
+
|
|
5
|
+
- **`data-langsys-phrase="false"` / `="0"` are now honored as opt-outs.** 0.6.0 taught the tokenizer to skip subtrees carrying `langsys-php`'s keep-together marker, but matched on attribute presence alone. PHP's `hasPhraseAttribute()` treats presence as intent *while letting an explicit off value opt out* — so we skipped subtrees the author had deliberately un-marked, leaving that content translated by neither SDK. Matching is now value-aware and case-insensitive, mirroring PHP exactly.
|
|
6
|
+
|
|
7
|
+
Found by reading `HtmlParser.php` rather than trusting a summary of it — the same second-hand-documentation error this class of bug keeps producing.
|
|
8
|
+
|
|
9
|
+
## 0.6.0 - 2026-08-15
|
|
2
10
|
|
|
3
11
|
### Fixed
|
|
4
12
|
|
package/dist/index.d.mts
CHANGED
|
@@ -628,7 +628,15 @@ interface iContentBlock {
|
|
|
628
628
|
* additive — `data-langsys-phrase` never appears in DOM our components emit.
|
|
629
629
|
*/
|
|
630
630
|
declare const PHRASE_MARKER_ATTRS: readonly ["data-ls-phrase", "data-langsys-phrase"];
|
|
631
|
-
/**
|
|
631
|
+
/**
|
|
632
|
+
* True when an element is marked as a self-managed phrase by either SDK.
|
|
633
|
+
*
|
|
634
|
+
* Presence alone means intent, like any boolean HTML attribute — but an
|
|
635
|
+
* explicit `="false"` or `="0"` opts OUT, matching `langsys-php`'s
|
|
636
|
+
* `hasPhraseAttribute()` exactly. Without the opt-out we would skip a subtree
|
|
637
|
+
* the author had deliberately un-marked, and it would then be translated by
|
|
638
|
+
* neither SDK.
|
|
639
|
+
*/
|
|
632
640
|
declare function isPhraseMarked(element: Element): boolean;
|
|
633
641
|
/**
|
|
634
642
|
* Compute the deterministic content-block id from a `(category, tokens)` pair.
|
package/dist/index.d.ts
CHANGED
|
@@ -628,7 +628,15 @@ interface iContentBlock {
|
|
|
628
628
|
* additive — `data-langsys-phrase` never appears in DOM our components emit.
|
|
629
629
|
*/
|
|
630
630
|
declare const PHRASE_MARKER_ATTRS: readonly ["data-ls-phrase", "data-langsys-phrase"];
|
|
631
|
-
/**
|
|
631
|
+
/**
|
|
632
|
+
* True when an element is marked as a self-managed phrase by either SDK.
|
|
633
|
+
*
|
|
634
|
+
* Presence alone means intent, like any boolean HTML attribute — but an
|
|
635
|
+
* explicit `="false"` or `="0"` opts OUT, matching `langsys-php`'s
|
|
636
|
+
* `hasPhraseAttribute()` exactly. Without the opt-out we would skip a subtree
|
|
637
|
+
* the author had deliberately un-marked, and it would then be translated by
|
|
638
|
+
* neither SDK.
|
|
639
|
+
*/
|
|
632
640
|
declare function isPhraseMarked(element: Element): boolean;
|
|
633
641
|
/**
|
|
634
642
|
* Compute the deterministic content-block id from a `(category, tokens)` pair.
|
package/dist/index.js
CHANGED
|
@@ -1087,7 +1087,11 @@ var TRANSLATABLE_ATTRIBUTES = [
|
|
|
1087
1087
|
];
|
|
1088
1088
|
var PHRASE_MARKER_ATTRS = ["data-ls-phrase", "data-langsys-phrase"];
|
|
1089
1089
|
function isPhraseMarked(element) {
|
|
1090
|
-
return PHRASE_MARKER_ATTRS.some((attr) =>
|
|
1090
|
+
return PHRASE_MARKER_ATTRS.some((attr) => {
|
|
1091
|
+
if (!element.hasAttribute(attr)) return false;
|
|
1092
|
+
const value = (element.getAttribute(attr) ?? "").toLowerCase();
|
|
1093
|
+
return value !== "false" && value !== "0";
|
|
1094
|
+
});
|
|
1091
1095
|
}
|
|
1092
1096
|
var VALUE_TRANSLATABLE_ELEMENTS = ["button"];
|
|
1093
1097
|
var VALUE_TRANSLATABLE_INPUT_TYPES = ["submit", "button"];
|