@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
|
|
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 {
|
|
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
|
-
|
|
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,
|
|
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"}
|