@lokalise/polyglot-sdk 24.0.0 → 24.1.0

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.
@@ -111,7 +111,7 @@ export const REQUEST_SIZE_LIMIT_MAP = {
111
111
  */
112
112
  [IntegrationEngineEnum.DEEPL]: 100000,
113
113
  /**
114
- * AI integrations use the default 5000 characters limit until we find way to process larger segments
114
+ * AI integrations use the default limit until we find a way to process larger segments
115
115
  * stable and efficiently.
116
116
  */
117
117
  [IntegrationEngineEnum.GEMINI]: SEGMENT_VALUE_MAX_LENGTH_DEFAULT,
@@ -1,10 +1,7 @@
1
- import { handleHtmlEscape } from "../helpers/htmlEscaping.js";
2
- import { wrapNonTranslatableRegions } from "../helpers/nonTranslatableContentHelper.js";
1
+ import { NON_TRANSLATABLE_END_TAG, NON_TRANSLATABLE_START_TAG, } from '@lokalise/non-translatable-markup';
3
2
  import { getRequestSizeLimit } from "./requestSizeLimit.js";
3
+ const NTC_MARKERS_REGEX = new RegExp(`[${NON_TRANSLATABLE_START_TAG}${NON_TRANSLATABLE_END_TAG}]`, 'g');
4
4
  export const isSegmentUnderLengthLimit = (value, integration) => {
5
- const limit = getRequestSizeLimit(integration);
6
- const htmlEscaped = handleHtmlEscape(value, integration);
7
- const ntcWrapped = wrapNonTranslatableRegions(htmlEscaped, integration);
8
- return ntcWrapped.length <= limit;
5
+ return value.replace(NTC_MARKERS_REGEX, '').length <= getRequestSizeLimit(integration);
9
6
  };
10
7
  //# sourceMappingURL=isSegmentUnderLengthLimit.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"isSegmentUnderLengthLimit.js","sourceRoot":"","sources":["../../../src/sdk/validation/isSegmentUnderLengthLimit.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAA;AAC7D,OAAO,EAAE,0BAA0B,EAAE,MAAM,4CAA4C,CAAA;AAEvF,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAA;AAE3D,MAAM,CAAC,MAAM,yBAAyB,GAAG,CACvC,KAAa,EACb,WAAmC,EAC1B,EAAE;IACX,MAAM,KAAK,GAAG,mBAAmB,CAAC,WAAW,CAAC,CAAA;IAC9C,MAAM,WAAW,GAAG,gBAAgB,CAAC,KAAK,EAAE,WAAW,CAAC,CAAA;IACxD,MAAM,UAAU,GAAG,0BAA0B,CAAC,WAAW,EAAE,WAAW,CAAC,CAAA;IAEvE,OAAO,UAAU,CAAC,MAAM,IAAI,KAAK,CAAA;AACnC,CAAC,CAAA"}
1
+ {"version":3,"file":"isSegmentUnderLengthLimit.js","sourceRoot":"","sources":["../../../src/sdk/validation/isSegmentUnderLengthLimit.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,wBAAwB,EACxB,0BAA0B,GAC3B,MAAM,mCAAmC,CAAA;AAE1C,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAA;AAE3D,MAAM,iBAAiB,GAAG,IAAI,MAAM,CAClC,IAAI,0BAA0B,GAAG,wBAAwB,GAAG,EAC5D,GAAG,CACJ,CAAA;AAED,MAAM,CAAC,MAAM,yBAAyB,GAAG,CACvC,KAAa,EACb,WAAmC,EAC1B,EAAE;IACX,OAAO,KAAK,CAAC,OAAO,CAAC,iBAAiB,EAAE,EAAE,CAAC,CAAC,MAAM,IAAI,mBAAmB,CAAC,WAAW,CAAC,CAAA;AACxF,CAAC,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lokalise/polyglot-sdk",
3
- "version": "24.0.0",
3
+ "version": "24.1.0",
4
4
  "author": {
5
5
  "name": "Lokalise",
6
6
  "url": "https://lokalise.com/"